Honor explicit section information on Darwin.
authorDale Johannesen <dalej@apple.com>
Wed, 23 Jan 2008 00:58:14 +0000 (00:58 +0000)
committerDale Johannesen <dalej@apple.com>
Wed, 23 Jan 2008 00:58:14 +0000 (00:58 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46267 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMAsmPrinter.cpp
lib/Target/PowerPC/PPCAsmPrinter.cpp
lib/Target/X86/X86AsmPrinter.cpp

index 416084adce2c5e3603e0fad22bd509b98dfd257e..12039672439fd6bfd10fc67b48d674208ba69831 100644 (file)
@@ -908,6 +908,10 @@ bool ARMAsmPrinter::doFinalization(Module &M) {
         std::string SectionName = ".section " + I->getSection();
         SectionName += ",\"aw\",%progbits";
         SwitchToDataSection(SectionName.c_str());
+      } else if (I->hasSection() && Subtarget->isTargetDarwin()) {
+        // Honor all section names on Darwin; ObjC uses this
+        std::string SectionName = ".section " + I->getSection();
+        SwitchToDataSection(SectionName.c_str());
       } else {
         if (C->isNullValue() && !NoZerosInBSS && TAI->getBSSSection())
           SwitchToDataSection(I->isThreadLocal() ? TAI->getTLSBSSSection() :
index d5367dca3503a48323be7810ccc4cb3799c66af2..bab1af3491ab2d40c8ecab30c484cd8f94926590 100644 (file)
@@ -958,8 +958,11 @@ bool DarwinAsmPrinter::doFinalization(Module &M) {
             break;
           }
         }
-
-        if (!I->isConstant())
+        if (I->hasSection()) {
+          // Honor all section names on Darwin; ObjC uses this
+          std::string SectionName = ".section " + I->getSection();
+          SwitchToDataSection(SectionName.c_str());
+        } else if (!I->isConstant())
           SwitchToDataSection(TAI->getDataSection(), I);
         else {
           // Read-only data.
index ef8cbea590dcaf1a86915c4c6b49c68d8de2e39b..0b8c31cc7f6c9e84c12d7fc29bb4609c1056a14f 100644 (file)
@@ -275,7 +275,10 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
           assert(!Subtarget->isTargetDarwin());
           SectionName += ",\"aw\",@progbits";
         }
-
+        SwitchToDataSection(SectionName.c_str());
+      } else if (I->hasSection() && Subtarget->isTargetDarwin()) {
+        // Honor all section names on Darwin; ObjC uses this
+        std::string SectionName = ".section " + I->getSection();
         SwitchToDataSection(SectionName.c_str());
       } else {
         if (C->isNullValue() && !NoZerosInBSS && TAI->getBSSSection())