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

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 22 02:02:09 PDT 2018


jhenderson added a comment.

In https://reviews.llvm.org/D46896#1107439, @alexshap wrote:

> @jakehehrlich 
>  if i'm not mistaken it could be done differently, in particular, without introducing these subtle dependencies on the order of destruction of different section types.
>  In fact, if i'm not mistaken it's not really necessary to introduce that logic into the destructors at all.
>  Would the following approach work :  simply calculate the values of Symbol.UseCount after the removal of sections (it would be one loop over all the relocations and group sections) ?


I tentatively agree with Alex that the SymbolTable should be the owner of a symbol, and only the SymbolTable. It just feels "right"! Everything else in ELF just refers to the symbol. I think this approach could work, but I'd suggest that it becomes another section interface, so that we just iterate once through all of the sections, and each section type either does nothing (because it doesn't refer to symbols) or updates the use count of the relevant symbols - that would allow implementing of other section types that might rely on symbols, and would also mean we don't need to track what group and relocation sections we have.


Repository:
  rL LLVM

https://reviews.llvm.org/D46896





More information about the llvm-commits mailing list