[llvm] 7aaad7b - [ifs] Fix bug where exclude only excluded when outputting ifs files
Alex Brachet via llvm-commits
llvm-commits at lists.llvm.org
Mon May 2 10:49:23 PDT 2022
Author: Alex Brachet
Date: 2022-05-02T17:49:06Z
New Revision: 7aaad7b18322a22555b2fbb0ad686f23f44502c8
URL: https://github.com/llvm/llvm-project/commit/7aaad7b18322a22555b2fbb0ad686f23f44502c8
DIFF: https://github.com/llvm/llvm-project/commit/7aaad7b18322a22555b2fbb0ad686f23f44502c8.diff
LOG: [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
Added:
Modified:
llvm/test/tools/llvm-ifs/exclude.test
llvm/tools/llvm-ifs/llvm-ifs.cpp
Removed:
################################################################################
diff --git a/llvm/test/tools/llvm-ifs/exclude.test b/llvm/test/tools/llvm-ifs/exclude.test
index 29f9ab8515124..78789486bc8d5 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 bf81a60f0bc36..1ac8c0df9d006 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));
More information about the llvm-commits
mailing list