mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-30 02:25:19 +00:00
Use a relocation against the symbol if it is a PLT and the symbol is in another
section. Common because of linkonce sections. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115718 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -529,7 +529,8 @@ void ELFObjectWriterImpl::WriteSymbolTable(MCDataFragment *F,
|
||||
}
|
||||
|
||||
static bool ShouldRelocOnSymbol(const MCSymbolData &SD,
|
||||
const MCValue &Target) {
|
||||
const MCValue &Target,
|
||||
const MCFragment &F) {
|
||||
const MCSymbol &Symbol = SD.getSymbol();
|
||||
if (Symbol.isUndefined())
|
||||
return true;
|
||||
@@ -543,6 +544,14 @@ static bool ShouldRelocOnSymbol(const MCSymbolData &SD,
|
||||
if (SD.isExternal())
|
||||
return true;
|
||||
|
||||
const llvm::MCSymbolRefExpr& Ref = *Target.getSymA();
|
||||
const MCSectionELF &Sec2 =
|
||||
static_cast<const MCSectionELF&>(F.getParent()->getSection());
|
||||
|
||||
if (Ref.getKind() == MCSymbolRefExpr::VK_PLT &&
|
||||
&Sec2 != &Section)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -587,7 +596,7 @@ void ELFObjectWriterImpl::RecordRelocation(const MCAssembler &Asm,
|
||||
return;
|
||||
}
|
||||
|
||||
bool RelocOnSymbol = ShouldRelocOnSymbol(SD, Target);
|
||||
bool RelocOnSymbol = ShouldRelocOnSymbol(SD, Target, *Fragment);
|
||||
if (!RelocOnSymbol) {
|
||||
Index = F->getParent()->getOrdinal();
|
||||
|
||||
|
Reference in New Issue
Block a user