GNU strip removes debug sections when --discard-all is specified and this patch attempts to mimic that behavior.
Details
- Reviewers
rupprecht jhenderson grimar • espindola alexander-shaposhnikov bcain - Commits
- rZORG74d42c5b5263: Let --discard-all imply --strip-debug.
rZORG509d11eb3250: Let --discard-all imply --strip-debug.
rG74d42c5b5263: Let --discard-all imply --strip-debug.
rG509d11eb3250: Let --discard-all imply --strip-debug.
rG5ad18a7d5941: Let --discard-all imply --strip-debug.
rL359887: Let --discard-all imply --strip-debug.
Diff Detail
- Repository
- rL LLVM
Event Timeline
test/tools/llvm-objcopy/ELF/discard-all-debug.test | ||
---|---|---|
2 ↗ | (On Diff #196515) | When I call GNU strip, it works without --keep-symbol=.L.str for this input. |
29 ↗ | (On Diff #196515) | Seems instead of lines 3-29 all you really need is just this line: # RUN: llvm-readobj --sections %t | FileCheck %s --implicit-check-not=.debug_ |
test/tools/llvm-objcopy/ELF/discard-all-debug.test | ||
---|---|---|
2 ↗ | (On Diff #196515) | GNU strip doesn't issue a message when a reference is still required, it just keeps it. |
29 ↗ | (On Diff #196515) | I didn't know about this option I will make the change, thanks. |
This appears to be correct. StripDebug is a preety simple and minimal field so we can go ahead and add this. The keep symbol thing still looks a bit funny.
Can you add this behavior to llvm-objcopy as well? We don't want them to be inconsistent.
test/tools/llvm-objcopy/ELF/discard-all-debug.test | ||
---|---|---|
2 ↗ | (On Diff #196515) | This doesn't explain grimar's question from my perspective and I have the same question. |
I have no more comments, minor nit/suggestion is inline.
test/tools/llvm-objcopy/ELF/discard-all-debug.test | ||
---|---|---|
5 ↗ | (On Diff #196661) | I am not sure it is useful to check the number of sections. All you need is to check that .debug_ sections are gone I think. |
test/tools/llvm-objcopy/ELF/discard-all-debug.test | ||
---|---|---|
2 ↗ | (On Diff #196515) | The binary used for the testcase has a symbol with a reference that cannot be stripped. GNU-strip will leave it in place with no message or warning, llvm errors out unless explicitly kept. The code doing it is: RelocationSection::removeSymbols in Object.cpp |