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

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 18 00:50:58 PDT 2019


grimar 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:
> 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)


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