summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-06-24 19:27:53 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-06-24 19:27:53 +0000
commitc1ffd69c3424dc8cdb3a24f18cd3e4901ce918aa (patch)
tree3ffd07f764cc57902fd58f8ce39ec18e3b866feb
parenta46bfa6b83a9f22466227a9db7f055263fe308a2 (diff)
downloadbcm5719-llvm-c1ffd69c3424dc8cdb3a24f18cd3e4901ce918aa.tar.gz
bcm5719-llvm-c1ffd69c3424dc8cdb3a24f18cd3e4901ce918aa.zip
Use Symbol.getValue to simplify RuntimeDyldCOFF::getSymbolOffset. NFC.
llvm-svn: 240572
-rw-r--r--llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldCOFF.cpp19
1 files changed, 2 insertions, 17 deletions
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldCOFF.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldCOFF.cpp
index 5ec062da07f..1dacc1393f2 100644
--- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldCOFF.cpp
+++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldCOFF.cpp
@@ -62,23 +62,8 @@ RuntimeDyldCOFF::loadObject(const object::ObjectFile &O) {
}
uint64_t RuntimeDyldCOFF::getSymbolOffset(const SymbolRef &Sym) {
- uint64_t Address;
- if (Sym.getAddress(Address))
- return UnknownAddress;
-
- if (Address == UnknownAddress)
- return UnknownAddress;
-
- const ObjectFile *Obj = Sym.getObject();
- section_iterator SecI(Obj->section_end());
- if (Sym.getSection(SecI))
- return UnknownAddress;
-
- if (SecI == Obj->section_end())
- return UnknownAddress;
-
- uint64_t SectionAddress = SecI->getAddress();
- return Address - SectionAddress;
+ // The value in a relocatable COFF object is the offset.
+ return Sym.getValue();
}
bool RuntimeDyldCOFF::isCompatibleFile(const object::ObjectFile &Obj) const {
OpenPOWER on IntegriCloud