[llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp

Chris Lattner sabre at nondot.org
Wed Oct 4 20:13:43 PDT 2006



Changes in directory llvm/lib/CodeGen:

AsmPrinter.cpp updated: 1.105 -> 1.106
---
Log message:

Emit pic jumptables to the same section that the function is emitted to,
allowing label differences to work.  This fixes CodeGen/X86/pic_jumptable.ll


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

 AsmPrinter.cpp |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletion(-)


Index: llvm/lib/CodeGen/AsmPrinter.cpp
diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.105 llvm/lib/CodeGen/AsmPrinter.cpp:1.106
--- llvm/lib/CodeGen/AsmPrinter.cpp:1.105	Wed Oct  4 22:00:37 2006
+++ llvm/lib/CodeGen/AsmPrinter.cpp	Wed Oct  4 22:13:28 2006
@@ -200,7 +200,10 @@
   // Pick the directive to use to print the jump table entries, and switch to 
   // the appropriate section.
   if (TM.getRelocationModel() == Reloc::PIC_) {
-    SwitchToTextSection(TAI->getJumpTableTextSection(), 0);
+    // 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)






More information about the llvm-commits mailing list