aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/MachOObjectFile.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-06-24 19:11:10 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-06-24 19:11:10 +0000
commit991af666f1520359175f1ca0e0fb4dbc6161ce73 (patch)
treed47c6312bf13fb9df1231db4d8a57d5f54480976 /llvm/lib/Object/MachOObjectFile.cpp
parent5815b1fd56ad91501c3ea83f897fc0e19676acdc (diff)
downloadllvm-991af666f1520359175f1ca0e0fb4dbc6161ce73.zip
llvm-991af666f1520359175f1ca0e0fb4dbc6161ce73.tar.gz
llvm-991af666f1520359175f1ca0e0fb4dbc6161ce73.tar.bz2
Add a SymbolRef::getValue.
This returns either the symbol offset or address. Since it is not defined which one, it never has to lookup the section and so never fails. I will add users in the next commit. llvm-svn: 240569
Diffstat (limited to 'llvm/lib/Object/MachOObjectFile.cpp')
-rw-r--r--llvm/lib/Object/MachOObjectFile.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp
index d33a64f..cb98f05 100644
--- a/llvm/lib/Object/MachOObjectFile.cpp
+++ b/llvm/lib/Object/MachOObjectFile.cpp
@@ -370,14 +370,17 @@ std::error_code MachOObjectFile::getIndirectName(DataRefImpl Symb,
return std::error_code();
}
-std::error_code MachOObjectFile::getSymbolAddress(DataRefImpl Symb,
- uint64_t &Res) const {
- uint64_t NValue = getNValue(Symb);
- MachO::nlist_base Entry = getSymbolTableEntryBase(this, Symb);
+uint64_t MachOObjectFile::getSymbolValue(DataRefImpl Sym) const {
+ uint64_t NValue = getNValue(Sym);
+ MachO::nlist_base Entry = getSymbolTableEntryBase(this, Sym);
if ((Entry.n_type & MachO::N_TYPE) == MachO::N_UNDF && NValue == 0)
- Res = UnknownAddress;
- else
- Res = NValue;
+ return UnknownAddress;
+ return NValue;
+}
+
+std::error_code MachOObjectFile::getSymbolAddress(DataRefImpl Sym,
+ uint64_t &Res) const {
+ Res = getSymbolValue(Sym);
return std::error_code();
}