[PATCH] D60324: [llvm-objcopy] Add switch to allow removing referenced sections

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 18 00:56:32 PDT 2019


jhenderson marked an inline comment as done.
jhenderson added inline comments.


================
Comment at: test/tools/llvm-objcopy/ELF/remove-linked-section.test:5
+## Use --strip-debug to suppress the default --strip-all behvior of llvm-strip.
+# RUN: not llvm-strip --strip-debug -R .foo %t2 2>&1 >/dev/null | FileCheck %s --check-prefix=ERR
+
----------------
grimar wrote:
> grimar wrote:
> > I am not familiar with llvm-strip.
> > Looking at its code:
> > 
> > ```
> >   if (!Config.StripDebug && !Config.StripUnneeded &&
> >       Config.DiscardMode == DiscardType::None && !Config.StripAllGNU && Config.SymbolsToRemove.empty())
> >     Config.StripAll = true;
> > ```
> > 
> > Seems that `-N fakesymbol` would prevent stripping all. Should it work in the same way for `-R`?
> To clarify: I do not really think using of `--strip-debug` to suppress the default `--strip-all` behavior is a stopper for landing this,
> but I wonder if it worth to add a TODO about removing that in future or it is a normal thing? (it looks a bit hacky though).
> 
> i.e. for me as a person who knows nothing about `llvm-strip` is unclear if it should:
> * Have `--strip-nothing` flag for such situations? At least for use in test cases?
> * Do not force strip all if any `-R` is given. (With that you do would not need any hacks like that here)
I was surprised by this as well, but testing GNU objcopy shows that we match their behaviour in this area. I think a --no-strip-all switch would be good, personally. It's in keeping with existing switches in other tools. I'll look at adding a TODO.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D60324





More information about the llvm-commits mailing list