mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-16 14:26:17 +00:00
Implement get getSymbolFileOffset with getSymbolAddress.
This has the following advantages: * Less code. * The old ELF implementation was wrong for non-relocatable objects. * The old ELF implementation (and I think MachO) was wrong for thumb. No current testcase since this is only used from MCJIT and it only uses relocatable objects and I don't think it supports thumb yet. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205508 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -135,22 +135,6 @@ error_code COFFObjectFile::getSymbolName(DataRefImpl Ref,
|
||||
return getSymbolName(Symb, Result);
|
||||
}
|
||||
|
||||
error_code COFFObjectFile::getSymbolFileOffset(DataRefImpl Ref,
|
||||
uint64_t &Result) const {
|
||||
const coff_symbol *Symb = toSymb(Ref);
|
||||
const coff_section *Section = NULL;
|
||||
if (error_code EC = getSection(Symb->SectionNumber, Section))
|
||||
return EC;
|
||||
|
||||
if (Symb->SectionNumber == COFF::IMAGE_SYM_UNDEFINED)
|
||||
Result = UnknownAddressOrSize;
|
||||
else if (Section)
|
||||
Result = Section->PointerToRawData + Symb->Value;
|
||||
else
|
||||
Result = Symb->Value;
|
||||
return object_error::success;
|
||||
}
|
||||
|
||||
error_code COFFObjectFile::getSymbolAddress(DataRefImpl Ref,
|
||||
uint64_t &Result) const {
|
||||
const coff_symbol *Symb = toSymb(Ref);
|
||||
|
Reference in New Issue
Block a user