[PATCH] D41100: [llvm-objcopy] Add alias and "driver" for llvm-strip

Jake Ehrlich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 11 16:45:34 PST 2017


jakehehrlich created this revision.
Herald added a subscriber: mgorny.

Being a drop in replacement for GNU objcopy has been a desire of the project as it has been devolved but we'd also like to replace GNU strip as well. Unfortunately they sport different interfaces and in one cases their interfaces contradict each other. This change adds a symlink for "llvm-strip" and a check (InvokeMain) to see which behavior should be used. This change adds a few additional things needed to make everything work smoothly.

1. A hidden "BigS" option for backwards compatibility. the "-S" option behaves differently in GNU strip and GNU objcopy so we handle this case specially.
2. An alias for the second positional argument "-o". This doesn't interfere with llvm-objcopy in anyway and the positional method doesn't interfere with strip so both are supported in both cases
3. strip is commonly used with just one argument and not specified output file to strip the input file. GNU objcopy isn't commonly used this way but it does support this. This change adds this behavior.
4. the "elf" output format is not explicit rather than implicit so you can directly specify "elf". Note that GNU objcopy doesn't have an "elf" output format but instead has equivalents for each of the 4 kinds of elfs and architectures. llvm-objcopy explicitly does not perform format conversion even between elf formats so there is only every one elf format that makes sense.


Repository:
  rL LLVM

https://reviews.llvm.org/D41100

Files:
  test/tools/llvm-objcopy/basic-strip.test
  tools/llvm-objcopy/CMakeLists.txt
  tools/llvm-objcopy/llvm-objcopy.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41100.126472.patch
Type: text/x-patch
Size: 13001 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171212/21173144/attachment.bin>


More information about the llvm-commits mailing list