[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
Evan Cheng
evan.cheng at apple.com
Fri Dec 1 01:13:41 PST 2006
Changes in directory llvm/lib/Target/PowerPC:
PPCAsmPrinter.cpp updated: 1.212 -> 1.213
---
Log message:
A initialized global variable cannot be extern weak. However, if a global value's initializer is itself a external weak symbol, emit the weak reference.
---
Diffs of the changes: (+10 -0)
PPCAsmPrinter.cpp | 10 ++++++++++
1 files changed, 10 insertions(+)
Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
diff -u llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.212 llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.213
--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.212 Fri Dec 1 01:56:37 2006
+++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Fri Dec 1 03:13:26 2006
@@ -605,6 +605,9 @@
} else {
switch (I->getLinkage()) {
case GlobalValue::LinkOnceLinkage:
+ case GlobalValue::ExternalWeakLinkage:
+ O << "\t.weak_reference " << name << "\n";
+ break;
case GlobalValue::WeakLinkage:
O << "\t.globl " << name << '\n'
<< "\t.weak_definition " << name << '\n';
@@ -635,6 +638,13 @@
EmitAlignment(Align, I);
O << name << ":\t\t\t\t; '" << I->getName() << "'\n";
+
+ // If the initializer is a extern weak symbol, remember to emit the weak
+ // reference!
+ if (const GlobalValue *GV = dyn_cast<GlobalValue>(C))
+ if (GV->hasExternalWeakLinkage())
+ ExtWeakSymbols.insert(Mang->getValueName(GV));
+
EmitGlobalConstant(C);
O << '\n';
}
More information about the llvm-commits
mailing list