Changes in directory llvm/lib/CodeGen:

AsmPrinter.cpp updated: 1.107 -> 1.108
---
Log message:

If a target uses a GOT, put it in the jt data section, not the text 
section.  This will fix alpha when Andrew implements 
AlphaTargetMachine::getTargetLowering().


---
Diffs of the changes:  (+12 -4)

 AsmPrinter.cpp |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)


Index: llvm/lib/CodeGen/AsmPrinter.cpp
diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.107 
llvm/lib/CodeGen/AsmPrinter.cpp:1.108
--- llvm/lib/CodeGen/AsmPrinter.cpp:1.107       Thu Oct  5 16:40:14 2006
+++ llvm/lib/CodeGen/AsmPrinter.cpp     Fri Oct  6 17:50:56 2006
@@ -22,6 +22,7 @@
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Target/TargetAsmInfo.h"
 #include "llvm/Target/TargetData.h"
+#include "llvm/Target/TargetLowering.h"
 #include "llvm/Target/TargetMachine.h"
 #include <iostream>
 #include <cerrno>
@@ -200,10 +201,17 @@
   // Pick the directive to use to print the jump table entries, and switch to 
   // the appropriate section.
   if (TM.getRelocationModel() == Reloc::PIC_) {
-    // In PIC mode, we need to emit the jump table to the same section as the
-    // function body itself, otherwise the label differences won't make sense.
-    const Function *F = MF.getFunction();
-    SwitchToTextSection(getSectionForFunction(*F).c_str(), F);
+    TargetLowering *LoweringInfo = TM.getTargetLowering();
+    if (LoweringInfo && LoweringInfo->usesGlobalOffsetTable()) {
+      SwitchToDataSection(TAI->getJumpTableDataSection(), 0);
+      if (TD->getPointerSize() == 8)
+        JTEntryDirective = TAI->getData64bitsDirective();
+    } else {      
+      // In PIC mode, we need to emit the jump table to the same section as the
+      // function body itself, otherwise the label differences won't make 
sense.
+      const Function *F = MF.getFunction();
+      SwitchToTextSection(getSectionForFunction(*F).c_str(), F);
+    }
   } else {
     SwitchToDataSection(TAI->getJumpTableDataSection(), 0);
     if (TD->getPointerSize() == 8)



_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to