[PATCH] D62317: [llvm-objcopy] - Strip undefined symbols if they are no longer referenced following --only-section

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 23 08:42:17 PDT 2019


jhenderson added a comment.

The behaviour you've implemented removes all unreferenced symbols, even if they weren't previously referenced. Is this wise? Also, have you experimented with other stripping options, e.g. removing a section which references a symbol? The bug used --only-section, but there might be other similar cases.



================
Comment at: test/tools/llvm-objcopy/ELF/only-sesction-strip-undefined.test:1-2
+## Here we want to check that llvm-objcopy removes the undefined symbol
+## if the source of reference was stripped.
+
----------------
the undefined -> an undefined
if the source of reference was -> if all references to it have been


================
Comment at: test/tools/llvm-objcopy/ELF/only-sesction-strip-undefined.test:11
+# BAR: bar
+
+--- !ELF
----------------
What about a test-case where there are two references to the same symbol, but only one of them is removed?


================
Comment at: tools/llvm-objcopy/ELF/ELFObjcopy.cpp:419
 
+    // We want to remove the undefined symbols if the source of reference,
+    // like relocation section was stripped.
----------------
remove the undefined -> remove undefined
the source of reference -like relocation section was stripped > all references have been stripped


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62317/new/

https://reviews.llvm.org/D62317





More information about the llvm-commits mailing list