lib/CodeGen/TargetLoweringObjectFileImpl.cpp: Tweak to emit ".{section}${name}" inste...
authorNAKAMURA Takumi <geek4civic@gmail.com>
Tue, 19 Oct 2010 03:24:42 +0000 (03:24 +0000)
committerNAKAMURA Takumi <geek4civic@gmail.com>
Tue, 19 Oct 2010 03:24:42 +0000 (03:24 +0000)
It seems GNU ld/PECOFF relies on section names, linking with g++'s libstdc++.a would fail.

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

lib/CodeGen/TargetLoweringObjectFileImpl.cpp

index 164ee37263cccbd7b8aed722dbfa97cb46a50ee2..890d6e7ca00f479ba1aa03475beaa87f4b624115 100644 (file)
@@ -981,12 +981,12 @@ getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
 
 static const char *getCOFFSectionPrefixForUniqueGlobal(SectionKind Kind) {
   if (Kind.isText())
-    return ".text$linkonce";
+    return ".text$";
   if (Kind.isBSS ())
-    return ".bss$linkonce";
+    return ".bss$";
   if (Kind.isWriteable())
-    return ".data$linkonce";
-  return ".rdata$linkonce";
+    return ".data$";
+  return ".rdata$";
 }
 
 
@@ -1001,7 +1001,7 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
     const char *Prefix = getCOFFSectionPrefixForUniqueGlobal(Kind);
     SmallString<128> Name(Prefix, Prefix+strlen(Prefix));
     MCSymbol *Sym = Mang->getSymbol(GV);
-    Name.append(Sym->getName().begin(), Sym->getName().end());
+    Name.append(Sym->getName().begin() + 1, Sym->getName().end());
 
     unsigned Characteristics = getCOFFSectionFlags(Kind);