mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-21 18:24:23 +00:00
Revert r180189.
This should bring the ppc bots back. I will try to write a test that would have found the problem on a little endian system too. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180194 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -769,47 +769,31 @@ MachOObjectFile::sectionContainsSymbol(DataRefImpl Sec, DataRefImpl Symb,
|
|||||||
}
|
}
|
||||||
|
|
||||||
relocation_iterator MachOObjectFile::getSectionRelBegin(DataRefImpl Sec) const {
|
relocation_iterator MachOObjectFile::getSectionRelBegin(DataRefImpl Sec) const {
|
||||||
uint32_t Offset;
|
DataRefImpl ret;
|
||||||
if (is64Bit()) {
|
ret.d.b = Sec.d.a;
|
||||||
macho::Section64 Sect = getSection64(Sec);
|
return relocation_iterator(RelocationRef(ret, this));
|
||||||
Offset = Sect.RelocationTableOffset;
|
|
||||||
} else {
|
|
||||||
macho::Section Sect = getSection(Sec);
|
|
||||||
Offset = Sect.RelocationTableOffset;
|
|
||||||
}
|
|
||||||
|
|
||||||
DataRefImpl Ret;
|
|
||||||
Ret.p = reinterpret_cast<uintptr_t>(getPtr(this, Offset));
|
|
||||||
return relocation_iterator(RelocationRef(Ret, this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
relocation_iterator
|
relocation_iterator
|
||||||
MachOObjectFile::getSectionRelEnd(DataRefImpl Sec) const {
|
MachOObjectFile::getSectionRelEnd(DataRefImpl Sec) const {
|
||||||
uint32_t Offset;
|
uint32_t LastReloc;
|
||||||
uint32_t Num;
|
|
||||||
if (is64Bit()) {
|
if (is64Bit()) {
|
||||||
macho::Section64 Sect = getSection64(Sec);
|
macho::Section64 Sect = getSection64(Sec);
|
||||||
Offset = Sect.RelocationTableOffset;
|
LastReloc = Sect.NumRelocationTableEntries;
|
||||||
Num = Sect.NumRelocationTableEntries;
|
|
||||||
} else {
|
} else {
|
||||||
macho::Section Sect = getSection(Sec);
|
macho::Section Sect = getSection(Sec);
|
||||||
Offset = Sect.RelocationTableOffset;
|
LastReloc = Sect.NumRelocationTableEntries;
|
||||||
Num = Sect.NumRelocationTableEntries;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const macho::RelocationEntry *P =
|
|
||||||
reinterpret_cast<const macho::RelocationEntry*>(getPtr(this, Offset));
|
|
||||||
|
|
||||||
DataRefImpl Ret;
|
DataRefImpl Ret;
|
||||||
Ret.p = reinterpret_cast<uintptr_t>(P + Num);
|
Ret.d.a = LastReloc;
|
||||||
|
Ret.d.b = Sec.d.a;
|
||||||
return relocation_iterator(RelocationRef(Ret, this));
|
return relocation_iterator(RelocationRef(Ret, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
error_code MachOObjectFile::getRelocationNext(DataRefImpl Rel,
|
error_code MachOObjectFile::getRelocationNext(DataRefImpl Rel,
|
||||||
RelocationRef &Res) const {
|
RelocationRef &Res) const {
|
||||||
const macho::RelocationEntry *P =
|
++Rel.d.a;
|
||||||
reinterpret_cast<const macho::RelocationEntry *>(Rel.p);
|
|
||||||
Rel.p = reinterpret_cast<uintptr_t>(P + 1);
|
|
||||||
Res = RelocationRef(Rel, this);
|
Res = RelocationRef(Rel, this);
|
||||||
return object_error::success;
|
return object_error::success;
|
||||||
}
|
}
|
||||||
@ -1402,8 +1386,19 @@ MachOObjectFile::getLinkeditDataLoadCommand(const MachOObjectFile::LoadCommandIn
|
|||||||
|
|
||||||
macho::RelocationEntry
|
macho::RelocationEntry
|
||||||
MachOObjectFile::getRelocation(DataRefImpl Rel) const {
|
MachOObjectFile::getRelocation(DataRefImpl Rel) const {
|
||||||
const char *P = reinterpret_cast<const char *>(Rel.p);
|
uint32_t RelOffset;
|
||||||
return getStruct<macho::RelocationEntry>(this, P);
|
DataRefImpl Sec;
|
||||||
|
Sec.d.a = Rel.d.b;
|
||||||
|
if (is64Bit()) {
|
||||||
|
macho::Section64 Sect = getSection64(Sec);
|
||||||
|
RelOffset = Sect.RelocationTableOffset;
|
||||||
|
} else {
|
||||||
|
macho::Section Sect = getSection(Sec);
|
||||||
|
RelOffset = Sect.RelocationTableOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t Offset = RelOffset + Rel.d.a * sizeof(macho::RelocationEntry);
|
||||||
|
return getStruct<macho::RelocationEntry>(this, getPtr(this, Offset));
|
||||||
}
|
}
|
||||||
|
|
||||||
macho::Header MachOObjectFile::getHeader() const {
|
macho::Header MachOObjectFile::getHeader() const {
|
||||||
|
Reference in New Issue
Block a user