Add R_ARM_TARGET1 relocation to MCJIT and ensure that the runtime dyld reads
authorAmara Emerson <amara.emerson@arm.com>
Fri, 16 Nov 2012 11:11:59 +0000 (11:11 +0000)
committerAmara Emerson <amara.emerson@arm.com>
Fri, 16 Nov 2012 11:11:59 +0000 (11:11 +0000)
all symbols during object loading, not just global ones.

This fixes JIT execution of code using llvm.global_ctors with internal
linkage constructors.

llvm-svn: 168148

llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp

index 4118e8a..e6e1bdc 100644 (file)
@@ -125,9 +125,7 @@ ObjectImage *RuntimeDyldImpl::loadObject(ObjectBuffer *InputBuffer) {
                      << " flags: " << flags
                      << " SID: " << SectionID
                      << " Offset: " << format("%p", SectOffset));
-        bool isGlobal = flags & SymbolRef::SF_Global;
-        if (isGlobal)
-          GlobalSymbolTable[Name] = SymbolLoc(SectionID, SectOffset);
+        GlobalSymbolTable[Name] = SymbolLoc(SectionID, SectOffset);
       }
     }
     DEBUG(dbgs() << "\tType: " << SymType << " Name: " << Name << "\n");
index 1ebcaf7..74bb46d 100644 (file)
@@ -290,6 +290,7 @@ void RuntimeDyldELF::resolveARMRelocation(const SectionEntry &Section,
 
   // Write a 32bit value to relocation address, taking into account the 
   // implicit addend encoded in the target.
+  case ELF::R_ARM_TARGET1 :
   case ELF::R_ARM_ABS32 :
     *TargetPtr += Value;
     break;