This functionality was accidentally left out of r247119.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247336
91177308-0d34-0410-b5e6-
96231b3b80d8
unsigned Size = Obj.getAnyRelocationLength(RE);
uint64_t Offset = RelI->getOffset();
unsigned Size = Obj.getAnyRelocationLength(RE);
uint64_t Offset = RelI->getOffset();
+ uint8_t *LocalAddress = Sections[SectionID].Address + Offset;
+ unsigned NumBytes = 1 << Size;
+
ErrorOr<StringRef> SubtrahendNameOrErr = RelI->getSymbol()->getName();
if (auto EC = SubtrahendNameOrErr.getError())
report_fatal_error(EC.message());
auto SubtrahendI = GlobalSymbolTable.find(*SubtrahendNameOrErr);
unsigned SectionBID = SubtrahendI->second.getSectionID();
uint64_t SectionBOffset = SubtrahendI->second.getOffset();
ErrorOr<StringRef> SubtrahendNameOrErr = RelI->getSymbol()->getName();
if (auto EC = SubtrahendNameOrErr.getError())
report_fatal_error(EC.message());
auto SubtrahendI = GlobalSymbolTable.find(*SubtrahendNameOrErr);
unsigned SectionBID = SubtrahendI->second.getSectionID();
uint64_t SectionBOffset = SubtrahendI->second.getOffset();
+ int64_t Addend =
+ SignExtend64(readBytesUnaligned(LocalAddress, NumBytes), NumBytes * 8);
++RelI;
ErrorOr<StringRef> MinuendNameOrErr = RelI->getSymbol()->getName();
++RelI;
ErrorOr<StringRef> MinuendNameOrErr = RelI->getSymbol()->getName();
unsigned SectionAID = MinuendI->second.getSectionID();
uint64_t SectionAOffset = MinuendI->second.getOffset();
unsigned SectionAID = MinuendI->second.getSectionID();
uint64_t SectionAOffset = MinuendI->second.getOffset();
- uint64_t Addend = SectionAOffset - SectionBOffset;
- RelocationEntry R(SectionID, Offset, MachO::X86_64_RELOC_SUBTRACTOR, Addend,
+ RelocationEntry R(SectionID, Offset, MachO::X86_64_RELOC_SUBTRACTOR, (uint64_t)Addend,
SectionAID, SectionAOffset, SectionBID, SectionBOffset,
false, Size);
SectionAID, SectionAOffset, SectionBID, SectionBOffset,
false, Size);
.quad ds2
# Test subtractor relocations.
.quad ds2
# Test subtractor relocations.
-# rtdyld-check: *{8}z3 = z4 - z5
+# rtdyld-check: *{8}z3 = z4 - z5 + 4
.section __DATA,_tmp1
z4:
.section __DATA,_tmp1
z4: