diff options
author | Chris Lattner <sabre@nondot.org> | 2006-10-05 03:13:28 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-10-05 03:13:28 +0000 |
commit | 66c1625a372fae9102cacb6b8b7091a5b661f314 (patch) | |
tree | dc6bafb0e98a0efc8fd8dfb95f3f9fc6171e7538 /llvm/lib/CodeGen/AsmPrinter.cpp | |
parent | bfe59e87e54ccc954ae2a5b705b15575777b96f6 (diff) | |
download | bcm5719-llvm-66c1625a372fae9102cacb6b8b7091a5b661f314.tar.gz bcm5719-llvm-66c1625a372fae9102cacb6b8b7091a5b661f314.zip |
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
llvm-svn: 30744
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter.cpp index 63d5f921820..5311b2c5cbb 100644 --- a/llvm/lib/CodeGen/AsmPrinter.cpp +++ b/llvm/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) |