mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
The VMAs stored in the symbol table of a MachO file are absolute addresses, not offsets from the section.
llvm-svn: 141828
This commit is contained in:
parent
400fe75ba1
commit
a3ffb86b9a
@ -126,36 +126,36 @@ error_code MachOObjectFile::getSymbolName(DataRefImpl DRI,
|
||||
|
||||
error_code MachOObjectFile::getSymbolOffset(DataRefImpl DRI,
|
||||
uint64_t &Result) const {
|
||||
uint64_t SectionOffset;
|
||||
uint8_t SectionIndex;
|
||||
if (MachOObj->is64Bit()) {
|
||||
InMemoryStruct<macho::Symbol64TableEntry> Entry;
|
||||
getSymbol64TableEntry(DRI, Entry);
|
||||
Result = Entry->Value;
|
||||
SectionIndex = Entry->SectionIndex;
|
||||
} else {
|
||||
InMemoryStruct<macho::SymbolTableEntry> Entry;
|
||||
getSymbolTableEntry(DRI, Entry);
|
||||
Result = Entry->Value;
|
||||
SectionIndex = Entry->SectionIndex;
|
||||
}
|
||||
getSectionAddress(Sections[SectionIndex-1], SectionOffset);
|
||||
Result -= SectionOffset;
|
||||
|
||||
return object_error::success;
|
||||
}
|
||||
|
||||
error_code MachOObjectFile::getSymbolAddress(DataRefImpl DRI,
|
||||
uint64_t &Result) const {
|
||||
uint64_t SymbolOffset;
|
||||
uint8_t SectionIndex;
|
||||
if (MachOObj->is64Bit()) {
|
||||
InMemoryStruct<macho::Symbol64TableEntry> Entry;
|
||||
getSymbol64TableEntry(DRI, Entry);
|
||||
SymbolOffset = Entry->Value;
|
||||
SectionIndex = Entry->SectionIndex;
|
||||
Result = Entry->Value;
|
||||
} else {
|
||||
InMemoryStruct<macho::SymbolTableEntry> Entry;
|
||||
getSymbolTableEntry(DRI, Entry);
|
||||
SymbolOffset = Entry->Value;
|
||||
SectionIndex = Entry->SectionIndex;
|
||||
Result = Entry->Value;
|
||||
}
|
||||
getSectionAddress(Sections[SectionIndex-1], Result);
|
||||
Result += SymbolOffset;
|
||||
|
||||
return object_error::success;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user