summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2018-06-21 23:06:33 +0000
committerReid Kleckner <rnk@google.com>2018-06-21 23:06:33 +0000
commit2ef486690cbec5e626fc4eeaddce59a996e213f2 (patch)
treee12421f88f410ef659bb9ffd17a5fe21768ad697 /llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
parent53bbb9071859b592c8b23deb79fe180e4cac315d (diff)
downloadbcm5719-llvm-2ef486690cbec5e626fc4eeaddce59a996e213f2.tar.gz
bcm5719-llvm-2ef486690cbec5e626fc4eeaddce59a996e213f2.zip
[X86] Fix 32-bit mingw comdat names, only add one underscore
llvm-svn: 335304
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
-rw-r--r--llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
index 8518ee7def3..df8aecd7cf4 100644
--- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -1072,15 +1072,6 @@ static StringRef getCOFFSectionNameForUniqueGlobal(SectionKind Kind) {
return ".data";
}
-void TargetLoweringObjectFileCOFF::appendComdatSymbolForMinGW(
- SmallVectorImpl<char> &SecName, StringRef Symbol,
- const DataLayout &DL) const {
- if (getTargetTriple().isWindowsGNUEnvironment()) {
- SecName.push_back('$');
- getMangler().getNameWithPrefix(SecName, Symbol, DL);
- }
-}
-
MCSection *TargetLoweringObjectFileCOFF::SelectSectionForGlobal(
const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const {
// If we have -ffunction-sections then we should emit the global value to a
@@ -1113,8 +1104,12 @@ MCSection *TargetLoweringObjectFileCOFF::SelectSectionForGlobal(
if (!ComdatGV->hasPrivateLinkage()) {
MCSymbol *Sym = TM.getSymbol(ComdatGV);
StringRef COMDATSymName = Sym->getName();
- appendComdatSymbolForMinGW(Name, COMDATSymName,
- GO->getParent()->getDataLayout());
+
+ // Append "$symbol" to the section name when targetting mingw. The ld.bfd
+ // COFF linker will not properly handle comdats otherwise.
+ if (getTargetTriple().isWindowsGNUEnvironment())
+ raw_svector_ostream(Name) << '$' << COMDATSymName;
+
return getContext().getCOFFSection(Name, Characteristics, Kind,
COMDATSymName, Selection, UniqueID);
} else {
OpenPOWER on IntegriCloud