[PATCH] D47052: [llvm-objcopy] Fix the behavior of --strip-* and --keep-symbol

Alexander Shaposhnikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 18 01:26:40 PDT 2018


alexshap added inline comments.


================
Comment at: tools/llvm-objcopy/llvm-objcopy.cpp:296
   if (Config.StripAllGNU)
-    RemovePred = [RemovePred, &Obj](const SectionBase &Sec) {
+    RemovePred = [RemovePred, &Obj, KeepSymbolsTable](const SectionBase &Sec) {
+      if (KeepSymbolsTable &&
----------------
jakehehrlich wrote:
> Instead of duplicating all of these you can add this once at the end as a single keep step
> 
> Proposal aggregated from my comments
> ```
> if (!Config.SymbolsToKeep.empty())
>   RemovePred = [RemovePred, &Obj](const SectionBase &Sec] {
>     if ( /* section is symbol table or symbol table's string table */)
>       return false;
>     return RemovePred(Sec);
>   }
> ```
that's what i originally did,
it doesn't work correctly, or, at least not what binutils objcopy does.


Repository:
  rL LLVM

https://reviews.llvm.org/D47052





More information about the llvm-commits mailing list