summaryrefslogtreecommitdiff
path: root/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
commitaac138e84dee1cb3ffc1035b2a1e4361fe0b4f80 (patch)
treef62498c8c571448790a13d39837f8691fd77e21f /lib/Target/TargetLoweringObjectFile.cpp
parent60a17740b845565f664e81a91b7019a520af88d7 (diff)
downloadllvm-aac138e84dee1cb3ffc1035b2a1e4361fe0b4f80.tar.gz
llvm-aac138e84dee1cb3ffc1035b2a1e4361fe0b4f80.tar.bz2
llvm-aac138e84dee1cb3ffc1035b2a1e4361fe0b4f80.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93838 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/TargetLoweringObjectFile.cpp')
-rw-r--r--lib/Target/TargetLoweringObjectFile.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Target/TargetLoweringObjectFile.cpp b/lib/Target/TargetLoweringObjectFile.cpp
index 93cb420d62..26a181aea0 100644
--- a/lib/Target/TargetLoweringObjectFile.cpp
+++ b/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;
}