mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-04 21:30:49 +00:00
MC-COFF: Handle relaxation in COFF better. Fixes PR8321.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116013 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
fc7744b12d
commit
b225adee29
@ -639,6 +639,11 @@ void WinCOFFObjectWriter::RecordRelocation(const MCAssembler &Asm,
|
||||
COFFSymbol *coff_symbol = SymbolMap[&A_SD];
|
||||
|
||||
if (Target.getSymB()) {
|
||||
if (&Target.getSymA()->getSymbol().getSection()
|
||||
!= &Target.getSymB()->getSymbol().getSection()) {
|
||||
llvm_unreachable("Symbol relative relocations are only allowed between "
|
||||
"symbols in the same section");
|
||||
}
|
||||
const MCSymbol *B = &Target.getSymB()->getSymbol();
|
||||
MCSymbolData &B_SD = Asm.getSymbolData(*B);
|
||||
|
||||
@ -701,7 +706,30 @@ bool WinCOFFObjectWriter::IsFixupFullyResolved(const MCAssembler &Asm,
|
||||
const MCValue Target,
|
||||
bool IsPCRel,
|
||||
const MCFragment *DF) const {
|
||||
return false;
|
||||
// If this is a PCrel relocation, find the section this fixup value is
|
||||
// relative to.
|
||||
const MCSection *BaseSection = 0;
|
||||
if (IsPCRel) {
|
||||
BaseSection = &DF->getParent()->getSection();
|
||||
assert(BaseSection);
|
||||
}
|
||||
|
||||
const MCSection *SectionA = 0;
|
||||
const MCSymbol *SymbolA = 0;
|
||||
if (const MCSymbolRefExpr *A = Target.getSymA()) {
|
||||
SymbolA = &A->getSymbol();
|
||||
SectionA = &SymbolA->getSection();
|
||||
}
|
||||
|
||||
const MCSection *SectionB = 0;
|
||||
if (const MCSymbolRefExpr *B = Target.getSymB()) {
|
||||
SectionB = &B->getSymbol().getSection();
|
||||
}
|
||||
|
||||
if (!BaseSection)
|
||||
return SectionA == SectionB;
|
||||
|
||||
return !SectionB && BaseSection == SectionA;
|
||||
}
|
||||
|
||||
void WinCOFFObjectWriter::WriteObject(MCAssembler &Asm,
|
||||
|
Loading…
Reference in New Issue
Block a user