(re)Put const weak strings in appropriate section on Darwin.
authorDale Johannesen <dalej@apple.com>
Wed, 8 Oct 2008 21:49:47 +0000 (21:49 +0000)
committerDale Johannesen <dalej@apple.com>
Wed, 8 Oct 2008 21:49:47 +0000 (21:49 +0000)
g++dg/abi/key2.C

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57309 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Target/DarwinTargetAsmInfo.h
lib/Target/DarwinTargetAsmInfo.cpp

index dab591aa036763e2742cf4dafffcc37076b4cab6..a99e16df2c88f47a5c046f7aecd4c953c91c56bf 100644 (file)
@@ -26,6 +26,7 @@ namespace llvm {
 
   struct DarwinTargetAsmInfo: public TargetAsmInfo {
     const Section* TextCoalSection;
+    const Section* ConstTextCoalSection;
     const Section* ConstDataCoalSection;
     const Section* ConstDataSection;
     const Section* DataCoalSection;
index 0e4b09adfef79621c8ac6e9945396cc6a875746c..20866d7617e1b07c0578b9b0f9cf90454cb78d6d 100644 (file)
@@ -43,6 +43,8 @@ DarwinTargetAsmInfo::DarwinTargetAsmInfo(const TargetMachine &TM) {
   TextCoalSection =
     getNamedSection("\t__TEXT,__textcoal_nt,coalesced,pure_instructions",
                     SectionFlags::Code);
+  ConstTextCoalSection = getNamedSection("\t__TEXT,__const_coal,coalesced",
+                                         SectionFlags::None);
   ConstDataCoalSection = getNamedSection("\t__DATA,__const_coal,coalesced",
                                          SectionFlags::None);
   ConstDataSection = getUnnamedSection(".const_data", SectionFlags::None);
@@ -95,7 +97,7 @@ DarwinTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const {
             (isNonStatic ? ConstDataSection : getReadOnlySection()));
    case SectionKind::RODataMergeStr:
     return (isWeak ?
-            ConstDataCoalSection :
+            ConstTextCoalSection :
             MergeableStringSection(cast<GlobalVariable>(GV)));
    case SectionKind::RODataMergeConst:
     return (isWeak ?