Put cstrings in .cstring section when compiling for Mac OS X.
authorEvan Cheng <evan.cheng@apple.com>
Thu, 26 Oct 2006 19:18:18 +0000 (19:18 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Thu, 26 Oct 2006 19:18:18 +0000 (19:18 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31203 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86AsmPrinter.cpp
lib/Target/X86/X86TargetAsmInfo.cpp

index 5e13a35f8317989dbe2b4083c755050276d109cd..0a4106c95387bba04ec2afb6fe07768fb9bd75d3 100644 (file)
@@ -204,9 +204,17 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
         // If external or appending, declare as a global symbol
         O << "\t.globl " << name << "\n";
         // FALL THROUGH
-      case GlobalValue::InternalLinkage:
+      case GlobalValue::InternalLinkage: {
+        if (TAI->getCStringSection()) {
+          const ConstantArray *CVA = dyn_cast<ConstantArray>(C);
+          if (CVA && CVA->isCString()) {
+            SwitchToDataSection(TAI->getCStringSection(), I);
+            break;
+          }
+        }
         SwitchToDataSection(TAI->getDataSection(), I);
         break;
+      }
       default:
         assert(0 && "Unknown linkage type!");
       }
index cf0854851902302c1deaaddfb26c357dae90c4ae..e67773711cbe07875d561550903170cad403be60 100644 (file)
@@ -32,6 +32,7 @@ X86TargetAsmInfo::X86TargetAsmInfo(const X86TargetMachine &TM) {
     PrivateGlobalPrefix = "L";     // Marker for constant pool idxs
     ConstantPoolSection = "\t.const\n";
     JumpTableDataSection = "\t.const\n";
+    CStringSection = "\t.cstring";
     FourByteConstantSection = "\t.literal4\n";
     EightByteConstantSection = "\t.literal8\n";
     if (Subtarget->is64Bit())