[PATCH] D61672: [llvm-objcopy] Allow strip symtab in executables and DSOs

Eugene Leviant via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 14 01:47:22 PDT 2019


evgeny777 marked 6 inline comments as done.
evgeny777 added inline comments.


================
Comment at: test/tools/llvm-objcopy/ELF/no-symbol-relocation.test:9
   Data:            ELFDATA2LSB
-  Type:            ET_EXEC
+  Type:            ET_REL
   Machine:         EM_X86_64
----------------
jhenderson wrote:
> Why are you changing this?
Original yaml generates executable with relocation section. This triggers an error when this patch is applied, because llvm-objcopy attempts to strip symtab and fails because of the linked relocation section. 


================
Comment at: tools/llvm-objcopy/ELF/ELFObjcopy.cpp:424
          is_contained(Config.UnneededSymbolsToRemove, Sym.Name)) &&
-        isUnneededSymbol(Sym))
+        (!Obj.isRelocatable() || isUnneededSymbol(Sym)))
       return true;
----------------
jhenderson wrote:
> Why is this here? Is it tested?
I don't think I understand the question. Do you mean the check for `!Obj.isRelocatable()`? If so it's required to strip all symbols from static symbol table in executable. This in turn, will make static symbol empty and eventually it will be removed in `removeUnneededSections`


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

https://reviews.llvm.org/D61672





More information about the llvm-commits mailing list