pytrainer: unpin python 3.10
[NixPkgs.git] / pkgs / build-support / bintools-wrapper / ld-solaris-wrapper.sh
blob5d81e34a047f99580bf874bce32cda99dadc015d
1 #!@shell@
2 set -eu -o pipefail
3 shopt -s nullglob
5 if (( "${NIX_DEBUG:-0}" >= 7 )); then
6 set -x
7 fi
9 declare -a args=("$@")
10 # I've also tried adding -z direct and -z lazyload, but it gave too many problems with C++ exceptions :'(
11 # Also made sure libgcc would not be lazy-loaded, as suggested here: https://www.illumos.org/issues/2534#note-3
12 # but still no success.
13 declare -a argsBefore=(-z ignore) argsAfter=()
15 # This loop makes sure all -L arguments are before -l arguments, or ld may complain it cannot find a library.
16 # GNU binutils does not have this problem:
17 # http://stackoverflow.com/questions/5817269/does-the-order-of-l-and-l-options-in-the-gnu-linker-matter
18 while (( $# )); do
19 case "${args[$i]}" in
20 -L) argsBefore+=("$1" "$2"); shift ;;
21 -L?*) argsBefore+=("$1") ;;
22 *) argsAfter+=("$1") ;;
23 esac
24 shift
25 done
27 # Trace:
28 set -x
29 exec "@ld@" "${argsBefore[@]}" "${argsAfter[@]}"