mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-04 04:19:25 +00:00
Replace ObjRelocationInfo with relocation_iterator.
For MachO we need information that is not represented in ObjRelocationInfo. Instead of copying the bits we think are needed from a relocation_iterator, just pass the relocation_iterator down to the format specific functions. No functionality change yet as we still drop the information once processRelocationRef returns. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180711 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -154,18 +154,8 @@ ObjectImage *RuntimeDyldImpl::loadObject(ObjectBuffer *InputBuffer) {
|
|||||||
isFirstRelocation = false;
|
isFirstRelocation = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjRelocationInfo RI;
|
processRelocationRef(SectionID, i, *obj, LocalSections, LocalSymbols,
|
||||||
RI.SectionID = SectionID;
|
Stubs);
|
||||||
Check(i->getAdditionalInfo(RI.AdditionalInfo));
|
|
||||||
Check(i->getOffset(RI.Offset));
|
|
||||||
Check(i->getSymbol(RI.Symbol));
|
|
||||||
Check(i->getType(RI.Type));
|
|
||||||
|
|
||||||
DEBUG(dbgs() << "\t\tAddend: " << RI.AdditionalInfo
|
|
||||||
<< " Offset: " << format("%p", (uintptr_t)RI.Offset)
|
|
||||||
<< " Type: " << (uint32_t)(RI.Type & 0xffffffffL)
|
|
||||||
<< "\n");
|
|
||||||
processRelocationRef(RI, *obj, LocalSections, LocalSymbols, Stubs);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -593,15 +593,18 @@ void RuntimeDyldELF::resolveRelocation(const SectionEntry &Section,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RuntimeDyldELF::processRelocationRef(const ObjRelocationInfo &Rel,
|
void RuntimeDyldELF::processRelocationRef(unsigned SectionID,
|
||||||
|
relocation_iterator RelI,
|
||||||
ObjectImage &Obj,
|
ObjectImage &Obj,
|
||||||
ObjSectionToIDMap &ObjSectionToID,
|
ObjSectionToIDMap &ObjSectionToID,
|
||||||
const SymbolTableMap &Symbols,
|
const SymbolTableMap &Symbols,
|
||||||
StubMap &Stubs) {
|
StubMap &Stubs) {
|
||||||
|
uint64_t RelType;
|
||||||
uint32_t RelType = (uint32_t)(Rel.Type & 0xffffffffL);
|
Check(RelI->getType(RelType));
|
||||||
intptr_t Addend = (intptr_t)Rel.AdditionalInfo;
|
int64_t Addend;
|
||||||
const SymbolRef &Symbol = Rel.Symbol;
|
Check(RelI->getAdditionalInfo(Addend));
|
||||||
|
SymbolRef Symbol;
|
||||||
|
Check(RelI->getSymbol(Symbol));
|
||||||
|
|
||||||
// Obtain the symbol name which is referenced in the relocation
|
// Obtain the symbol name which is referenced in the relocation
|
||||||
StringRef TargetName;
|
StringRef TargetName;
|
||||||
@@ -657,8 +660,11 @@ void RuntimeDyldELF::processRelocationRef(const ObjRelocationInfo &Rel,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DEBUG(dbgs() << "\t\tRel.SectionID: " << Rel.SectionID
|
uint64_t Offset;
|
||||||
<< " Rel.Offset: " << Rel.Offset
|
Check(RelI->getOffset(Offset));
|
||||||
|
|
||||||
|
DEBUG(dbgs() << "\t\tSectionID: " << SectionID
|
||||||
|
<< " Offset: " << Offset
|
||||||
<< "\n");
|
<< "\n");
|
||||||
if (Arch == Triple::arm &&
|
if (Arch == Triple::arm &&
|
||||||
(RelType == ELF::R_ARM_PC24 ||
|
(RelType == ELF::R_ARM_PC24 ||
|
||||||
@@ -666,12 +672,12 @@ void RuntimeDyldELF::processRelocationRef(const ObjRelocationInfo &Rel,
|
|||||||
RelType == ELF::R_ARM_JUMP24)) {
|
RelType == ELF::R_ARM_JUMP24)) {
|
||||||
// This is an ARM branch relocation, need to use a stub function.
|
// This is an ARM branch relocation, need to use a stub function.
|
||||||
DEBUG(dbgs() << "\t\tThis is an ARM branch relocation.");
|
DEBUG(dbgs() << "\t\tThis is an ARM branch relocation.");
|
||||||
SectionEntry &Section = Sections[Rel.SectionID];
|
SectionEntry &Section = Sections[SectionID];
|
||||||
|
|
||||||
// Look for an existing stub.
|
// Look for an existing stub.
|
||||||
StubMap::const_iterator i = Stubs.find(Value);
|
StubMap::const_iterator i = Stubs.find(Value);
|
||||||
if (i != Stubs.end()) {
|
if (i != Stubs.end()) {
|
||||||
resolveRelocation(Section, Rel.Offset,
|
resolveRelocation(Section, Offset,
|
||||||
(uint64_t)Section.Address + i->second, RelType, 0);
|
(uint64_t)Section.Address + i->second, RelType, 0);
|
||||||
DEBUG(dbgs() << " Stub function found\n");
|
DEBUG(dbgs() << " Stub function found\n");
|
||||||
} else {
|
} else {
|
||||||
@@ -680,14 +686,14 @@ void RuntimeDyldELF::processRelocationRef(const ObjRelocationInfo &Rel,
|
|||||||
Stubs[Value] = Section.StubOffset;
|
Stubs[Value] = Section.StubOffset;
|
||||||
uint8_t *StubTargetAddr = createStubFunction(Section.Address +
|
uint8_t *StubTargetAddr = createStubFunction(Section.Address +
|
||||||
Section.StubOffset);
|
Section.StubOffset);
|
||||||
RelocationEntry RE(Rel.SectionID, StubTargetAddr - Section.Address,
|
RelocationEntry RE(SectionID, StubTargetAddr - Section.Address,
|
||||||
ELF::R_ARM_ABS32, Value.Addend);
|
ELF::R_ARM_ABS32, Value.Addend);
|
||||||
if (Value.SymbolName)
|
if (Value.SymbolName)
|
||||||
addRelocationForSymbol(RE, Value.SymbolName);
|
addRelocationForSymbol(RE, Value.SymbolName);
|
||||||
else
|
else
|
||||||
addRelocationForSection(RE, Value.SectionID);
|
addRelocationForSection(RE, Value.SectionID);
|
||||||
|
|
||||||
resolveRelocation(Section, Rel.Offset,
|
resolveRelocation(Section, Offset,
|
||||||
(uint64_t)Section.Address + Section.StubOffset,
|
(uint64_t)Section.Address + Section.StubOffset,
|
||||||
RelType, 0);
|
RelType, 0);
|
||||||
Section.StubOffset += getMaxStubSize();
|
Section.StubOffset += getMaxStubSize();
|
||||||
@@ -696,8 +702,8 @@ void RuntimeDyldELF::processRelocationRef(const ObjRelocationInfo &Rel,
|
|||||||
RelType == ELF::R_MIPS_26) {
|
RelType == ELF::R_MIPS_26) {
|
||||||
// This is an Mips branch relocation, need to use a stub function.
|
// This is an Mips branch relocation, need to use a stub function.
|
||||||
DEBUG(dbgs() << "\t\tThis is a Mips branch relocation.");
|
DEBUG(dbgs() << "\t\tThis is a Mips branch relocation.");
|
||||||
SectionEntry &Section = Sections[Rel.SectionID];
|
SectionEntry &Section = Sections[SectionID];
|
||||||
uint8_t *Target = Section.Address + Rel.Offset;
|
uint8_t *Target = Section.Address + Offset;
|
||||||
uint32_t *TargetAddress = (uint32_t *)Target;
|
uint32_t *TargetAddress = (uint32_t *)Target;
|
||||||
|
|
||||||
// Extract the addend from the instruction.
|
// Extract the addend from the instruction.
|
||||||
@@ -708,7 +714,7 @@ void RuntimeDyldELF::processRelocationRef(const ObjRelocationInfo &Rel,
|
|||||||
// Look up for existing stub.
|
// Look up for existing stub.
|
||||||
StubMap::const_iterator i = Stubs.find(Value);
|
StubMap::const_iterator i = Stubs.find(Value);
|
||||||
if (i != Stubs.end()) {
|
if (i != Stubs.end()) {
|
||||||
resolveRelocation(Section, Rel.Offset,
|
resolveRelocation(Section, Offset,
|
||||||
(uint64_t)Section.Address + i->second, RelType, 0);
|
(uint64_t)Section.Address + i->second, RelType, 0);
|
||||||
DEBUG(dbgs() << " Stub function found\n");
|
DEBUG(dbgs() << " Stub function found\n");
|
||||||
} else {
|
} else {
|
||||||
@@ -719,10 +725,10 @@ void RuntimeDyldELF::processRelocationRef(const ObjRelocationInfo &Rel,
|
|||||||
Section.StubOffset);
|
Section.StubOffset);
|
||||||
|
|
||||||
// Creating Hi and Lo relocations for the filled stub instructions.
|
// Creating Hi and Lo relocations for the filled stub instructions.
|
||||||
RelocationEntry REHi(Rel.SectionID,
|
RelocationEntry REHi(SectionID,
|
||||||
StubTargetAddr - Section.Address,
|
StubTargetAddr - Section.Address,
|
||||||
ELF::R_MIPS_HI16, Value.Addend);
|
ELF::R_MIPS_HI16, Value.Addend);
|
||||||
RelocationEntry RELo(Rel.SectionID,
|
RelocationEntry RELo(SectionID,
|
||||||
StubTargetAddr - Section.Address + 4,
|
StubTargetAddr - Section.Address + 4,
|
||||||
ELF::R_MIPS_LO16, Value.Addend);
|
ELF::R_MIPS_LO16, Value.Addend);
|
||||||
|
|
||||||
@@ -734,7 +740,7 @@ void RuntimeDyldELF::processRelocationRef(const ObjRelocationInfo &Rel,
|
|||||||
addRelocationForSection(RELo, Value.SectionID);
|
addRelocationForSection(RELo, Value.SectionID);
|
||||||
}
|
}
|
||||||
|
|
||||||
resolveRelocation(Section, Rel.Offset,
|
resolveRelocation(Section, Offset,
|
||||||
(uint64_t)Section.Address + Section.StubOffset,
|
(uint64_t)Section.Address + Section.StubOffset,
|
||||||
RelType, 0);
|
RelType, 0);
|
||||||
Section.StubOffset += getMaxStubSize();
|
Section.StubOffset += getMaxStubSize();
|
||||||
@@ -744,8 +750,8 @@ void RuntimeDyldELF::processRelocationRef(const ObjRelocationInfo &Rel,
|
|||||||
// A PPC branch relocation will need a stub function if the target is
|
// A PPC branch relocation will need a stub function if the target is
|
||||||
// an external symbol (Symbol::ST_Unknown) or if the target address
|
// an external symbol (Symbol::ST_Unknown) or if the target address
|
||||||
// is not within the signed 24-bits branch address.
|
// is not within the signed 24-bits branch address.
|
||||||
SectionEntry &Section = Sections[Rel.SectionID];
|
SectionEntry &Section = Sections[SectionID];
|
||||||
uint8_t *Target = Section.Address + Rel.Offset;
|
uint8_t *Target = Section.Address + Offset;
|
||||||
bool RangeOverflow = false;
|
bool RangeOverflow = false;
|
||||||
if (SymType != SymbolRef::ST_Unknown) {
|
if (SymType != SymbolRef::ST_Unknown) {
|
||||||
// A function call may points to the .opd entry, so the final symbol value
|
// A function call may points to the .opd entry, so the final symbol value
|
||||||
@@ -755,7 +761,7 @@ void RuntimeDyldELF::processRelocationRef(const ObjRelocationInfo &Rel,
|
|||||||
int32_t delta = static_cast<int32_t>(Target - RelocTarget);
|
int32_t delta = static_cast<int32_t>(Target - RelocTarget);
|
||||||
// If it is within 24-bits branch range, just set the branch target
|
// If it is within 24-bits branch range, just set the branch target
|
||||||
if (SignExtend32<24>(delta) == delta) {
|
if (SignExtend32<24>(delta) == delta) {
|
||||||
RelocationEntry RE(Rel.SectionID, Rel.Offset, RelType, Value.Addend);
|
RelocationEntry RE(SectionID, Offset, RelType, Value.Addend);
|
||||||
if (Value.SymbolName)
|
if (Value.SymbolName)
|
||||||
addRelocationForSymbol(RE, Value.SymbolName);
|
addRelocationForSymbol(RE, Value.SymbolName);
|
||||||
else
|
else
|
||||||
@@ -770,7 +776,7 @@ void RuntimeDyldELF::processRelocationRef(const ObjRelocationInfo &Rel,
|
|||||||
StubMap::const_iterator i = Stubs.find(Value);
|
StubMap::const_iterator i = Stubs.find(Value);
|
||||||
if (i != Stubs.end()) {
|
if (i != Stubs.end()) {
|
||||||
// Symbol function stub already created, just relocate to it
|
// Symbol function stub already created, just relocate to it
|
||||||
resolveRelocation(Section, Rel.Offset,
|
resolveRelocation(Section, Offset,
|
||||||
(uint64_t)Section.Address + i->second, RelType, 0);
|
(uint64_t)Section.Address + i->second, RelType, 0);
|
||||||
DEBUG(dbgs() << " Stub function found\n");
|
DEBUG(dbgs() << " Stub function found\n");
|
||||||
} else {
|
} else {
|
||||||
@@ -779,21 +785,21 @@ void RuntimeDyldELF::processRelocationRef(const ObjRelocationInfo &Rel,
|
|||||||
Stubs[Value] = Section.StubOffset;
|
Stubs[Value] = Section.StubOffset;
|
||||||
uint8_t *StubTargetAddr = createStubFunction(Section.Address +
|
uint8_t *StubTargetAddr = createStubFunction(Section.Address +
|
||||||
Section.StubOffset);
|
Section.StubOffset);
|
||||||
RelocationEntry RE(Rel.SectionID, StubTargetAddr - Section.Address,
|
RelocationEntry RE(SectionID, StubTargetAddr - Section.Address,
|
||||||
ELF::R_PPC64_ADDR64, Value.Addend);
|
ELF::R_PPC64_ADDR64, Value.Addend);
|
||||||
|
|
||||||
// Generates the 64-bits address loads as exemplified in section
|
// Generates the 64-bits address loads as exemplified in section
|
||||||
// 4.5.1 in PPC64 ELF ABI.
|
// 4.5.1 in PPC64 ELF ABI.
|
||||||
RelocationEntry REhst(Rel.SectionID,
|
RelocationEntry REhst(SectionID,
|
||||||
StubTargetAddr - Section.Address + 2,
|
StubTargetAddr - Section.Address + 2,
|
||||||
ELF::R_PPC64_ADDR16_HIGHEST, Value.Addend);
|
ELF::R_PPC64_ADDR16_HIGHEST, Value.Addend);
|
||||||
RelocationEntry REhr(Rel.SectionID,
|
RelocationEntry REhr(SectionID,
|
||||||
StubTargetAddr - Section.Address + 6,
|
StubTargetAddr - Section.Address + 6,
|
||||||
ELF::R_PPC64_ADDR16_HIGHER, Value.Addend);
|
ELF::R_PPC64_ADDR16_HIGHER, Value.Addend);
|
||||||
RelocationEntry REh(Rel.SectionID,
|
RelocationEntry REh(SectionID,
|
||||||
StubTargetAddr - Section.Address + 14,
|
StubTargetAddr - Section.Address + 14,
|
||||||
ELF::R_PPC64_ADDR16_HI, Value.Addend);
|
ELF::R_PPC64_ADDR16_HI, Value.Addend);
|
||||||
RelocationEntry REl(Rel.SectionID,
|
RelocationEntry REl(SectionID,
|
||||||
StubTargetAddr - Section.Address + 18,
|
StubTargetAddr - Section.Address + 18,
|
||||||
ELF::R_PPC64_ADDR16_LO, Value.Addend);
|
ELF::R_PPC64_ADDR16_LO, Value.Addend);
|
||||||
|
|
||||||
@@ -809,7 +815,7 @@ void RuntimeDyldELF::processRelocationRef(const ObjRelocationInfo &Rel,
|
|||||||
addRelocationForSection(REl, Value.SectionID);
|
addRelocationForSection(REl, Value.SectionID);
|
||||||
}
|
}
|
||||||
|
|
||||||
resolveRelocation(Section, Rel.Offset,
|
resolveRelocation(Section, Offset,
|
||||||
(uint64_t)Section.Address + Section.StubOffset,
|
(uint64_t)Section.Address + Section.StubOffset,
|
||||||
RelType, 0);
|
RelType, 0);
|
||||||
if (SymType == SymbolRef::ST_Unknown)
|
if (SymType == SymbolRef::ST_Unknown)
|
||||||
@@ -819,7 +825,7 @@ void RuntimeDyldELF::processRelocationRef(const ObjRelocationInfo &Rel,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
RelocationEntry RE(Rel.SectionID, Rel.Offset, RelType, Value.Addend);
|
RelocationEntry RE(SectionID, Offset, RelType, Value.Addend);
|
||||||
// Extra check to avoid relocation againt empty symbols (usually
|
// Extra check to avoid relocation againt empty symbols (usually
|
||||||
// the R_PPC64_TOC).
|
// the R_PPC64_TOC).
|
||||||
if (Value.SymbolName && !TargetName.empty())
|
if (Value.SymbolName && !TargetName.empty())
|
||||||
@@ -828,7 +834,7 @@ void RuntimeDyldELF::processRelocationRef(const ObjRelocationInfo &Rel,
|
|||||||
addRelocationForSection(RE, Value.SectionID);
|
addRelocationForSection(RE, Value.SectionID);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
RelocationEntry RE(Rel.SectionID, Rel.Offset, RelType, Value.Addend);
|
RelocationEntry RE(SectionID, Offset, RelType, Value.Addend);
|
||||||
if (Value.SymbolName)
|
if (Value.SymbolName)
|
||||||
addRelocationForSymbol(RE, Value.SymbolName);
|
addRelocationForSymbol(RE, Value.SymbolName);
|
||||||
else
|
else
|
||||||
|
@@ -68,7 +68,8 @@ protected:
|
|||||||
uint32_t Type,
|
uint32_t Type,
|
||||||
int64_t Addend);
|
int64_t Addend);
|
||||||
|
|
||||||
virtual void processRelocationRef(const ObjRelocationInfo &Rel,
|
virtual void processRelocationRef(unsigned SectionID,
|
||||||
|
relocation_iterator RelI,
|
||||||
ObjectImage &Obj,
|
ObjectImage &Obj,
|
||||||
ObjSectionToIDMap &ObjSectionToID,
|
ObjSectionToIDMap &ObjSectionToID,
|
||||||
const SymbolTableMap &Symbols,
|
const SymbolTableMap &Symbols,
|
||||||
|
@@ -93,18 +93,6 @@ public:
|
|||||||
: SectionID(id), Offset(offset), RelType(type), Addend(addend) {}
|
: SectionID(id), Offset(offset), RelType(type), Addend(addend) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// ObjRelocationInfo - relocation information as read from the object file.
|
|
||||||
/// Used to pass around data taken from object::RelocationRef, together with
|
|
||||||
/// the section to which the relocation points (represented by a SectionID).
|
|
||||||
class ObjRelocationInfo {
|
|
||||||
public:
|
|
||||||
unsigned SectionID;
|
|
||||||
uint64_t Offset;
|
|
||||||
SymbolRef Symbol;
|
|
||||||
uint64_t Type;
|
|
||||||
int64_t AdditionalInfo;
|
|
||||||
};
|
|
||||||
|
|
||||||
class RelocationValueRef {
|
class RelocationValueRef {
|
||||||
public:
|
public:
|
||||||
unsigned SectionID;
|
unsigned SectionID;
|
||||||
@@ -286,7 +274,8 @@ protected:
|
|||||||
|
|
||||||
/// \brief Parses the object file relocation and stores it to Relocations
|
/// \brief Parses the object file relocation and stores it to Relocations
|
||||||
/// or SymbolRelocations (this depends on the object file type).
|
/// or SymbolRelocations (this depends on the object file type).
|
||||||
virtual void processRelocationRef(const ObjRelocationInfo &Rel,
|
virtual void processRelocationRef(unsigned SectionID,
|
||||||
|
relocation_iterator RelI,
|
||||||
ObjectImage &Obj,
|
ObjectImage &Obj,
|
||||||
ObjSectionToIDMap &ObjSectionToID,
|
ObjSectionToIDMap &ObjSectionToID,
|
||||||
const SymbolTableMap &Symbols,
|
const SymbolTableMap &Symbols,
|
||||||
|
@@ -205,21 +205,26 @@ bool RuntimeDyldMachO::resolveARMRelocation(uint8_t *LocalAddress,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RuntimeDyldMachO::processRelocationRef(const ObjRelocationInfo &Rel,
|
void RuntimeDyldMachO::processRelocationRef(unsigned SectionID,
|
||||||
|
relocation_iterator RelI,
|
||||||
ObjectImage &Obj,
|
ObjectImage &Obj,
|
||||||
ObjSectionToIDMap &ObjSectionToID,
|
ObjSectionToIDMap &ObjSectionToID,
|
||||||
const SymbolTableMap &Symbols,
|
const SymbolTableMap &Symbols,
|
||||||
StubMap &Stubs) {
|
StubMap &Stubs) {
|
||||||
|
const ObjectFile *OF = Obj.getObjectFile();
|
||||||
|
const MachOObjectFile *MachO = static_cast<const MachOObjectFile*>(OF);
|
||||||
|
macho::RelocationEntry RE = MachO->getRelocation(RelI->getRawDataRefImpl());
|
||||||
|
|
||||||
uint32_t RelType = (uint32_t) (Rel.Type & 0xffffffffL);
|
uint32_t RelType = MachO->getAnyRelocationType(RE);
|
||||||
RelocationValueRef Value;
|
RelocationValueRef Value;
|
||||||
SectionEntry &Section = Sections[Rel.SectionID];
|
SectionEntry &Section = Sections[SectionID];
|
||||||
|
|
||||||
bool isExtern = (RelType >> 27) & 1;
|
bool isExtern = MachO->getPlainRelocationExternal(RE);
|
||||||
if (isExtern) {
|
if (isExtern) {
|
||||||
// Obtain the symbol name which is referenced in the relocation
|
// Obtain the symbol name which is referenced in the relocation
|
||||||
|
SymbolRef Symbol;
|
||||||
|
RelI->getSymbol(Symbol);
|
||||||
StringRef TargetName;
|
StringRef TargetName;
|
||||||
const SymbolRef &Symbol = Rel.Symbol;
|
|
||||||
Symbol.getName(TargetName);
|
Symbol.getName(TargetName);
|
||||||
// First search for the symbol in the local symbol table
|
// First search for the symbol in the local symbol table
|
||||||
SymbolTableMap::const_iterator lsi = Symbols.find(TargetName.data());
|
SymbolTableMap::const_iterator lsi = Symbols.find(TargetName.data());
|
||||||
@@ -261,13 +266,15 @@ void RuntimeDyldMachO::processRelocationRef(const ObjRelocationInfo &Rel,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint64_t Offset;
|
||||||
|
RelI->getOffset(Offset);
|
||||||
if (Arch == Triple::arm && (RelType & 0xf) == macho::RIT_ARM_Branch24Bit) {
|
if (Arch == Triple::arm && (RelType & 0xf) == macho::RIT_ARM_Branch24Bit) {
|
||||||
// This is an ARM branch relocation, need to use a stub function.
|
// This is an ARM branch relocation, need to use a stub function.
|
||||||
|
|
||||||
// Look up for existing stub.
|
// Look up for existing stub.
|
||||||
StubMap::const_iterator i = Stubs.find(Value);
|
StubMap::const_iterator i = Stubs.find(Value);
|
||||||
if (i != Stubs.end())
|
if (i != Stubs.end())
|
||||||
resolveRelocation(Section, Rel.Offset,
|
resolveRelocation(Section, Offset,
|
||||||
(uint64_t)Section.Address + i->second,
|
(uint64_t)Section.Address + i->second,
|
||||||
RelType, 0);
|
RelType, 0);
|
||||||
else {
|
else {
|
||||||
@@ -275,19 +282,19 @@ void RuntimeDyldMachO::processRelocationRef(const ObjRelocationInfo &Rel,
|
|||||||
Stubs[Value] = Section.StubOffset;
|
Stubs[Value] = Section.StubOffset;
|
||||||
uint8_t *StubTargetAddr = createStubFunction(Section.Address +
|
uint8_t *StubTargetAddr = createStubFunction(Section.Address +
|
||||||
Section.StubOffset);
|
Section.StubOffset);
|
||||||
RelocationEntry RE(Rel.SectionID, StubTargetAddr - Section.Address,
|
RelocationEntry RE(SectionID, StubTargetAddr - Section.Address,
|
||||||
macho::RIT_Vanilla, Value.Addend);
|
macho::RIT_Vanilla, Value.Addend);
|
||||||
if (Value.SymbolName)
|
if (Value.SymbolName)
|
||||||
addRelocationForSymbol(RE, Value.SymbolName);
|
addRelocationForSymbol(RE, Value.SymbolName);
|
||||||
else
|
else
|
||||||
addRelocationForSection(RE, Value.SectionID);
|
addRelocationForSection(RE, Value.SectionID);
|
||||||
resolveRelocation(Section, Rel.Offset,
|
resolveRelocation(Section, Offset,
|
||||||
(uint64_t)Section.Address + Section.StubOffset,
|
(uint64_t)Section.Address + Section.StubOffset,
|
||||||
RelType, 0);
|
RelType, 0);
|
||||||
Section.StubOffset += getMaxStubSize();
|
Section.StubOffset += getMaxStubSize();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
RelocationEntry RE(Rel.SectionID, Rel.Offset, RelType, Value.Addend);
|
RelocationEntry RE(SectionID, Offset, RelType, Value.Addend);
|
||||||
if (Value.SymbolName)
|
if (Value.SymbolName)
|
||||||
addRelocationForSymbol(RE, Value.SymbolName);
|
addRelocationForSymbol(RE, Value.SymbolName);
|
||||||
else
|
else
|
||||||
|
@@ -48,7 +48,8 @@ protected:
|
|||||||
unsigned Size,
|
unsigned Size,
|
||||||
int64_t Addend);
|
int64_t Addend);
|
||||||
|
|
||||||
virtual void processRelocationRef(const ObjRelocationInfo &Rel,
|
virtual void processRelocationRef(unsigned SectionID,
|
||||||
|
relocation_iterator RelI,
|
||||||
ObjectImage &Obj,
|
ObjectImage &Obj,
|
||||||
ObjSectionToIDMap &ObjSectionToID,
|
ObjSectionToIDMap &ObjSectionToID,
|
||||||
const SymbolTableMap &Symbols,
|
const SymbolTableMap &Symbols,
|
||||||
|
Reference in New Issue
Block a user