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

Jake Ehrlich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 18 12:13:53 PDT 2018


jakehehrlich added a comment.

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

> In https://reviews.llvm.org/D46896#1104596, @jhenderson wrote:
>
> > I'm not sure if it makes much sense, but could this interact badly with group section signature symbols?
>
>
> If by interact badly you mean "having an error if this situation occurs", the answer is yes badly..
>  But I told myself that this problem is handle in the symbol removal function, so this is not the "problem" of this option if I can say.
>  Btw, we need to get rid of the error throwing and handle this case correctly.


Shouldn't we consider a symbol needed if it is referenced by a group section? I think it should add to the reference count.



================
Comment at: tools/llvm-objcopy/Object.cpp:199
   }
+  if (auto RelSec = dyn_cast<RelocationSection>(Sec)) {
+    for (const auto &Reloc : RelSec->relocations())
----------------
The relocation section can do this itself by storing a non-const pointer.


================
Comment at: tools/llvm-objcopy/Object.h:443
   void removeSymbols(function_ref<bool(const Symbol &)> ToRemove) override;
+  ConstRange<Relocation> relocations() const {
+    return make_range(Relocations.begin(), Relocations.end());
----------------
I don't think you need this function.


Repository:
  rL LLVM

https://reviews.llvm.org/D46896





More information about the llvm-commits mailing list