Support jump tables when in PIC relocation model
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29318 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/PowerPC/PPCAsmPrinter.cpp b/lib/Target/PowerPC/PPCAsmPrinter.cpp
index 6e75f3c..bf9c608 100644
--- a/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ b/lib/Target/PowerPC/PPCAsmPrinter.cpp
@@ -282,8 +282,8 @@
Data64bitsDirective = 0; // we can't emit a 64-bit unit
AlignmentIsInBytes = false; // Alignment is by power of 2.
ConstantPoolSection = "\t.const\t";
- // FIXME: Conditionalize jump table section based on PIC
- JumpTableSection = ".const";
+ JumpTableDataSection = ".const";
+ JumpTableTextSection = "\t.text";
LCOMMDirective = "\t.lcomm\t";
StaticCtorsSection = ".mod_init_func";
StaticDtorsSection = ".mod_term_func";
diff --git a/lib/Target/X86/X86ATTAsmPrinter.cpp b/lib/Target/X86/X86ATTAsmPrinter.cpp
index 769aa73..712f34a 100755
--- a/lib/Target/X86/X86ATTAsmPrinter.cpp
+++ b/lib/Target/X86/X86ATTAsmPrinter.cpp
@@ -143,7 +143,9 @@
if (!isMemOp) O << '$';
O << PrivateGlobalPrefix << "JTI" << getFunctionNumber() << "_"
<< MO.getJumpTableIndex();
- // FIXME: PIC relocation model
+ if (Subtarget->TargetType == X86Subtarget::isDarwin &&
+ TM.getRelocationModel() == Reloc::PIC_)
+ O << "-\"L" << getFunctionNumber() << "$pb\"";
return;
}
case MachineOperand::MO_ConstantPoolIndex: {
diff --git a/lib/Target/X86/X86AsmPrinter.cpp b/lib/Target/X86/X86AsmPrinter.cpp
index 069b047..2c4b110 100644
--- a/lib/Target/X86/X86AsmPrinter.cpp
+++ b/lib/Target/X86/X86AsmPrinter.cpp
@@ -62,7 +62,7 @@
ZeroDirective = "\t.space\t"; // ".space N" emits N zeros.
PrivateGlobalPrefix = "L"; // Marker for constant pool idxs
ConstantPoolSection = "\t.const\n";
- JumpTableSection = "\t.const\n"; // FIXME: depends on PIC mode
+ JumpTableDataSection = "\t.const\n"; // FIXME: depends on PIC mode
FourByteConstantSection = "\t.literal4\n";
EightByteConstantSection = "\t.literal8\n";
LCOMMDirective = "\t.lcomm\t";