GNU objcopy removes STT_FILE symbols for --strip-debug operations, and keeps them for --discard-all operation. Match their behaviour for llvm-objcopy.
Details
Diff Detail
Event Timeline
llvm/test/tools/llvm-objcopy/ELF/keep-file-symbols.test | ||
---|---|---|
110 | I don't think we should taint the blame history just for minor cosmetic reason. Besides, plenty of other tests does not have space after #. |
llvm/test/tools/llvm-objcopy/ELF/keep-file-symbols.test | ||
---|---|---|
12 | Yes, this test is about the "--keep-file-symbols" option. All calls should use it. To test your behaviour, you should add to the strip-debug.test, strip-unneeded.test and discard-all.test (although as @MaskRay says, you should also test things here with --keep-file-symbols). You also need test cases for both llvm-objcopy and llvm-strip, since you've modified code that affects them each separately. | |
130 | Nit: too many blank lines at end of file. | |
llvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp | ||
424 | No need for this code change: --keep-file-symbols is actioned above at line 410. |
llvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp | ||
---|---|---|
425 | You still don't need && !Config.KeepFileSymbols. Line 410 of this file handles that case (if you delete it, you should see no changes in test results). |
LGTM, with the suggested comment deletion. Please let @MaskRay comment too.
llvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp | ||
---|---|---|
423–425 | Taking another look, I don't think you need the comment at all as the code clearly describes this behaviour (--strip-debug removing STT_FILE symbols), so I think you can delete it. |
Looks like this breaks tests everywhere, e.g http://45.33.8.238/linux/15764/step_12.txt
Please take a look and revert if it takes a while to investigate.
We need tests for --strip-debug --keep-file-symbols and --strip-unneeded --keep-file-symbols