[PATCH] D11474: Add an overload of LoadedObjectInfo::getSectionLoadAddress.

Eugene Rozenfeld erozen at microsoft.com
Thu Jul 23 13:17:33 PDT 2015


erozenfeld created this revision.
erozenfeld added a reviewer: lhames.
erozenfeld added a subscriber: llvm-commits.

This overload can be used to support cases when there are  multiple sections with the same name.
In that case searching by section name doesn't work.

http://reviews.llvm.org/D11474

Files:
  include/llvm/ExecutionEngine/RuntimeDyld.h
  lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
  lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h

Index: lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h
===================================================================
--- lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h
+++ lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h
@@ -208,6 +208,7 @@
   // Keep a map of sections from object file to the SectionID which
   // references it.
   typedef std::map<SectionRef, unsigned> ObjSectionToIDMap;
+  ObjSectionToIDMap LocalSections;
 
   // A global symbol table for symbols from all loaded modules.
   RTDyldSymbolTable GlobalSymbolTable;
Index: lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
===================================================================
--- lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
+++ lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
@@ -143,9 +143,6 @@
     MemMgr.reserveAllocationSpace(CodeSize, DataSizeRO, DataSizeRW);
   }
 
-  // Used sections from the object file
-  ObjSectionToIDMap LocalSections;
-
   // Common symbols requiring allocation, with their sizes and alignments
   CommonSymbolList CommonSymbols;
 
@@ -826,6 +823,12 @@
   return 0;
 }
 
+uint64_t RuntimeDyld::LoadedObjectInfo::getSectionLoadAddress(
+  const SectionRef &Section) const {
+  unsigned SectionId = RTDyld.LocalSections[Section];
+  return RTDyld.Sections[SectionId].LoadAddress;
+}
+
 void RuntimeDyld::MemoryManager::anchor() {}
 void RuntimeDyld::SymbolResolver::anchor() {}
 
Index: include/llvm/ExecutionEngine/RuntimeDyld.h
===================================================================
--- include/llvm/ExecutionEngine/RuntimeDyld.h
+++ include/llvm/ExecutionEngine/RuntimeDyld.h
@@ -68,6 +68,8 @@
 
     uint64_t getSectionLoadAddress(StringRef Name) const;
 
+    uint64_t getSectionLoadAddress(const object::SectionRef &Section) const;
+
   protected:
     virtual void anchor();
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11474.30518.patch
Type: text/x-patch
Size: 1828 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150723/397077a7/attachment.bin>


More information about the llvm-commits mailing list