From ff33a95ed44b9c146d3b58517717a4163b479b02 Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Wed, 25 Jul 2018 18:35:42 +0000 Subject: [COFF] Use comdat shared constants for MinGW as well GNU binutils tools have no problems with this kind of shared constants, provided that we actually hook it up completely in AsmPrinter and produce a global symbol. This effectively reverts SVN r335918 by hooking the rest of it up properly. This feature was implemented originally in SVN r213006, with no reason for why it can't be used for MinGW other than the fact that GCC doesn't do it while MSVC does. Differential Revision: https://reviews.llvm.org/D49646 llvm-svn: 337951 --- llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp') diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index b5dd2d4cca8..149cec26411 100644 --- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -1396,12 +1396,7 @@ static std::string scalarConstantToHexString(const Constant *C) { MCSection *TargetLoweringObjectFileCOFF::getSectionForConstant( const DataLayout &DL, SectionKind Kind, const Constant *C, unsigned &Align) const { - if (Kind.isMergeableConst() && C && - getContext().getAsmInfo()->hasCOFFComdatConstants()) { - // This creates comdat sections with the given symbol name, but unless - // AsmPrinter::GetCPISymbol actually makes the symbol global, the symbol - // will be created with a null storage class, which makes GNU binutils - // error out. + if (Kind.isMergeableConst() && C) { const unsigned Characteristics = COFF::IMAGE_SCN_CNT_INITIALIZED_DATA | COFF::IMAGE_SCN_MEM_READ | COFF::IMAGE_SCN_LNK_COMDAT; -- cgit v1.2.3