summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2008-05-14 20:12:51 +0000
committerDale Johannesen <dalej@apple.com>2008-05-14 20:12:51 +0000
commitce4396bc92640e84cb8aa55e424f11341a3f1e3b (patch)
treee49fb307951b1f7cfdf182eee611d01333dc00df /llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
parente94e0f66cdd503e02936f0705ddf74ed9bf44e0c (diff)
downloadbcm5719-llvm-ce4396bc92640e84cb8aa55e424f11341a3f1e3b.tar.gz
bcm5719-llvm-ce4396bc92640e84cb8aa55e424f11341a3f1e3b.zip
Add CommonLinkage; currently tentative definitions
are represented as "weak", but there are subtle differences in some cases on Darwin, so we need both. The intent is that "common" will behave identically to "weak" unless somebody changes their target to do something else. No functional change as yet. llvm-svn: 51118
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp')
-rw-r--r--llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
index 4cc9d2a9bd5..96e1ae8a04a 100644
--- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
@@ -185,7 +185,7 @@ namespace {
if (MO.getType() == MachineOperand::MO_GlobalAddress) {
GlobalValue *GV = MO.getGlobal();
if (((GV->isDeclaration() || GV->hasWeakLinkage() ||
- GV->hasLinkOnceLinkage()))) {
+ GV->hasLinkOnceLinkage() || GV->hasCommonLinkage()))) {
// Dynamically-resolved functions need a stub for the function.
std::string Name = Mang->getValueName(GV);
FnStubs.insert(Name);
@@ -390,7 +390,7 @@ void PPCAsmPrinter::printOp(const MachineOperand &MO) {
// External or weakly linked global variables need non-lazily-resolved stubs
if (TM.getRelocationModel() != Reloc::Static) {
if (((GV->isDeclaration() || GV->hasWeakLinkage() ||
- GV->hasLinkOnceLinkage()))) {
+ GV->hasLinkOnceLinkage() || GV->hasCommonLinkage()))) {
GVStubs.insert(Name);
O << "L" << Name << "$non_lazy_ptr";
return;
@@ -671,8 +671,8 @@ bool LinuxAsmPrinter::doFinalization(Module &M) {
unsigned Align = TD->getPreferredAlignmentLog(I);
if (C->isNullValue() && /* FIXME: Verify correct */
- !I->hasSection() &&
- (I->hasInternalLinkage() || I->hasWeakLinkage() ||
+ !I->hasSection() && (I->hasCommonLinkage() ||
+ I->hasInternalLinkage() || I->hasWeakLinkage() ||
I->hasLinkOnceLinkage() || I->hasExternalLinkage())) {
if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it.
if (I->hasExternalLinkage()) {
@@ -696,6 +696,7 @@ bool LinuxAsmPrinter::doFinalization(Module &M) {
switch (I->getLinkage()) {
case GlobalValue::LinkOnceLinkage:
case GlobalValue::WeakLinkage:
+ case GlobalValue::CommonLinkage:
O << "\t.global " << name << '\n'
<< "\t.type " << name << ", @object\n"
<< "\t.weak " << name << '\n';
@@ -936,8 +937,8 @@ bool DarwinAsmPrinter::doFinalization(Module &M) {
unsigned Align = TD->getPreferredAlignmentLog(I);
if (C->isNullValue() && /* FIXME: Verify correct */
- !I->hasSection() &&
- (I->hasInternalLinkage() || I->hasWeakLinkage() ||
+ !I->hasSection() && (I->hasCommonLinkage() ||
+ I->hasInternalLinkage() || I->hasWeakLinkage() ||
I->hasLinkOnceLinkage() || I->hasExternalLinkage())) {
if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it.
if (I->hasExternalLinkage()) {
@@ -961,6 +962,7 @@ bool DarwinAsmPrinter::doFinalization(Module &M) {
switch (I->getLinkage()) {
case GlobalValue::LinkOnceLinkage:
case GlobalValue::WeakLinkage:
+ case GlobalValue::CommonLinkage:
O << "\t.globl " << name << '\n'
<< "\t.weak_definition " << name << '\n';
SwitchToDataSection("\t.section __DATA,__datacoal_nt,coalesced", I);
OpenPOWER on IntegriCloud