[PATCH] D105249: [llvm-strip] Support grouped options in llvm-strip
Daniel RodrÃguez Troitiño via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 30 16:57:41 PDT 2021
drodriguez created this revision.
drodriguez added reviewers: jhenderson, alexander-shaposhnikov, smeenai.
Herald added a reviewer: rupprecht.
drodriguez requested review of this revision.
Herald added subscribers: llvm-commits, MaskRay.
Herald added a project: LLVM.
GNU and Apple `strip` implementations seems to support grouped options.
Enable the support for grouped options introduced in
https://reviews.llvm.org/D83639 for `llvm-strip` invocations.
Includes test that checks that both the grouped and non grouped
invocations produces the same result.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D105249
Files:
llvm/test/tools/llvm-objcopy/grouped-options.test
llvm/tools/llvm-objcopy/ConfigManager.cpp
Index: llvm/tools/llvm-objcopy/ConfigManager.cpp
===================================================================
--- llvm/tools/llvm-objcopy/ConfigManager.cpp
+++ llvm/tools/llvm-objcopy/ConfigManager.cpp
@@ -1242,6 +1242,7 @@
DashDash = std::next(DashDash);
StripOptTable T;
+ T.setGroupedShortOptions(true);
unsigned MissingArgumentIndex, MissingArgumentCount;
llvm::opt::InputArgList InputArgs =
T.ParseArgs(ArgsArr, MissingArgumentIndex, MissingArgumentCount);
Index: llvm/test/tools/llvm-objcopy/grouped-options.test
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-objcopy/grouped-options.test
@@ -0,0 +1,53 @@
+# RUN: yaml2obj %s -o %t
+# RUN: llvm-strip -S -x -o %t-separated %t
+# RUN: llvm-strip -Sx -o %t-grouped %t
+# RUN: cmp %t-separated %t-grouped
+
+!ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_X86_64
+Sections:
+ - Name: .debugGlobal
+ Type: SHT_PROGBITS
+ Content: "00000000"
+ - Name: .zdebugGlobal
+ Type: SHT_PROGBITS
+ Content: "00000000"
+ - Name: .gdb_index
+ Type: SHT_PROGBITS
+ Content: "00000000"
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ Address: 0x1000
+ AddressAlign: 0x0000000000000010
+ Size: 64
+Symbols:
+ - Name: Local
+ Type: STT_FUNC
+ Section: .text
+ Value: 0x1000
+ Size: 8
+ - Name: LocalSection
+ Type: STT_SECTION
+ Section: .text
+ - Name: LocalFile
+ Type: STT_FILE
+ - Name: Global
+ Type: STT_FUNC
+ Size: 8
+ Section: .text
+ Value: 0x1010
+ Binding: STB_GLOBAL
+ - Name: Weak
+ Type: STT_FUNC
+ Size: 8
+ Section: .text
+ Value: 0x1008
+ - Name: debugGlobal
+ Section: .debugGlobal
+ Binding: STB_GLOBAL
+
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105249.355729.patch
Type: text/x-patch
Size: 2075 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210630/05447d3c/attachment.bin>
More information about the llvm-commits
mailing list