mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-25 00:24:26 +00:00
Remove is64BitLoadCommand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179048 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -489,18 +489,8 @@ error_code MachOObjectFile::getSectionNext(DataRefImpl DRI,
|
|||||||
return object_error::success;
|
return object_error::success;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool is64BitLoadCommand(const MachOObjectFile *MachOObj,
|
|
||||||
DataRefImpl DRI) {
|
|
||||||
const MachOFormat::LoadCommand *Command =
|
|
||||||
MachOObj->getLoadCommandInfo(DRI.d.a);
|
|
||||||
if (Command->Type == macho::LCT_Segment64)
|
|
||||||
return true;
|
|
||||||
assert(Command->Type == macho::LCT_Segment && "Unexpected Type.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const MachOFormat::Section *MachOObjectFile::getSection(DataRefImpl DRI) const {
|
const MachOFormat::Section *MachOObjectFile::getSection(DataRefImpl DRI) const {
|
||||||
assert(!is64BitLoadCommand(this, DRI));
|
assert(!is64Bit());
|
||||||
const MachOFormat::LoadCommand *Command = getLoadCommandInfo(DRI.d.a);
|
const MachOFormat::LoadCommand *Command = getLoadCommandInfo(DRI.d.a);
|
||||||
uintptr_t CommandAddr = reinterpret_cast<uintptr_t>(Command);
|
uintptr_t CommandAddr = reinterpret_cast<uintptr_t>(Command);
|
||||||
uintptr_t SectionAddr = CommandAddr + sizeof(macho::SegmentLoadCommand) +
|
uintptr_t SectionAddr = CommandAddr + sizeof(macho::SegmentLoadCommand) +
|
||||||
@ -517,7 +507,7 @@ std::size_t MachOObjectFile::getSectionIndex(DataRefImpl Sec) const {
|
|||||||
|
|
||||||
const MachOFormat::Section64 *
|
const MachOFormat::Section64 *
|
||||||
MachOObjectFile::getSection64(DataRefImpl DRI) const {
|
MachOObjectFile::getSection64(DataRefImpl DRI) const {
|
||||||
assert(is64BitLoadCommand(this, DRI));
|
assert(is64Bit());
|
||||||
const MachOFormat::LoadCommand *Command = getLoadCommandInfo(DRI.d.a);
|
const MachOFormat::LoadCommand *Command = getLoadCommandInfo(DRI.d.a);
|
||||||
uintptr_t CommandAddr = reinterpret_cast<uintptr_t>(Command);
|
uintptr_t CommandAddr = reinterpret_cast<uintptr_t>(Command);
|
||||||
uintptr_t SectionAddr = CommandAddr + sizeof(macho::Segment64LoadCommand) +
|
uintptr_t SectionAddr = CommandAddr + sizeof(macho::Segment64LoadCommand) +
|
||||||
@ -534,7 +524,7 @@ static StringRef parseSegmentOrSectionName(const char *P) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ArrayRef<char> MachOObjectFile::getSectionRawName(DataRefImpl DRI) const {
|
ArrayRef<char> MachOObjectFile::getSectionRawName(DataRefImpl DRI) const {
|
||||||
if (is64BitLoadCommand(this, DRI)) {
|
if (is64Bit()) {
|
||||||
const MachOFormat::Section64 *sec = getSection64(DRI);
|
const MachOFormat::Section64 *sec = getSection64(DRI);
|
||||||
return ArrayRef<char>(sec->Name);
|
return ArrayRef<char>(sec->Name);
|
||||||
} else {
|
} else {
|
||||||
@ -552,7 +542,7 @@ error_code MachOObjectFile::getSectionName(DataRefImpl DRI,
|
|||||||
|
|
||||||
ArrayRef<char>
|
ArrayRef<char>
|
||||||
MachOObjectFile::getSectionRawFinalSegmentName(DataRefImpl Sec) const {
|
MachOObjectFile::getSectionRawFinalSegmentName(DataRefImpl Sec) const {
|
||||||
if (is64BitLoadCommand(this, Sec)) {
|
if (is64Bit()) {
|
||||||
const MachOFormat::Section64 *sec = getSection64(Sec);
|
const MachOFormat::Section64 *sec = getSection64(Sec);
|
||||||
return ArrayRef<char>(sec->SegmentName, 16);
|
return ArrayRef<char>(sec->SegmentName, 16);
|
||||||
} else {
|
} else {
|
||||||
@ -568,7 +558,7 @@ StringRef MachOObjectFile::getSectionFinalSegmentName(DataRefImpl DRI) const {
|
|||||||
|
|
||||||
error_code MachOObjectFile::getSectionAddress(DataRefImpl DRI,
|
error_code MachOObjectFile::getSectionAddress(DataRefImpl DRI,
|
||||||
uint64_t &Result) const {
|
uint64_t &Result) const {
|
||||||
if (is64BitLoadCommand(this, DRI)) {
|
if (is64Bit()) {
|
||||||
const MachOFormat::Section64 *Sect = getSection64(DRI);
|
const MachOFormat::Section64 *Sect = getSection64(DRI);
|
||||||
Result = Sect->Address;
|
Result = Sect->Address;
|
||||||
} else {
|
} else {
|
||||||
@ -580,7 +570,7 @@ error_code MachOObjectFile::getSectionAddress(DataRefImpl DRI,
|
|||||||
|
|
||||||
error_code MachOObjectFile::getSectionSize(DataRefImpl DRI,
|
error_code MachOObjectFile::getSectionSize(DataRefImpl DRI,
|
||||||
uint64_t &Result) const {
|
uint64_t &Result) const {
|
||||||
if (is64BitLoadCommand(this, DRI)) {
|
if (is64Bit()) {
|
||||||
const MachOFormat::Section64 *Sect = getSection64(DRI);
|
const MachOFormat::Section64 *Sect = getSection64(DRI);
|
||||||
Result = Sect->Size;
|
Result = Sect->Size;
|
||||||
} else {
|
} else {
|
||||||
@ -592,7 +582,7 @@ error_code MachOObjectFile::getSectionSize(DataRefImpl DRI,
|
|||||||
|
|
||||||
error_code MachOObjectFile::getSectionContents(DataRefImpl DRI,
|
error_code MachOObjectFile::getSectionContents(DataRefImpl DRI,
|
||||||
StringRef &Result) const {
|
StringRef &Result) const {
|
||||||
if (is64BitLoadCommand(this, DRI)) {
|
if (is64Bit()) {
|
||||||
const MachOFormat::Section64 *Sect = getSection64(DRI);
|
const MachOFormat::Section64 *Sect = getSection64(DRI);
|
||||||
Result = getData(Sect->Offset, Sect->Size);
|
Result = getData(Sect->Offset, Sect->Size);
|
||||||
} else {
|
} else {
|
||||||
@ -604,7 +594,7 @@ error_code MachOObjectFile::getSectionContents(DataRefImpl DRI,
|
|||||||
|
|
||||||
error_code MachOObjectFile::getSectionAlignment(DataRefImpl DRI,
|
error_code MachOObjectFile::getSectionAlignment(DataRefImpl DRI,
|
||||||
uint64_t &Result) const {
|
uint64_t &Result) const {
|
||||||
if (is64BitLoadCommand(this, DRI)) {
|
if (is64Bit()) {
|
||||||
const MachOFormat::Section64 *Sect = getSection64(DRI);
|
const MachOFormat::Section64 *Sect = getSection64(DRI);
|
||||||
Result = uint64_t(1) << Sect->Align;
|
Result = uint64_t(1) << Sect->Align;
|
||||||
} else {
|
} else {
|
||||||
@ -616,7 +606,7 @@ error_code MachOObjectFile::getSectionAlignment(DataRefImpl DRI,
|
|||||||
|
|
||||||
error_code MachOObjectFile::isSectionText(DataRefImpl DRI,
|
error_code MachOObjectFile::isSectionText(DataRefImpl DRI,
|
||||||
bool &Result) const {
|
bool &Result) const {
|
||||||
if (is64BitLoadCommand(this, DRI)) {
|
if (is64Bit()) {
|
||||||
const MachOFormat::Section64 *Sect = getSection64(DRI);
|
const MachOFormat::Section64 *Sect = getSection64(DRI);
|
||||||
Result = Sect->Flags & macho::SF_PureInstructions;
|
Result = Sect->Flags & macho::SF_PureInstructions;
|
||||||
} else {
|
} else {
|
||||||
@ -717,7 +707,7 @@ relocation_iterator MachOObjectFile::getSectionRelBegin(DataRefImpl Sec) const {
|
|||||||
}
|
}
|
||||||
relocation_iterator MachOObjectFile::getSectionRelEnd(DataRefImpl Sec) const {
|
relocation_iterator MachOObjectFile::getSectionRelEnd(DataRefImpl Sec) const {
|
||||||
uint32_t last_reloc;
|
uint32_t last_reloc;
|
||||||
if (is64BitLoadCommand(this, Sec)) {
|
if (is64Bit()) {
|
||||||
const MachOFormat::Section64 *Sect = getSection64(Sec);
|
const MachOFormat::Section64 *Sect = getSection64(Sec);
|
||||||
last_reloc = Sect->NumRelocationTableEntries;
|
last_reloc = Sect->NumRelocationTableEntries;
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user