diff options
author | Chris Lattner <sabre@nondot.org> | 2006-10-06 22:50:56 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-10-06 22:50:56 +0000 |
commit | 0336fdba858830d515bf53ac29b8e5ff24dfa823 (patch) | |
tree | 3cea70845d2a28d92ecc339fcf5a71a445de55c5 /lib/CodeGen/AsmPrinter.cpp | |
parent | 111c2fa2a07d5b8518254530da51ca6dd28818d9 (diff) | |
download | llvm-0336fdba858830d515bf53ac29b8e5ff24dfa823.tar.gz llvm-0336fdba858830d515bf53ac29b8e5ff24dfa823.tar.bz2 llvm-0336fdba858830d515bf53ac29b8e5ff24dfa823.tar.xz |
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().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30779 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter.cpp')
-rw-r--r-- | lib/CodeGen/AsmPrinter.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/CodeGen/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter.cpp index 96a481fc84..33b6b979d0 100644 --- a/lib/CodeGen/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter.cpp @@ -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 @@ 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_) { - // 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) |