summaryrefslogtreecommitdiff
path: root/lib/Object/MachOObjectFile.cpp
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
commit051c948bbe3f64a7c450120963b28a5959382cb8 (patch)
tree255817868a1b2f2ab59f0901b2f0c859e690f02a /lib/Object/MachOObjectFile.cpp
parent35395192231722cdf66b6914f27f465cc0358c68 (diff)
downloadllvm-051c948bbe3f64a7c450120963b28a5959382cb8.tar.gz
llvm-051c948bbe3f64a7c450120963b28a5959382cb8.tar.bz2
llvm-051c948bbe3f64a7c450120963b28a5959382cb8.tar.xz
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
Diffstat (limited to 'lib/Object/MachOObjectFile.cpp')
-rw-r--r--lib/Object/MachOObjectFile.cpp23
1 files changed, 0 insertions, 23 deletions
diff --git a/lib/Object/MachOObjectFile.cpp b/lib/Object/MachOObjectFile.cpp
index 24368df0f2..12132a4b0c 100644
--- a/lib/Object/MachOObjectFile.cpp
+++ b/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);