Can a test case be added?<span></span><br><br>On Wednesday, February 20, 2013, Andrew Kaylor  wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: akaylor<br>

Date: Wed Feb 20 12:09:21 2013<br>
New Revision: 175643<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=175643&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=175643&view=rev</a><br>
Log:<br>
Adding support for absolute relocations.  This occurs in ELF files when a relocation is given with no name and an undefined section.  The relocation is applied with an address of zero.<br>
<br>
Modified:<br>
    llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp<br>
<br>
Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp?rev=175643&r1=175642&r2=175643&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp?rev=175643&r1=175642&r2=175643&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp (original)<br>
+++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp Wed Feb 20 12:09:21 2013<br>
@@ -432,14 +432,21 @@ void RuntimeDyldImpl::resolveExternalSym<br>
     RelocationList &Relocs = i->second;<br>
     SymbolTableMap::const_iterator Loc = GlobalSymbolTable.find(Name);<br>
     if (Loc == GlobalSymbolTable.end()) {<br>
-      // This is an external symbol, try to get it address from<br>
-      // MemoryManager.<br>
-      uint8_t *Addr = (uint8_t*) MemMgr->getPointerToNamedFunction(Name.data(),<br>
+      if (Name.size() == 0) {<br>
+        // This is an absolute symbol, use an address of zero.<br>
+        DEBUG(dbgs() << "Resolving absolute relocations." << "\n");<br>
+        resolveRelocationList(Relocs, 0);<br>
+      }<br>
+      else {<br>
+        // This is an external symbol, try to get it address from<br>
+        // MemoryManager.<br>
+        uint8_t *Addr = (uint8_t*) MemMgr->getPointerToNamedFunction(Name.data(),<br>
                                                                    true);<br>
-      DEBUG(dbgs() << "Resolving relocations Name: " << Name<br>
-              << "\t" << format("%p", Addr)<br>
-              << "\n");<br>
-      resolveRelocationList(Relocs, (uintptr_t)Addr);<br>
+        DEBUG(dbgs() << "Resolving relocations Name: " << Name<br>
+                << "\t" << format("%p", Addr)<br>
+                << "\n");<br>
+        resolveRelocationList(Relocs, (uintptr_t)Addr);<br>
+      }<br>
     } else {<br>
       report_fatal_error("Expected external symbol");<br>
     }<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="javascript:;" onclick="_e(event, 'cvml', 'llvm-commits@cs.uiuc.edu')">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote>