[PATCH] D46896: [llvm-objcopy] Add --strip-unneeded option

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 16 05:28:58 PDT 2018


jhenderson added a comment.

In https://reviews.llvm.org/D46896#1100897, @paulsemel wrote:

> I'm sorry guys, but I think I am missing something. Indeed, if I used the ELF type and not something else, it's because objcopy is keeping global and weak symbols (except for undefined ones) for relocatable files.
>  This is actually done even if the symbol is not referenced by a relocation. That's why I don't really see what I can do with `SHF_ALLOC`.
>  Can you elaborate on this one ?


Sorry, I probably wasn't clear enough. You have a check for the object type in the change you are proposing. My point was that it is unnecessary. There shouldn't be a difference in llvm-objcopy's behaviour in this case. The code to mark a symbol as needed is only called for instances of `RelocationSection`, which deals with static relocations. Such relocations only appear typically in ET_REL inputs, but it should be harmless to modify them regardless of input type.


Repository:
  rL LLVM

https://reviews.llvm.org/D46896





More information about the llvm-commits mailing list