- Added option -relocation-model to set relocation model. Valid values include static, pic,
dynamic-no-pic, and default.
PPC and x86 default is dynamic-no-pic for Darwin, pic for others.
- Removed options -enable-pic and -ppc-static.
llvm-svn: 26315
diff --git a/llvm/lib/Target/X86/X86ATTAsmPrinter.cpp b/llvm/lib/Target/X86/X86ATTAsmPrinter.cpp
index 9b43873..f1774fd 100755
--- a/llvm/lib/Target/X86/X86ATTAsmPrinter.cpp
+++ b/llvm/lib/Target/X86/X86ATTAsmPrinter.cpp
@@ -119,7 +119,7 @@
bool isMemOp = Modifier && !strcmp(Modifier, "mem");
if (!isMemOp && !isCallOp) O << '$';
// Darwin block shameless ripped from PPCAsmPrinter.cpp
- if (forDarwin) {
+ if (forDarwin && TM.getRelocationModel() != Reloc::Static) {
GlobalValue *GV = MO.getGlobal();
std::string Name = Mang->getValueName(GV);
// Link-once, External, or Weakly-linked global variables need
@@ -133,7 +133,7 @@
} else {
GVStubs.insert(Name);
O << "L" << Name << "$non_lazy_ptr";
- if (PICEnabled)
+ if (TM.getRelocationModel() == Reloc::PIC)
O << "-\"L" << getFunctionNumber() << "$pb\"";
}
} else {
@@ -150,14 +150,14 @@
}
case MachineOperand::MO_ExternalSymbol: {
bool isCallOp = Modifier && !strcmp(Modifier, "call");
- bool isMemOp = Modifier && !strcmp(Modifier, "mem");
- if (isCallOp && forDarwin) {
- std::string Name(GlobalPrefix); Name += MO.getSymbolName();
+ if (isCallOp && forDarwin && TM.getRelocationModel() != Reloc::Static) {
+ std::string Name(GlobalPrefix);
+ Name += MO.getSymbolName();
FnStubs.insert(Name);
O << "L" << Name << "$stub";
return;
}
- if (!isMemOp && !isCallOp) O << '$';
+ if (!isCallOp) O << '$';
O << GlobalPrefix << MO.getSymbolName();
return;
}
@@ -198,7 +198,7 @@
} else if (BaseReg.isConstantPoolIndex()) {
O << PrivateGlobalPrefix << "CPI" << getFunctionNumber() << "_"
<< BaseReg.getConstantPoolIndex();
- if (forDarwin && PICEnabled)
+ if (forDarwin && TM.getRelocationModel() == Reloc::PIC)
O << "-\"L" << getFunctionNumber() << "$pb\"";
if (DispSpec.getImmedValue())
O << "+" << DispSpec.getImmedValue();