diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-02-28 02:57:37 +0100 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-02-28 02:57:37 +0100 |
commit | d5bb6a1f9c0c099738a37ce2e923cd71d85b5145 (patch) | |
tree | eea5fe17f5e03cc377547879c122b1b69ea00198 /pkgs/build-support/cc-wrapper | |
parent | 69a337edae4d8d0dd6bd6e96468ba887509f3f0a (diff) | |
download | nixlib-d5bb6a1f9c0c099738a37ce2e923cd71d85b5145.tar nixlib-d5bb6a1f9c0c099738a37ce2e923cd71d85b5145.tar.gz nixlib-d5bb6a1f9c0c099738a37ce2e923cd71d85b5145.tar.bz2 nixlib-d5bb6a1f9c0c099738a37ce2e923cd71d85b5145.tar.lz nixlib-d5bb6a1f9c0c099738a37ce2e923cd71d85b5145.tar.xz nixlib-d5bb6a1f9c0c099738a37ce2e923cd71d85b5145.tar.zst nixlib-d5bb6a1f9c0c099738a37ce2e923cd71d85b5145.zip |
glibc: Enable separate debug symbols
The importance of glibc makes it worthwhile to provide debug symbols. However, this revealed an issue with separateDebugInfo: it was indiscriminately adding --build-id to all ld invocations, while in fact it should only do that for final links. Glibc also uses non-final ("relocatable") links, leading to subsequent failure to apply a build ID ("Cannot create .note.gnu.build-id section, --build-id ignored"). So now ld-wrapper.sh only passes --build-id for final links.
Diffstat (limited to 'pkgs/build-support/cc-wrapper')
-rw-r--r-- | pkgs/build-support/cc-wrapper/ld-wrapper.sh | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/pkgs/build-support/cc-wrapper/ld-wrapper.sh b/pkgs/build-support/cc-wrapper/ld-wrapper.sh index 6ef06eb70348..449a86459045 100644 --- a/pkgs/build-support/cc-wrapper/ld-wrapper.sh +++ b/pkgs/build-support/cc-wrapper/ld-wrapper.sh @@ -146,11 +146,26 @@ if [ "$NIX_DONT_SET_RPATH" != 1 ]; then # Finally, add `-rpath' switches. for i in $rpath; do - extra=(${extra[@]} -rpath $i) + extra+=(-rpath $i) done fi +# Only add --build-id if this is a final link. FIXME: should build gcc +# with --enable-linker-build-id instead? +if [ "$NIX_SET_BUILD_ID" = 1 ]; then + for p in "${params[@]}"; do + if [ "$p" = "-r" -o "$p" = "--relocatable" -o "$p" = "-i" ]; then + relocatable=1 + break + fi + done + if [ -z "$relocatable" ]; then + extra+=(--build-id) + fi +fi + + # Optionally print debug info. if [ -n "$NIX_DEBUG" ]; then echo "original flags to @prog@:" >&2 |