aboutsummaryrefslogtreecommitdiff
path: root/lld/COFF/InputFiles.cpp
diff options
context:
space:
mode:
authorDaniel Thornburgh <mysterymath@gmail.com>2026-01-21 11:32:33 -0800
committerGitHub <noreply@github.com>2026-01-21 11:32:33 -0800
commit567fe2bbca27a934afd4a020f0d56e85edc7bfb2 (patch)
tree9d915cff717a97da156758193b48e71371b0d1c4 /lld/COFF/InputFiles.cpp
parent1d5e0408c9484cbd8b968a71bde12391ab83926c (diff)
downloadllvm-567fe2bbca27a934afd4a020f0d56e85edc7bfb2.tar.gz
llvm-567fe2bbca27a934afd4a020f0d56e85edc7bfb2.tar.bz2
llvm-567fe2bbca27a934afd4a020f0d56e85edc7bfb2.zip
[NFC][LTO] Move isPreservedName out of IRSymtab into LTO's Symbol as isLibcall (#177046)
This resolves the FIXME in IRSymtab and cleans up the semantics of the IRSymtab. The list of preserved symbols really shouldn't be seen as a property of the IR symbol table, since it's an LTO-specific concern, and it's very tenuous to claim that this information is actually present in the bitcode file to be exposed through its symbol table. Instead, this PR moves this logic into LTO's view of the symbol, which allows consumers to determine preserved-ness themselves. This was broken out of #164916; this prevents that PR from introducing a circular dependency, but it still seems like an independently good idea by virtue of the above.
Diffstat (limited to 'lld/COFF/InputFiles.cpp')
-rw-r--r--lld/COFF/InputFiles.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lld/COFF/InputFiles.cpp b/lld/COFF/InputFiles.cpp
index d415955b6093..492b2ad80166 100644
--- a/lld/COFF/InputFiles.cpp
+++ b/lld/COFF/InputFiles.cpp
@@ -25,6 +25,7 @@
#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
#include "llvm/DebugInfo/PDB/Native/PDBFile.h"
#include "llvm/IR/Mangler.h"
+#include "llvm/IR/RuntimeLibcalls.h"
#include "llvm/LTO/LTO.h"
#include "llvm/Object/Binary.h"
#include "llvm/Object/COFF.h"
@@ -1395,6 +1396,8 @@ void BitcodeFile::parse() {
// FIXME: Check nodeduplicate
comdat[i] =
symtab.addComdat(this, saver.save(obj->getComdatTable()[i].first));
+ Triple tt(obj->getTargetTriple());
+ RTLIB::RuntimeLibcallsInfo libcalls(tt);
for (const lto::InputFile::Symbol &objSym : obj->symbols()) {
StringRef symName = saver.save(objSym.getName());
int comdatIndex = objSym.getComdatIndex();
@@ -1444,7 +1447,7 @@ void BitcodeFile::parse() {
symtab.addRegular(this, symName, nullptr, fakeSC, 0, objSym.isWeak());
}
symbols.push_back(sym);
- if (objSym.isUsed())
+ if (objSym.isUsed() || objSym.isLibcall(libcalls))
symtab.ctx.config.gcroot.push_back(sym);
}
directives = saver.save(obj->getCOFFLinkerOpts());