Don't forget to emit stubs for function GV's emitted in CONSTPOOL_ENTRY's.
authorEvan Cheng <evan.cheng@apple.com>
Thu, 13 Nov 2008 19:22:28 +0000 (19:22 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Thu, 13 Nov 2008 19:22:28 +0000 (19:22 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59258 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMCodeEmitter.cpp

index 26b2b8249ac8d487ab054167c021d4624670c989..4bbf3018c2065fc6cca31efaf684501f85a4cdd1 100644 (file)
@@ -388,7 +388,7 @@ void ARMCodeEmitter::emitConstPoolInstruction(const MachineInstr &MI) {
                   (intptr_t)ACPV, false));
       else 
         emitGlobalAddress(GV, ARM::reloc_arm_machine_cp_entry,
-                          ACPV->isStub(), (intptr_t)ACPV);
+                          ACPV->isStub() || isa<Function>(GV), (intptr_t)ACPV);
      } else  {
       assert(!ACPV->isNonLazyPointer() && "Don't know how to deal this yet!");
       emitExternalSymbolAddress(ACPV->getSymbol(), ARM::reloc_arm_absolute);
@@ -397,11 +397,18 @@ void ARMCodeEmitter::emitConstPoolInstruction(const MachineInstr &MI) {
   } else {
     Constant *CV = MCPE.Val.ConstVal;
 
+#ifndef NDEBUG
     DOUT << "  ** Constant pool #" << CPI << " @ "
-         << (void*)MCE.getCurrentPCValue() << " " << *CV << '\n';
+         << (void*)MCE.getCurrentPCValue() << " ";
+    if (const Function *F = dyn_cast<Function>(CV))
+      DOUT << F->getName();
+    else
+      DOUT << *CV;
+    DOUT << '\n';
+#endif
 
     if (GlobalValue *GV = dyn_cast<GlobalValue>(CV)) {
-      emitGlobalAddress(GV, ARM::reloc_arm_absolute, false);
+      emitGlobalAddress(GV, ARM::reloc_arm_absolute, isa<Function>(GV));
       emitWordLE(0);
     } else if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) {
       uint32_t Val = *(uint32_t*)CI->getValue().getRawData();