Distinguish .const and .const_data on Darwin, when needed. This is somehow crazy :)
authorAnton Korobeynikov <asl@math.spbu.ru>
Wed, 9 Jul 2008 20:01:42 +0000 (20:01 +0000)
committerAnton Korobeynikov <asl@math.spbu.ru>
Wed, 9 Jul 2008 20:01:42 +0000 (20:01 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53350 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86TargetAsmInfo.cpp

index 965e8d6b77a9e2d63a9fd014af83c9b626a765a6..e3bc507bb84ca047a465902df56af42fba07517c 100644 (file)
@@ -245,6 +245,7 @@ const Section*
 X86DarwinTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const {
   SectionKind::Kind Kind = SectionKindForGlobal(GV);
   bool isWeak = GV->isWeakForLinker();
+  bool isNonStatic = (X86TM->getRelocationModel() != Reloc::Static);
 
   switch (Kind) {
    case SectionKind::Text:
@@ -261,7 +262,8 @@ X86DarwinTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const {
     else
       return (isWeak ? DataCoalSection : getDataSection_());
    case SectionKind::ROData:
-    return (isWeak ? ConstDataCoalSection : getReadOnlySection_());
+    return (isWeak ? ConstDataCoalSection :
+            (isNonStatic ? ConstDataSection : getReadOnlySection_()));
    case SectionKind::RODataMergeStr:
     return (isWeak ?
             ConstDataCoalSection :