forked from OSchip/llvm-project
[ifs] Add --strip-needed flag
Reviewed By: haowei, mcgrathr Differential Revision: https://reviews.llvm.org/D119907
This commit is contained in:
parent
a52b9102d1
commit
df2812d8de
|
@ -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
|
|
@ -103,6 +103,9 @@ cl::opt<bool>
|
|||
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 @@ int main(int argc, char *argv[]) {
|
|||
if (OverrideError)
|
||||
fatalError(std::move(OverrideError));
|
||||
|
||||
if (StripNeededLibs)
|
||||
Stub.NeededLibs.clear();
|
||||
|
||||
if (OutputELFFilePath.getNumOccurrences() == 0 &&
|
||||
OutputIFSFilePath.getNumOccurrences() == 0 &&
|
||||
OutputTBDFilePath.getNumOccurrences() == 0) {
|
||||
|
|
Loading…
Reference in New Issue