summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-04-03 03:13:33 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-04-03 03:13:33 +0000
commit895ff83234f035160824e8e3c9862b54a5402cf2 (patch)
tree86eeba62f8fe334a5d9e69725ee094242c03044f /llvm/lib
parent17c6aa0f535777113dfcd4bea967bfb39950e48b (diff)
downloadbcm5719-llvm-895ff83234f035160824e8e3c9862b54a5402cf2.tar.gz
bcm5719-llvm-895ff83234f035160824e8e3c9862b54a5402cf2.zip
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
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Object/COFFObjectFile.cpp16
-rw-r--r--llvm/lib/Object/MachOObjectFile.cpp23
2 files changed, 0 insertions, 39 deletions
diff --git a/llvm/lib/Object/COFFObjectFile.cpp b/llvm/lib/Object/COFFObjectFile.cpp
index cb3d478ff39..a75ebbf2a7c 100644
--- a/llvm/lib/Object/COFFObjectFile.cpp
+++ b/llvm/lib/Object/COFFObjectFile.cpp
@@ -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);
diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp
index 24368df0f2a..12132a4b0c6 100644
--- a/llvm/lib/Object/MachOObjectFile.cpp
+++ b/llvm/lib/Object/MachOObjectFile.cpp
@@ -479,29 +479,6 @@ error_code MachOObjectFile::getSymbolAddress(DataRefImpl Symb,
return object_error::success;
}
-error_code
-MachOObjectFile::getSymbolFileOffset(DataRefImpl Symb,
- uint64_t &Res) const {
- nlist_base Entry = getSymbolTableEntryBase(this, Symb);
- getSymbolAddress(Symb, Res);
- if (Entry.n_sect) {
- uint64_t Delta;
- DataRefImpl SecRel;
- SecRel.d.a = Entry.n_sect-1;
- if (is64Bit()) {
- MachO::section_64 Sec = getSection64(SecRel);
- Delta = Sec.offset - Sec.addr;
- } else {
- MachO::section Sec = getSection(SecRel);
- Delta = Sec.offset - Sec.addr;
- }
-
- Res += Delta;
- }
-
- return object_error::success;
-}
-
error_code MachOObjectFile::getSymbolAlignment(DataRefImpl DRI,
uint32_t &Result) const {
uint32_t flags = getSymbolFlags(DRI);
OpenPOWER on IntegriCloud