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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168148 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 4118e8ad50954788374ab23b9e4490d1ec548a6f..e6e1bdc8b1981d8fdce4889f0726a5805944c4b7 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 1ebcaf7ba822e536008960e602826cc8cb884024..74bb46dfcdbf5ecf477cf3b5bd0f10c8b54ef991 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;