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.
This commit is contained in:
Eelco Dolstra
2016-02-28 02:57:37 +01:00
parent 69a337edae
commit d5bb6a1f9c
4 changed files with 25 additions and 18 deletions
+16 -1
View File
@@ -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