Skip to content
Snippets Groups Projects
Commit cdde9990 authored by Chris Lattner's avatar Chris Lattner
Browse files

only use dyld stubs if not in ppc-static mode. This completes support for

non-static codegen.

llvm-svn: 24403
parent bca0be81
No related branches found
No related tags found
No related merge requests found
...@@ -154,20 +154,24 @@ namespace { ...@@ -154,20 +154,24 @@ namespace {
void printCallOperand(const MachineInstr *MI, unsigned OpNo, void printCallOperand(const MachineInstr *MI, unsigned OpNo,
MVT::ValueType VT) { MVT::ValueType VT) {
const MachineOperand &MO = MI->getOperand(OpNo); const MachineOperand &MO = MI->getOperand(OpNo);
if (MO.getType() == MachineOperand::MO_ExternalSymbol) { if (!PPCGenerateStaticCode) {
std::string Name(GlobalPrefix); Name += MO.getSymbolName(); if (MO.getType() == MachineOperand::MO_ExternalSymbol) {
FnStubs.insert(Name); std::string Name(GlobalPrefix); Name += MO.getSymbolName();
O << "L" << Name << "$stub"; FnStubs.insert(Name);
} else if (MO.getType() == MachineOperand::MO_GlobalAddress && O << "L" << Name << "$stub";
isa<Function>(MO.getGlobal()) && return;
cast<Function>(MO.getGlobal())->isExternal()) { } else if (MO.getType() == MachineOperand::MO_GlobalAddress &&
// Dynamically-resolved functions need a stub for the function. isa<Function>(MO.getGlobal()) &&
std::string Name = Mang->getValueName(MO.getGlobal()); cast<Function>(MO.getGlobal())->isExternal()) {
FnStubs.insert(Name); // Dynamically-resolved functions need a stub for the function.
O << "L" << Name << "$stub"; std::string Name = Mang->getValueName(MO.getGlobal());
} else { FnStubs.insert(Name);
printOp(MI->getOperand(OpNo)); O << "L" << Name << "$stub";
return;
}
} }
printOp(MI->getOperand(OpNo));
} }
void printAbsAddrOperand(const MachineInstr *MI, unsigned OpNo, void printAbsAddrOperand(const MachineInstr *MI, unsigned OpNo,
MVT::ValueType VT) { MVT::ValueType VT) {
...@@ -334,7 +338,9 @@ void PPCAsmPrinter::printOp(const MachineOperand &MO) { ...@@ -334,7 +338,9 @@ void PPCAsmPrinter::printOp(const MachineOperand &MO) {
std::string Name = Mang->getValueName(GV); std::string Name = Mang->getValueName(GV);
// External or weakly linked global variables need non-lazily-resolved stubs // External or weakly linked global variables need non-lazily-resolved stubs
if ((GV->isExternal() || GV->hasWeakLinkage() || GV->hasLinkOnceLinkage())){ if (!PPCGenerateStaticCode &&
((GV->isExternal() || GV->hasWeakLinkage() ||
GV->hasLinkOnceLinkage()))) {
if (GV->hasLinkOnceLinkage()) if (GV->hasLinkOnceLinkage())
LinkOnceStubs.insert(Name); LinkOnceStubs.insert(Name);
else else
...@@ -343,7 +349,7 @@ void PPCAsmPrinter::printOp(const MachineOperand &MO) { ...@@ -343,7 +349,7 @@ void PPCAsmPrinter::printOp(const MachineOperand &MO) {
return; return;
} }
O << Mang->getValueName(GV); O << Name;
return; return;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment