Revert r227247 and r227228: "Add weak symbol support to RuntimeDyld".
[oota-llvm.git] / lib / ExecutionEngine / RuntimeDyld / RuntimeDyld.cpp
index 81b8eb2238f44d411bfe30c5b15015fe9fbd6b0c..fb53ba96055cdc1d7757a36f792e094aab5b7935 100644 (file)
@@ -168,7 +168,6 @@ RuntimeDyldImpl::loadObjectImpl(const object::ObjectFile &Obj) {
     uint32_t Flags = I->getFlags();
 
     bool IsCommon = Flags & SymbolRef::SF_Common;
-    bool IsWeak = Flags & SymbolRef::SF_Weak;
     if (IsCommon)
       CommonSymbols.push_back(*I);
     else {
@@ -189,11 +188,6 @@ RuntimeDyldImpl::loadObjectImpl(const object::ObjectFile &Obj) {
           continue;
         StringRef SectionData;
         Check(SI->getContents(SectionData));
-        // TODO: It make make sense to delay emitting the section for weak
-        // symbols until they are actually required, but that's not possible
-        // currently, because we only know whether we will need the symbol
-        // in resolveRelocations, which happens after we have already finalized
-        // the Load.
         bool IsCode = SI->isText();
         unsigned SectionID =
             findOrEmitSection(Obj, *SI, IsCode, LocalSections);
@@ -204,11 +198,7 @@ RuntimeDyldImpl::loadObjectImpl(const object::ObjectFile &Obj) {
         SymbolInfo::Visibility Vis =
           (Flags & SymbolRef::SF_Exported) ?
             SymbolInfo::Default : SymbolInfo::Hidden;
-        if (!IsWeak) {
-          GlobalSymbolTable[Name] = SymbolInfo(SectionID, SectOffset, Vis);
-        } else {
-          WeakSymbolTable[Name] = SymbolInfo(SectionID, SectOffset, Vis);
-        }
+        GlobalSymbolTable[Name] = SymbolInfo(SectionID, SectOffset, Vis);
       }
     }
   }
@@ -778,21 +768,6 @@ void RuntimeDyldImpl::resolveExternalSymbols() {
                SymInfo.getOffset();
       }
 
-      // If we didn't find the symbol yet, and it is present in the weak symbol
-      // table, the definition from this object file needs to be used, so emit
-      // it now
-      if (!Addr) {
-        RTDyldSymbolTable::const_iterator Loc = WeakSymbolTable.find(Name);
-        if (Loc != WeakSymbolTable.end()) {
-          SymbolInfo SymInfo = Loc->second;
-          Addr = getSectionLoadAddress(SymInfo.getSectionID()) + SymInfo.getOffset();
-          // Since the weak symbol is now, materialized, add it to the
-          // GlobalSymbolTable. If somebody later asks the ExecutionEngine
-          // for the address of this symbol that's where it'll look
-          GlobalSymbolTable[Name] = SymInfo;
-        }
-      }
-
       // FIXME: Implement error handling that doesn't kill the host program!
       if (!Addr)
         report_fatal_error("Program used external function '" + Name +
@@ -809,7 +784,6 @@ void RuntimeDyldImpl::resolveExternalSymbols() {
 
     ExternalSymbolRelocations.erase(i);
   }
-  WeakSymbolTable.clear();
 }
 
 //===----------------------------------------------------------------------===//