Commit graph

19 commits

Author SHA1 Message Date
Sergei Trofimovich b3b672d5a1 setup-hooks/separate-debug-info.sh: don't inhibit strip hook
Before the change separate-debug-info.sh did the stripping itself.
This scheme has a few problems:
1. Stripping happens only on ELF files. *.a and *.o files are skipped.
   Derivations have to do it manually. Usually incorrectly
   as they don't run $RANLIB (true for `glibc` and `musl`).
2. Stripping happens on all paths. Ideally only `stripDebugList` paths
   should be considered.
3. Host strip is called on Target files.

This change offloads stripping logic to strip hook. This strips more
files for `glibc` and `musl`. Now we can remove most $STRIP calls
from individual derivations.

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
2022-08-07 12:49:37 +01:00
Alyssa Ross d7fff81159
separateDebugInfo: enable full Rust debug info
By default, Cargo will only enable line tables.  -g enables full debug
info.  The RUSTFLAGS environment variable is examined by Cargo,
similar to how the NIX_*FLAGS* variables are examined by our compiler
wrappers.
2022-07-14 21:44:12 +00:00
Vladimír Čunát a7ccddeb54
Revert "Merge #160259: separateDebugInfo: Use --strip-unneeded"
This reverts commit 848091a52b, reversing
changes made to ab0e692ac7.

It caused issues with elfutils tests,
probably through over-stripping of glibc parts.
2022-03-23 21:43:15 +01:00
Anders Kaseorg d652556758 separateDebugInfo: Use --strip-unneeded
According to https://stackoverflow.com/q/46197810/115030,
--only-keep-debug preserves all the information stripped by
--strip-unneeded.  This reduces the size of the webkitgtk output by 22%
(123 MB → 96 MB).

Inspired by #159612.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2022-02-16 23:17:18 -08:00
Alyssa Ross bea767e5fe
separateDebugInfo: skip files objcopy can't read 2021-11-21 21:44:27 +00:00
deliciouslytyped 0e6b107cac setup-hooks: separate-debug-info.sh: Remove extraneous local variable originally used in ec5b66eb 2021-08-05 17:52:27 +02:00
John Ericson b8a21aa918 misc setup-hooks: Use env vars to refer to binutils programs
This is more robust for cross-compilation
2017-12-13 16:08:18 -05:00
Guillaume Maudoux bfd522da63 setup-hooks: do not pass missing dirs to find (close #15405)
find fails when called with an inexistent search path.
That situation may arise when the output is created after by a postFixup hook.
vcunat amended the PR by clarifying one more `return` to `return 0`.
2016-05-22 12:08:01 +02:00
Eelco Dolstra d5bb6a1f9c 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.
2016-02-28 02:57:37 +01:00
Eelco Dolstra 69a337edae separateDebugInfo: Compress debug sections at compile/link time 2016-02-28 01:54:55 +01:00
Eelco Dolstra d71a4851e8 Don't try to apply patchelf to non-ELF binaries 2016-02-18 22:54:11 +01:00
Eelco Dolstra bf63de1613 separateDebugInfo: Handle weird filenames properly 2016-02-18 22:54:11 +01:00
Eelco Dolstra 076de98c94 separateDebugInfo: Restore ELF check 2016-02-18 21:37:26 +01:00
Eelco Dolstra 2fcee55e5f separateDebugInfo: Create symlinks matching original binaries
For instance, a binary like libfoo.so will cause a symlink
lib/debug/libfoo.so.debug -> .build-id/<build-ID>.debug to be
created. This is primarily useful for use with eu-addr2line, if you
know the name of a binary and the relative address, but not the build
ID.
2016-01-15 16:16:11 +01:00
Vladimír Čunát 6b0add86b9 separateDebugInfo: one more comment 2015-09-23 10:35:40 +02:00
Vladimír Čunát 22521f3b90 separateDebugInfo: fix typo in comment 2015-09-22 22:07:58 +02:00
Vladimír Čunát b3658bc01b separateDebugInfo: compress it by default
Using zlib should be cheap enough and save lots of HDD space.
Case study (glib): 11 MB -> 4 MB.
2015-09-22 22:05:44 +02:00
Eelco Dolstra 2a28bc6691 separateDebugInfo: Assert Linux
Also remove some unintended setting of separateDebugInfo.
2015-09-22 20:21:10 +02:00
Eelco Dolstra ec5b66eb4a Enable separate debug info
You can now pass

  separateDebugInfo = true;

to mkDerivation. This causes debug info to be separated from ELF
binaries and stored in the "debug" output. The advantage is that it
enables installing lean binaries, while still having the ability to
make sense of core dumps, etc.
2015-09-17 15:56:33 +02:00