mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-31 15:53:42 +00:00
Include the section address in the computation of the relocation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115509 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
01263d35d4
commit
55fb102130
@ -539,7 +539,14 @@ void ELFObjectWriterImpl::RecordRelocation(const MCAssembler &Asm,
|
||||
const MCSymbol &SymbolB = RefB->getSymbol();
|
||||
MCSymbolData &SDB = Asm.getSymbolData(SymbolB);
|
||||
IsPCRel = true;
|
||||
Value += Layout.getFragmentOffset(Fragment) + Fixup.getOffset() - Layout.getSymbolAddress(&SDB);
|
||||
MCSectionData *Sec = Fragment->getParent();
|
||||
|
||||
// Offset of the symbol in the section
|
||||
int64_t a = Layout.getSymbolAddress(&SDB) - Layout.getSectionAddress(Sec);
|
||||
|
||||
// Ofeset of the relocation in the section
|
||||
int64_t b = Layout.getFragmentOffset(Fragment) + Fixup.getOffset();
|
||||
Value += b - a;
|
||||
}
|
||||
|
||||
// Check that this case has already been fully resolved before we get
|
||||
|
@ -19,6 +19,9 @@
|
||||
// CHECK-NEXT: ),
|
||||
// CHECK-NEXT: ])
|
||||
|
||||
.zero 4
|
||||
.data
|
||||
|
||||
.zero 1
|
||||
.align 4
|
||||
foo:
|
||||
|
Loading…
x
Reference in New Issue
Block a user