diff options
author | Jörg Thalheim <joerg@thalheim.io> | 2021-05-22 13:55:47 +0200 |
---|---|---|
committer | Jörg Thalheim <joerg@thalheim.io> | 2021-05-23 17:38:17 +0000 |
commit | 166948d4794be5c56c6279bf580ac416b1bcf022 (patch) | |
tree | aaad77fbf9922aa9fe767c638e4c41b06088b3d3 /pkgs/build-support/cc-wrapper | |
parent | 61c74e1aee1b7fb35ca3c550f57286cf85999e96 (diff) | |
download | nixpkgs-166948d4794be5c56c6279bf580ac416b1bcf022.tar nixpkgs-166948d4794be5c56c6279bf580ac416b1bcf022.tar.gz nixpkgs-166948d4794be5c56c6279bf580ac416b1bcf022.tar.bz2 nixpkgs-166948d4794be5c56c6279bf580ac416b1bcf022.tar.lz nixpkgs-166948d4794be5c56c6279bf580ac416b1bcf022.tar.xz nixpkgs-166948d4794be5c56c6279bf580ac416b1bcf022.tar.zst nixpkgs-166948d4794be5c56c6279bf580ac416b1bcf022.zip |
cc-wrapper: don't set rpath on static-pie executables
Diffstat (limited to 'pkgs/build-support/cc-wrapper')
-rw-r--r-- | pkgs/build-support/cc-wrapper/cc-wrapper.sh | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/pkgs/build-support/cc-wrapper/cc-wrapper.sh b/pkgs/build-support/cc-wrapper/cc-wrapper.sh index 2e62aef4604..aa25de33641 100644 --- a/pkgs/build-support/cc-wrapper/cc-wrapper.sh +++ b/pkgs/build-support/cc-wrapper/cc-wrapper.sh @@ -29,9 +29,10 @@ cc1=0 cxxInclude=1 cxxLibrary=1 cInclude=1 -setDynamicLinker=1 expandResponseParams "$@" +linkType=$(checkLinkType "$@") + declare -i n=0 nParams=${#params[@]} while (( "$n" < "$nParams" )); do @@ -60,8 +61,6 @@ while (( "$n" < "$nParams" )); do cxxInclude=0 elif [ "$p" = -nostdinc++ ]; then cxxInclude=0 - elif [[ "$p" = -static || "$p" = -static-pie ]]; then - setDynamicLinker=0 elif [[ "$p" != -?* ]]; then # A dash alone signifies standard input; it is not a flag nonFlagArgs=1 @@ -151,24 +150,24 @@ if [ "$dontLink" != 1 ]; then # Add the flags that should only be passed to the compiler when # linking. - extraAfter+=($NIX_CFLAGS_LINK_@suffixSalt@) + extraAfter+=($(filterRpathFlags "$linkType" $NIX_CFLAGS_LINK_@suffixSalt@)) # Add the flags that should be passed to the linker (and prevent # `ld-wrapper' from adding NIX_LDFLAGS_@suffixSalt@ again). - for i in $NIX_LDFLAGS_BEFORE_@suffixSalt@; do + for i in $(filterRpathFlags "$linkType" $NIX_LDFLAGS_BEFORE_@suffixSalt@); do extraBefore+=("-Wl,$i") done - if [[ "$setDynamicLinker" = 1 && -n "$NIX_DYNAMIC_LINKER_@suffixSalt@" ]]; then + if [[ "$linkType" == dynamic && -n "$NIX_DYNAMIC_LINKER_@suffixSalt@" ]]; then extraBefore+=("-Wl,-dynamic-linker=$NIX_DYNAMIC_LINKER_@suffixSalt@") fi - for i in $NIX_LDFLAGS_@suffixSalt@; do + for i in $(filterRpathFlags "$linkType" $NIX_LDFLAGS_@suffixSalt@); do if [ "${i:0:3}" = -L/ ]; then extraAfter+=("$i") else extraAfter+=("-Wl,$i") fi done - export NIX_LDFLAGS_SET_@suffixSalt@=1 + export NIX_LINK_TYPE_@suffixSalt@=$linkType fi # As a very special hack, if the arguments are just `-v', then don't |