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. llvm-svn: 205508
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