diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2017-08-28 14:56:08 -0400 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2017-12-13 16:08:18 -0500 |
commit | 8e557ed2c58e6ce48a8d05dbc57ef84e98b4cecd (patch) | |
tree | 1f981fdaa6de98e84214b0feb76795812dbfe10f /pkgs/build-support/bintools-wrapper/ld-solaris-wrapper.sh | |
parent | 4f869bccc14fb2fa19df130e76c022765ecda924 (diff) | |
download | nixpkgs-8e557ed2c58e6ce48a8d05dbc57ef84e98b4cecd.tar nixpkgs-8e557ed2c58e6ce48a8d05dbc57ef84e98b4cecd.tar.gz nixpkgs-8e557ed2c58e6ce48a8d05dbc57ef84e98b4cecd.tar.bz2 nixpkgs-8e557ed2c58e6ce48a8d05dbc57ef84e98b4cecd.tar.lz nixpkgs-8e557ed2c58e6ce48a8d05dbc57ef84e98b4cecd.tar.xz nixpkgs-8e557ed2c58e6ce48a8d05dbc57ef84e98b4cecd.tar.zst nixpkgs-8e557ed2c58e6ce48a8d05dbc57ef84e98b4cecd.zip |
bintools-wrapper: Init
Factor a bintools (i.e. binutils / cctools) wrapper out of cc-wrapper. While only LD is wrapped, the setup hook defines environment variables on behalf of other utilites.
Diffstat (limited to 'pkgs/build-support/bintools-wrapper/ld-solaris-wrapper.sh')
-rw-r--r-- | pkgs/build-support/bintools-wrapper/ld-solaris-wrapper.sh | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/pkgs/build-support/bintools-wrapper/ld-solaris-wrapper.sh b/pkgs/build-support/bintools-wrapper/ld-solaris-wrapper.sh new file mode 100644 index 00000000000..5d81e34a047 --- /dev/null +++ b/pkgs/build-support/bintools-wrapper/ld-solaris-wrapper.sh @@ -0,0 +1,29 @@ +#!@shell@ +set -eu -o pipefail +shopt -s nullglob + +if (( "${NIX_DEBUG:-0}" >= 7 )); then + set -x +fi + +declare -a args=("$@") +# 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. +declare -a argsBefore=(-z ignore) argsAfter=() + +# 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 +while (( $# )); do + case "${args[$i]}" in + -L) argsBefore+=("$1" "$2"); shift ;; + -L?*) argsBefore+=("$1") ;; + *) argsAfter+=("$1") ;; + esac + shift +done + +# Trace: +set -x +exec "@ld@" "${argsBefore[@]}" "${argsAfter[@]}" |