aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2007-11-04 17:32:10 +0000
committerNick Lewycky <nicholas@mxc.ca>2007-11-04 17:32:10 +0000
commitf4c164c2b5bbaa2be4f1d8fedcf9df621378340d (patch)
tree8535fbb2da39286377df01715546643c678d3958
parente626bbe4b57e7a99e9fc448dc408fca3277c16ff (diff)
Fix crash before main on ppc/linux with static constructors. PR1771
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43676 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/PowerPC/PPCAsmPrinter.cpp2
-rw-r--r--lib/Target/PowerPC/PPCTargetAsmInfo.cpp2
2 files changed, 4 insertions, 0 deletions
diff --git a/lib/Target/PowerPC/PPCAsmPrinter.cpp b/lib/Target/PowerPC/PPCAsmPrinter.cpp
index 9ff41cab90..5341279218 100644
--- a/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ b/lib/Target/PowerPC/PPCAsmPrinter.cpp
@@ -668,6 +668,8 @@ bool LinuxAsmPrinter::doFinalization(Module &M) {
if (I->hasExternalLinkage()) {
O << "\t.global " << name << '\n';
O << "\t.type " << name << ", @object\n";
+ if (TAI->getBSSSection())
+ SwitchToDataSection(TAI->getBSSSection(), I);
O << name << ":\n";
O << "\t.zero " << Size << "\n";
} else if (I->hasInternalLinkage()) {
diff --git a/lib/Target/PowerPC/PPCTargetAsmInfo.cpp b/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
index 7d9acd9c36..992b090edd 100644
--- a/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
+++ b/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
@@ -60,6 +60,7 @@ DarwinTargetAsmInfo::DarwinTargetAsmInfo(const PPCTargetMachine &TM)
HiddenDirective = "\t.private_extern\t";
SupportsExceptionHandling = false;
NeedsIndirectEncoding = true;
+ BSSSection = 0;
DwarfAbbrevSection = ".section __DWARF,__debug_abbrev,regular,debug";
DwarfInfoSection = ".section __DWARF,__debug_info,regular,debug";
@@ -94,6 +95,7 @@ LinuxTargetAsmInfo::LinuxTargetAsmInfo(const PPCTargetMachine &TM)
StaticDtorsSection = ".section\t.dtors,\"aw\",@progbits";
UsedDirective = "\t# .no_dead_strip\t";
WeakRefDirective = "\t.weak\t";
+ BSSSection = "\t.section\t\".sbss\",\"aw\",@nobits";
DwarfAbbrevSection = "\t.section\t.debug_abbrev,\"\",@progbits";
DwarfInfoSection = "\t.section\t.debug_info,\"\",@progbits";