summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/TargetLoweringObjectFile.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-01-19 02:09:44 +0000
committerChris Lattner <sabre@nondot.org>2010-01-19 02:09:44 +0000
commit1d371882b6da32538d198004be1b272567b150a3 (patch)
treed47549c7355b82b45fc88deac1208f457f218712 /llvm/lib/Target/TargetLoweringObjectFile.cpp
parent5e1a83c19672d57ad20a10bc415eb43572a21554 (diff)
downloadbcm5719-llvm-1d371882b6da32538d198004be1b272567b150a3.tar.gz
bcm5719-llvm-1d371882b6da32538d198004be1b272567b150a3.zip
Cleanup handling of .zerofill on darwin:
1. TargetLoweringObjectFileMachO should decide if something goes in zerofill instead of having every target do it. 2. TargetLoweringObjectFileMachO should assign said symbols to the right MCSection, the asmprinters should just emit to the right section. 3. Since all zerofill stuff goes through mcstreamer anymore, MAI can have a bool "haszerofill" instead of having the textual directive to emit. llvm-svn: 93838
Diffstat (limited to 'llvm/lib/Target/TargetLoweringObjectFile.cpp')
-rw-r--r--llvm/lib/Target/TargetLoweringObjectFile.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Target/TargetLoweringObjectFile.cpp b/llvm/lib/Target/TargetLoweringObjectFile.cpp
index 93cb420d628..26a181aea0d 100644
--- a/llvm/lib/Target/TargetLoweringObjectFile.cpp
+++ b/llvm/lib/Target/TargetLoweringObjectFile.cpp
@@ -750,6 +750,9 @@ void TargetLoweringObjectFileMachO::Initialize(MCContext &Ctx,
ConstDataCoalSection
= getMachOSection("__DATA","__const_coal", MCSectionMachO::S_COALESCED,
SectionKind::getText());
+ DataCommonSection
+ = getMachOSection("__DATA","__common", MCSectionMachO::S_ZEROFILL,
+ SectionKind::getBSS());
ConstDataSection // .const_data
= getMachOSection("__DATA", "__const", 0,
SectionKind::getReadOnlyWithRel());
@@ -915,6 +918,11 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
if (Kind.isReadOnlyWithRel())
return ConstDataSection;
+ // Put zero initialized globals with strong external linkage in the
+ // DATA, __common section with the .zerofill directive.
+ if (Kind.isBSS() && GV->hasExternalLinkage())
+ return DataCommonSection;
+
// Otherwise, just drop the variable in the normal data section.
return DataSection;
}
OpenPOWER on IntegriCloud