diff options
author | Alex Brachet <abrachet@google.com> | 2022-05-02 17:49:06 +0000 |
---|---|---|
committer | Alex Brachet <abrachet@google.com> | 2022-05-02 17:49:06 +0000 |
commit | 7aaad7b18322a22555b2fbb0ad686f23f44502c8 (patch) | |
tree | 954d00c60329baa893c98660ad963c94e7bac6aa /llvm | |
parent | 304378fd096755950939f2d3dbb4f724bba0d6cb (diff) | |
download | llvm-7aaad7b18322a22555b2fbb0ad686f23f44502c8.zip llvm-7aaad7b18322a22555b2fbb0ad686f23f44502c8.tar.gz llvm-7aaad7b18322a22555b2fbb0ad686f23f44502c8.tar.bz2 |
[ifs] Fix bug where exclude only excluded when outputting ifs files
Now output elf files will also have excluded symbols removed.
Reviewed By: haowei
Differential Revision: https://reviews.llvm.org/D124781
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/test/tools/llvm-ifs/exclude.test | 4 | ||||
-rw-r--r-- | llvm/tools/llvm-ifs/llvm-ifs.cpp | 7 |
2 files changed, 7 insertions, 4 deletions
diff --git a/llvm/test/tools/llvm-ifs/exclude.test b/llvm/test/tools/llvm-ifs/exclude.test index 29f9ab8..7878948 100644 --- a/llvm/test/tools/llvm-ifs/exclude.test +++ b/llvm/test/tools/llvm-ifs/exclude.test @@ -2,6 +2,9 @@ # RUN: llvm-ifs --input-format=IFS --output-ifs=- --exclude='exclude*' %s | FileCheck %s +# Check that exclude excludes from elf files too. +# RUN: llvm-ifs %s --output-elf - --exclude='exclude*' | llvm-ifs - --output-ifs - | FileCheck %s + # RUN: llvm-ifs --input-format=IFS --output-ifs=- --exclude='exclude*' \ # RUN: --strip-undefined %s | FileCheck %s --check-prefix=BOTH @@ -13,6 +16,7 @@ --- !ifs-v1 SoName: somelib.so IfsVersion: 3.0 +Target: x86_64-unknown-linux-gnu Symbols: - { Name: dont_exclude, Type: Func, Undefined: true } - { Name: exclude_1, Type: Func } diff --git a/llvm/tools/llvm-ifs/llvm-ifs.cpp b/llvm/tools/llvm-ifs/llvm-ifs.cpp index bf81a60..1ac8c0d 100644 --- a/llvm/tools/llvm-ifs/llvm-ifs.cpp +++ b/llvm/tools/llvm-ifs/llvm-ifs.cpp @@ -429,6 +429,9 @@ int main(int argc, char *argv[]) { if (StripNeededLibs) Stub.NeededLibs.clear(); + if (Error E = filterIFSSyms(Stub, StripUndefined, ExcludeSyms)) + fatalError(std::move(E)); + if (OutputELFFilePath.getNumOccurrences() == 0 && OutputIFSFilePath.getNumOccurrences() == 0 && OutputTBDFilePath.getNumOccurrences() == 0) { @@ -485,8 +488,6 @@ int main(int argc, char *argv[]) { stripIFSTarget(Stub, StripIFSTarget, StripIFSArch, StripIFSEndiannessWidth, StripIFSBitWidth); } - if (Error E = filterIFSSyms(Stub, StripUndefined, ExcludeSyms)) - fatalError(std::move(E)); Error IFSWriteError = writeIFS(OutputFilePath.getValue(), Stub); if (IFSWriteError) fatalError(std::move(IFSWriteError)); @@ -537,8 +538,6 @@ int main(int argc, char *argv[]) { stripIFSTarget(Stub, StripIFSTarget, StripIFSArch, StripIFSEndiannessWidth, StripIFSBitWidth); } - if (Error E = filterIFSSyms(Stub, StripUndefined, ExcludeSyms)) - fatalError(std::move(E)); Error IFSWriteError = writeIFS(OutputIFSFilePath.getValue(), Stub); if (IFSWriteError) fatalError(std::move(IFSWriteError)); |