[llvm] r240572 - Use Symbol.getValue to simplify RuntimeDyldCOFF::getSymbolOffset. NFC.

Rafael Espindola rafael.espindola at gmail.com
Wed Jun 24 12:27:53 PDT 2015


Author: rafael
Date: Wed Jun 24 14:27:53 2015
New Revision: 240572

URL: http://llvm.org/viewvc/llvm-project?rev=240572&view=rev
Log:
Use Symbol.getValue to simplify RuntimeDyldCOFF::getSymbolOffset. NFC.

Modified:
    llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldCOFF.cpp

Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldCOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldCOFF.cpp?rev=240572&r1=240571&r2=240572&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldCOFF.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldCOFF.cpp Wed Jun 24 14:27:53 2015
@@ -62,23 +62,8 @@ RuntimeDyldCOFF::loadObject(const object
 }
 
 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 {





More information about the llvm-commits mailing list