Use Symbol.getValue to simplify RuntimeDyldCOFF::getSymbolOffset. NFC.
authorRafael Espindola <rafael.espindola@gmail.com>
Wed, 24 Jun 2015 19:27:53 +0000 (19:27 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Wed, 24 Jun 2015 19:27:53 +0000 (19:27 +0000)
llvm-svn: 240572

llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldCOFF.cpp

index 5ec062d..1dacc13 100644 (file)
@@ -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 {