diff options
author | Stuart Hastings <stuart@apple.com> | 2011-02-21 17:27:17 +0000 |
---|---|---|
committer | Stuart Hastings <stuart@apple.com> | 2011-02-21 17:27:17 +0000 |
commit | b4863a41e9b2b8a2d75b7d04a5f3671b29337e90 (patch) | |
tree | cef6783c746954fd60821f6aebbe1f3d1a6dabb5 /llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | |
parent | 5237febf0c4321f7c952224814c138ebfb0a46c6 (diff) | |
download | bcm5719-llvm-b4863a41e9b2b8a2d75b7d04a5f3671b29337e90.tar.gz bcm5719-llvm-b4863a41e9b2b8a2d75b7d04a5f3671b29337e90.zip |
Fix to correctly support attribute((section("__DATA, __common"))).
Radar 9012638.
llvm-svn: 126127
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
-rw-r--r-- | llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index 0b7bd98cc69..3b01bfdd694 100644 --- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -630,7 +630,7 @@ getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind, Mangler *Mang, const TargetMachine &TM) const { // Parse the section specifier and create it if valid. StringRef Segment, Section; - unsigned TAA, StubSize; + unsigned TAA = (unsigned)MCSectionMachO::SECTION_ATTRIBUTES, StubSize = 0; std::string ErrorCode = MCSectionMachO::ParseSectionSpecifier(GV->getSection(), Segment, Section, TAA, StubSize); @@ -643,10 +643,19 @@ getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind, return DataSection; } + bool TAAWasSet = (TAA != MCSectionMachO::SECTION_ATTRIBUTES); + if (!TAAWasSet) + TAA = 0; // Sensible default if this is a new section. + // Get the section. const MCSectionMachO *S = getContext().getMachOSection(Segment, Section, TAA, StubSize, Kind); + // If TAA wasn't set by ParseSectionSpecifier() above, + // use the value returned by getMachOSection() as a default. + if (!TAAWasSet) + TAA = S->getTypeAndAttributes(); + // Okay, now that we got the section, verify that the TAA & StubSize agree. // If the user declared multiple globals with different section flags, we need // to reject it here. |