summary refs log tree commit diff
path: root/pkgs/build-support/gcc-wrapper/ld-wrapper.sh
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/build-support/gcc-wrapper/ld-wrapper.sh')
-rw-r--r--pkgs/build-support/gcc-wrapper/ld-wrapper.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/pkgs/build-support/gcc-wrapper/ld-wrapper.sh b/pkgs/build-support/gcc-wrapper/ld-wrapper.sh
new file mode 100644
index 000000000000..2201bbe19d23
--- /dev/null
+++ b/pkgs/build-support/gcc-wrapper/ld-wrapper.sh
@@ -0,0 +1,28 @@
+#! /bin/sh
+
+if test -n "$NIX_LD_WRAPPER_START_HOOK"; then
+    . "$NIX_LD_WRAPPER_START_HOOK"
+fi
+
+extra=()
+
+if test -z "$NIX_LDFLAGS_SET"; then
+    extra=(${extra[@]} $NIX_LDFLAGS)
+fi
+
+if test "$NIX_DEBUG" = "1"; then
+  echo "original flags to @ld@:" >&2
+  for i in "$@"; do
+      echo "  $i" >&2
+  done
+  echo "extra flags to @ld@:" >&2
+  for i in ${extra[@]}; do
+      echo "  $i" >&2
+  done
+fi
+
+if test -n "$NIX_LD_WRAPPER_EXEC_HOOK"; then
+    . "$NIX_LD_WRAPPER_EXEC_HOOK"
+fi
+
+exec @ld@ "$@" ${extra[@]}