Correctly compute the relocation when it is not in the first fragment.

llvm-svn: 115506
This commit is contained in:
Rafael Espindola 2010-10-04 15:28:43 +00:00
parent 3ae028c3b9
commit 7c48b06930
2 changed files with 3 additions and 2 deletions

View File

@ -539,7 +539,7 @@ void ELFObjectWriterImpl::RecordRelocation(const MCAssembler &Asm,
const MCSymbol &SymbolB = RefB->getSymbol();
MCSymbolData &SDB = Asm.getSymbolData(SymbolB);
IsPCRel = true;
Value += Fixup.getOffset() - Layout.getSymbolAddress(&SDB);
Value += Layout.getFragmentOffset(Fragment) + Fixup.getOffset() - Layout.getSymbolAddress(&SDB);
}
// Check that this case has already been fully resolved before we get

View File

@ -19,7 +19,8 @@
// CHECK-NEXT: ),
// CHECK-NEXT: ])
.zero 4
.zero 1
.align 4
foo:
.zero 8
.long baz - foo