mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-14 14:24:05 +00:00
dd the option, -link-opt-hints to llvm-objdump used with -macho to print the
Mach-O AArch64 linker optimization hints for ADRP code optimization. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227246 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -248,8 +248,9 @@ MachOObjectFile::MachOObjectFile(MemoryBufferRef Object, bool IsLittleEndian,
|
||||
bool Is64bits, std::error_code &EC)
|
||||
: ObjectFile(getMachOType(IsLittleEndian, Is64bits), Object),
|
||||
SymtabLoadCmd(nullptr), DysymtabLoadCmd(nullptr),
|
||||
DataInCodeLoadCmd(nullptr), DyldInfoLoadCmd(nullptr),
|
||||
UuidLoadCmd(nullptr), HasPageZeroSegment(false) {
|
||||
DataInCodeLoadCmd(nullptr), LinkOptHintsLoadCmd(nullptr),
|
||||
DyldInfoLoadCmd(nullptr), UuidLoadCmd(nullptr),
|
||||
HasPageZeroSegment(false) {
|
||||
uint32_t LoadCommandCount = this->getHeader().ncmds;
|
||||
if (LoadCommandCount == 0)
|
||||
return;
|
||||
@ -280,6 +281,13 @@ MachOObjectFile::MachOObjectFile(MemoryBufferRef Object, bool IsLittleEndian,
|
||||
return;
|
||||
}
|
||||
DataInCodeLoadCmd = Load.Ptr;
|
||||
} else if (Load.C.cmd == MachO::LC_LINKER_OPTIMIZATION_HINT) {
|
||||
// Multiple linker optimization hint tables
|
||||
if (LinkOptHintsLoadCmd) {
|
||||
EC = object_error::parse_failed;
|
||||
return;
|
||||
}
|
||||
LinkOptHintsLoadCmd = Load.Ptr;
|
||||
} else if (Load.C.cmd == MachO::LC_DYLD_INFO ||
|
||||
Load.C.cmd == MachO::LC_DYLD_INFO_ONLY) {
|
||||
// Multiple dyldinfo load commands
|
||||
@ -2497,6 +2505,21 @@ MachOObjectFile::getDataInCodeLoadCommand() const {
|
||||
return Cmd;
|
||||
}
|
||||
|
||||
MachO::linkedit_data_command
|
||||
MachOObjectFile::getLinkOptHintsLoadCommand() const {
|
||||
if (LinkOptHintsLoadCmd)
|
||||
return getStruct<MachO::linkedit_data_command>(this, LinkOptHintsLoadCmd);
|
||||
|
||||
// If there is no LinkOptHintsLoadCmd return a load command with zero'ed
|
||||
// fields.
|
||||
MachO::linkedit_data_command Cmd;
|
||||
Cmd.cmd = MachO::LC_LINKER_OPTIMIZATION_HINT;
|
||||
Cmd.cmdsize = sizeof(MachO::linkedit_data_command);
|
||||
Cmd.dataoff = 0;
|
||||
Cmd.datasize = 0;
|
||||
return Cmd;
|
||||
}
|
||||
|
||||
ArrayRef<uint8_t> MachOObjectFile::getDyldInfoRebaseOpcodes() const {
|
||||
if (!DyldInfoLoadCmd)
|
||||
return ArrayRef<uint8_t>();
|
||||
|
Reference in New Issue
Block a user