Darwin PPC external weak linkage support.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32068 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng 2006-12-01 07:56:37 +00:00
parent 6d7d310519
commit 1c45a66873

View File

@ -52,6 +52,9 @@ namespace {
std::set<std::string> FnStubs, GVStubs;
const PPCSubtarget &Subtarget;
// Necessary for external weak linkage support
std::set<std::string> ExtWeakSymbols;
PPCAsmPrinter(std::ostream &O, TargetMachine &TM, const TargetAsmInfo *T)
: AsmPrinter(O, TM, T), Subtarget(TM.getSubtarget<PPCSubtarget>()) {
}
@ -159,6 +162,8 @@ namespace {
std::string Name = Mang->getValueName(GV);
FnStubs.insert(Name);
O << "L" << Name << "$stub";
if (GV->hasExternalWeakLinkage())
ExtWeakSymbols.insert(Name);
return;
}
}
@ -330,8 +335,10 @@ void PPCAsmPrinter::printOp(const MachineOperand &MO) {
return;
}
}
O << Name;
if (GV->hasExternalWeakLinkage())
ExtWeakSymbols.insert(Name);
return;
}
@ -633,6 +640,13 @@ bool DarwinAsmPrinter::doFinalization(Module &M) {
}
}
if (ExtWeakSymbols.begin() != ExtWeakSymbols.end())
SwitchToDataSection("");
for (std::set<std::string>::iterator i = ExtWeakSymbols.begin(),
e = ExtWeakSymbols.end(); i != e; ++i) {
O << "\t.weak_reference " << *i << "\n";
}
bool isPPC64 = TD->getPointerSizeInBits() == 64;
// Output stubs for dynamically-linked functions