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:
Rafael Espindola
2014-04-03 03:13:33 +00:00
parent 3539519223
commit 051c948bbe
6 changed files with 24 additions and 80 deletions

View File

@@ -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);