[PATCH] D119907: [ifs] Add --strip-needed flag
Alex Brachet via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 17 11:25:29 PST 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
abrachet marked an inline comment as done.
Closed by commit rGdf2812d8de2a: [ifs] Add --strip-needed flag (authored by abrachet).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D119907/new/
https://reviews.llvm.org/D119907
Files:
llvm/test/tools/llvm-ifs/strip-needed.test
llvm/tools/llvm-ifs/llvm-ifs.cpp
Index: llvm/tools/llvm-ifs/llvm-ifs.cpp
===================================================================
--- llvm/tools/llvm-ifs/llvm-ifs.cpp
+++ llvm/tools/llvm-ifs/llvm-ifs.cpp
@@ -103,6 +103,9 @@
StripUndefined("strip-undefined",
cl::desc("Strip undefined symbols from IFS output"),
cl::cat(IfsCategory));
+cl::opt<bool> StripNeededLibs("strip-needed",
+ cl::desc("Strip needed libs from output"),
+ cl::cat(IfsCategory));
cl::opt<std::string>
SoName("soname",
@@ -417,6 +420,9 @@
if (OverrideError)
fatalError(std::move(OverrideError));
+ if (StripNeededLibs)
+ Stub.NeededLibs.clear();
+
if (OutputELFFilePath.getNumOccurrences() == 0 &&
OutputIFSFilePath.getNumOccurrences() == 0 &&
OutputTBDFilePath.getNumOccurrences() == 0) {
Index: llvm/test/tools/llvm-ifs/strip-needed.test
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-ifs/strip-needed.test
@@ -0,0 +1,26 @@
+## Test --strip-needed flag
+
+# RUN: llvm-ifs --input-format=IFS --strip-needed --output-ifs=- %s | FileCheck %s
+
+# RUN: llvm-ifs --input-format=IFS --output-elf=- %s | \
+# RUN: obj2yaml | FileCheck %s --check-prefix=FROM-ELF
+
+# RUN: llvm-ifs --input-format=IFS --strip-needed --output-elf=- %s | \
+# RUN: obj2yaml | FileCheck %s --check-prefix=FROM-ELF-STRIP-NEEDED
+
+--- !ifs-v1
+IfsVersion: 3.0
+Target: { ObjectFormat: ELF, Arch: AArch64, Endianness: little, BitWidth: 64 }
+NeededLibs:
+ - ''
+Symbols: []
+...
+
+# CHECK: --- !ifs-v1
+# CHECK-NEXT: IfsVersion: {{[1-9]\d*\.(0|([1-9]\d*))}}
+# CHECK-NEXT: Target: { ObjectFormat: ELF, Arch: AArch64, Endianness: little, BitWidth: 64 }
+# CHECK-NEXT: Symbols: []
+# CHECK-NEXT: ...
+
+# FROM-ELF: DT_NEEDED
+# FROM-ELF-STRIP-NEEDED-NOT: DT_NEEDED
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119907.409727.patch
Type: text/x-patch
Size: 1892 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220217/5fce8788/attachment.bin>
More information about the llvm-commits
mailing list