diff options
Diffstat (limited to 'lld/ELF/LTO.cpp')
| -rw-r--r-- | lld/ELF/LTO.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lld/ELF/LTO.cpp b/lld/ELF/LTO.cpp index bfd85288d18..57f3b90666b 100644 --- a/lld/ELF/LTO.cpp +++ b/lld/ELF/LTO.cpp @@ -134,6 +134,8 @@ void BitcodeCompiler::add(BitcodeFile &F) { if (auto *Cmd = dyn_cast<SymbolAssignment>(Base)) ScriptSymbols.insert(Cmd->Name); + bool IsExecutable = !Config->Shared && !Config->Relocatable; + // Provide a resolution to the LTO API for each symbol. for (const lto::InputFile::Symbol &ObjSym : Obj.symbols()) { Symbol *Sym = Syms[SymNum]; @@ -156,6 +158,10 @@ void BitcodeCompiler::add(BitcodeFile &F) { R.VisibleToRegularObj = Config->Relocatable || Sym->IsUsedInRegularObj || (R.Prevailing && Sym->includeInDynsym()) || UsedStartStop.count(ObjSym.getSectionName()); + R.FinalDefinitionInLinkageUnit = + Sym->isDefined() && + (IsExecutable || Sym->getVisibility() != STV_DEFAULT); + if (R.Prevailing) undefine(Sym); |

