1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-25 07:00:43 +00:00
nixpkgs/pkgs/build-support/gcc-wrapper-old/ld-solaris-wrapper.sh
Vladimír Čunát 1a0a161920 gnat: make it build again (close #5307)
Problems are worked around by using older gcc wrapper for gnat bootstrap.
(from ca441636f1^)

I tried nicer solutions first, but I was unable to fix all problems for hours.
2014-12-14 16:24:31 +01:00

41 lines
975 B
Bash

#!/bin/bash
set -e
set -u
# I've also tried adding -z direct and -z lazyload, but it gave too many problems with C++ exceptions :'(
# Also made sure libgcc would not be lazy-loaded, as suggested here: https://www.illumos.org/issues/2534#note-3
# but still no success.
cmd="@ld@ -z ignore"
args=("$@");
# This loop makes sure all -L arguments are before -l arguments, or ld may complain it cannot find a library.
# GNU binutils does not have this problem:
# http://stackoverflow.com/questions/5817269/does-the-order-of-l-and-l-options-in-the-gnu-linker-matter
i=0;
while [[ $i -lt $# ]]; do
case "${args[$i]}" in
-L) cmd="$cmd ${args[$i]} ${args[($i+1)]}"; i=($i+1); ;;
-L*) cmd="$cmd ${args[$i]}" ;;
*) ;;
esac
i=($i+1);
done
i=0;
while [[ $i -lt $# ]]; do
case "${args[$i]}" in
-L) i=($i+1); ;;
-L*) ;;
*) cmd="$cmd ${args[$i]}" ;;
esac
i=($i+1);
done
# Trace:
set -x
exec $cmd
exit 0