[PATCH] D56480: [llvm-objcopy] [COFF] Implmement --strip-unneeded and -x/--discard-all for symbols

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 11 02:37:17 PST 2019


mstorsjo marked 2 inline comments as done.
mstorsjo added inline comments.
Herald added a reviewer: rupprecht.


================
Comment at: test/tools/llvm-objcopy/COFF/strip-unneeded.yaml:8-9
+
+# Despite the name, --discard-all (-x) also only removes unreferenced
+# local symbols.
+
----------------
jhenderson wrote:
> Just to confirm, this is what GNU objcopy does? The ELF side attempts to strip local symbols in this case whether they're referenced or not.
> 
> Another difference between the two is that undefined locals are stripped by strip-unneeded, but not discard-all.
GNU objcopy doesn't strip referenced local symbols, but undefined locals (which I wasn't even aware of being a thing) does indeed seem to have the difference you mention. I'll implement that.


================
Comment at: test/tools/llvm-objcopy/COFF/strip-unneeded.yaml:11
+
+# RUN: llvm-objcopy --discard-all %t.in.o %t.out.o
+# RUN: llvm-objdump -t %t.out.o | FileCheck %s --check-prefix=SYMBOLS
----------------
jhenderson wrote:
> I have a marginal preference to use a different output file name for each case. This allows a user to inspect the corresponding output file, should the need arise, without having to mess about with the test.
Yes, especially as the output actually should be different in this case, after adding a testcase of undefined local symbols.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D56480





More information about the llvm-commits mailing list