Do section switching right way for Mingw\Cygwin and Linux.
authorAnton Korobeynikov <asl@math.spbu.ru>
Sun, 22 Oct 2006 21:37:13 +0000 (21:37 +0000)
committerAnton Korobeynikov <asl@math.spbu.ru>
Sun, 22 Oct 2006 21:37:13 +0000 (21:37 +0000)
This will allow (after llvm-gcc linkage fix) more dummy tests using
libstdc++ to pass on mingw :)

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

lib/Target/X86/X86AsmPrinter.cpp

index bab80dbd443d324e9066d81df7d2a4fd1b29ff3a..2438546f3db2cbd47d4c0a5c88219bb21ea402de 100644 (file)
@@ -180,12 +180,18 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
             << "\t.weak_definition " << name << "\n";
           SwitchToDataSection(".section __DATA,__const_coal,coalesced", I);
         } else if (Subtarget->isTargetCygwin()) {
-          O << "\t.section\t.data$linkonce." << name << ",\"aw\"\n"
-            << "\t.globl " << name << "\n"
+          std::string SectionName(".section\t.data$linkonce." +
+                                  name +
+                                  ",\"aw\"\n");
+          SwitchToDataSection(SectionName.c_str(), I);
+          O << "\t.globl " << name << "\n"
             << "\t.linkonce same_size\n";
         } else {
-          O << "\t.section\t.llvm.linkonce.d." << name << ",\"aw\",@progbits\n"
-            << "\t.weak " << name << "\n";
+          std::string SectionName("\t.section\t.llvm.linkonce.d." +
+                                  name +
+                                  ",\"aw\",@progbits\n");
+          SwitchToDataSection(SectionName.c_str(), I);
+          O << "\t.weak " << name << "\n";
         }
         break;
       case GlobalValue::AppendingLinkage: