[PATCH] D13934: [ELF2] --strip-all/-s command line implemented

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 21 07:11:01 PDT 2015


grimar added inline comments.

================
Comment at: ELF/Writer.cpp:113-115
@@ -111,4 +112,5 @@
   Out<ELFT>::Plt = &Plt;
-  SymbolTableSection<ELFT> SymTab(*Symtab, *Out<ELFT>::StrTab);
-  Out<ELFT>::SymTab = &SymTab;
-  SymbolTableSection<ELFT> DynSymTab(*Symtab, *Out<ELFT>::DynStrTab);
+  SymbolTableSection<ELFT> SymTab(*Symtab, Out<ELFT>::StrTab);
+  if (!Config->StripAll)
+    Out<ELFT>::SymTab = &SymTab;
+  SymbolTableSection<ELFT> DynSymTab(*Symtab, Out<ELFT>::DynStrTab);
----------------
ruiu wrote:
> This is a bit confusing. Let's do this
> 
>   std::unique_ptr<SymbolTableSection<ELFT>> SymTab;
>   if (!Config->StripAll) {
>     SymTab.reset(new SymbolTableSection<ELFT>(*Symtab, *Out<ELFT>::StrTab);
>     Out<ELFT>::SymTab = SymTab.get();
>   }
> 
I thought about something like that, just didn`t know will it keep code consistency or not. I agree, that will be better.

btw, the same can be applied for RelaPlt and GotPlt since we dont need to create them when lazy relocs are off. (not for this patch)


http://reviews.llvm.org/D13934





More information about the llvm-commits mailing list