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/wrapper-common | |
parent | 61c74e1aee1b7fb35ca3c550f57286cf85999e96 (diff) |
cc-wrapper: don't set rpath on static-pie executables
Diffstat (limited to 'pkgs/build-support/wrapper-common')
-rw-r--r-- | pkgs/build-support/wrapper-common/utils.bash | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/pkgs/build-support/wrapper-common/utils.bash b/pkgs/build-support/wrapper-common/utils.bash index 66b7c3f3e83c5..a0e3225202002 100644 --- a/pkgs/build-support/wrapper-common/utils.bash +++ b/pkgs/build-support/wrapper-common/utils.bash @@ -123,3 +123,38 @@ expandResponseParams() { fi done } + +checkLinkType() { + local arg mode + type="dynamic" + for arg in "$@"; do + if [[ "$arg" = -static ]]; then + type="static" + elif [[ "$arg" = -static-pie ]]; then + type="static-pie" + fi + done + echo "$type" +} + +# When building static-pie executables we cannot have rpath +# set. At least glibc requires rpath to be empty +filterRpathFlags() { + local linkType=$1 ret="" i + shift + + if [[ "$linkType" == "static-pie" ]]; then + while [[ "$#" -gt 0 ]]; do + i="$1"; shift 1 + if [[ "$i" == -rpath ]]; then + # also skip its argument + shift + else + ret+="$i " + fi + done + else + ret=$@ + fi + echo $ret +} |