aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/AsmPrinter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-10-05 03:13:28 +0000
committerChris Lattner <sabre@nondot.org>2006-10-05 03:13:28 +0000
commite08d6e915eba62bacc4441b3d4b24bbed67cd6a0 (patch)
tree3192ea59e343235b4a1d5b932c385239eb2cddb3 /lib/CodeGen/AsmPrinter.cpp
parent460b8bd15457469ecd62b581a275d2101648d0fb (diff)
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30744 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter.cpp')
-rw-r--r--lib/CodeGen/AsmPrinter.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/CodeGen/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter.cpp
index 63d5f92182..5311b2c5cb 100644
--- a/lib/CodeGen/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter.cpp
@@ -200,7 +200,10 @@ void AsmPrinter::EmitJumpTableInfo(MachineJumpTableInfo *MJTI,
// 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)