Skip to content

Commit 36fc93a

Browse files
committed
Repair LLD
1 parent 8514fe2 commit 36fc93a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lld/ELF/Driver.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2701,6 +2701,10 @@ static void markBuffersAsDontNeed(Ctx &ctx, bool skipLinkedOutput) {
27012701
template <class ELFT>
27022702
void LinkerDriver::compileBitcodeFiles(bool skipLinkedOutput) {
27032703
llvm::TimeTraceScope timeScope("LTO");
2704+
// Capture the triple before moving the bitcode into the bitcode compiler.
2705+
std::optional<llvm::Triple> tt;
2706+
if (!ctx.bitcodeFiles.empty())
2707+
tt = llvm::Triple(ctx.bitcodeFiles.front()->obj->getTargetTriple());
27042708
// Compile bitcode files and replace bitcode symbols.
27052709
lto.reset(new BitcodeCompiler(ctx));
27062710
for (BitcodeFile *file : ctx.bitcodeFiles)
@@ -2711,9 +2715,7 @@ void LinkerDriver::compileBitcodeFiles(bool skipLinkedOutput) {
27112715
SmallVector<StringRef> bitcodeLibFuncs;
27122716
if (!ctx.bitcodeFiles.empty()) {
27132717
markBuffersAsDontNeed(ctx, skipLinkedOutput);
2714-
2715-
llvm::Triple tt(ctx.bitcodeFiles.front()->obj->getTargetTriple());
2716-
for (StringRef libFunc : lto::LTO::getLibFuncSymbols(tt, saver)) {
2718+
for (StringRef libFunc : lto::LTO::getLibFuncSymbols(*tt, saver)) {
27172719
Symbol *sym = ctx.symtab->find(libFunc);
27182720
if (!sym)
27192721
continue;

0 commit comments

Comments
 (0)