Fixed mingw\cygwin linkonce linkage once again.
Added workaround for linker bug with linkonce sections.
Changed sections prefix to allow linker merge them
(PE loader doesn't like too much long-named sections :) )
All of this unbreaks libstdc++ on mingw32 allowing (small)
programs to be compiled, linked and run.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31033 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/X86/X86AsmPrinter.cpp b/lib/Target/X86/X86AsmPrinter.cpp
index 2a3a2aa..bab80db 100644
--- a/lib/Target/X86/X86AsmPrinter.cpp
+++ b/lib/Target/X86/X86AsmPrinter.cpp
@@ -174,27 +174,15 @@
} else {
switch (I->getLinkage()) {
case GlobalValue::LinkOnceLinkage:
- if (Subtarget->isTargetDarwin()) {
- O << "\t.globl " << name << "\n"
- << "\t.weak_definition " << name << "\n";
- SwitchToDataSection(".section __DATA,__const_coal,coalesced", I);
- } else if (Subtarget->isTargetCygwin()) {
- O << "\t.section\t.llvm.linkonce.d." << name << ",\"aw\"\n"
- << "\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";
- }
- break;
case GlobalValue::WeakLinkage:
if (Subtarget->isTargetDarwin()) {
O << "\t.globl " << name << "\n"
<< "\t.weak_definition " << name << "\n";
SwitchToDataSection(".section __DATA,__const_coal,coalesced", I);
} else if (Subtarget->isTargetCygwin()) {
- O << "\t.section\t.llvm.linkonce.d." << name << ",\"aw\"\n"
- << "\t.weak " << name << "\n";
+ O << "\t.section\t.data$linkonce." << name << ",\"aw\"\n"
+ << "\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";