From d2662c32fbb8ded38cd48fea954aea66864eb37d Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Wed, 25 Jul 2018 18:35:31 +0000 Subject: [COFF] Hoist constant pool handling from X86AsmPrinter into AsmPrinter In SVN r334523, the first half of comdat constant pool handling was hoisted from X86WindowsTargetObjectFile (which despite the name only was used for msvc targets) into the arch independent TargetLoweringObjectFileCOFF, but the other half of the handling was left behind in X86AsmPrinter::GetCPISymbol. With only half of the handling in place, inconsistent comdat sections/symbols are created, causing issues with both GNU binutils (avoided for X86 in SVN r335918) and with the MS linker, which would complain like this: fatal error LNK1143: invalid or corrupt file: no symbol for COMDAT section 0x4 Differential Revision: https://reviews.llvm.org/D49644 llvm-svn: 337950 --- llvm/lib/Target/ARM/ARMAsmPrinter.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'llvm/lib/Target/ARM/ARMAsmPrinter.cpp') diff --git a/llvm/lib/Target/ARM/ARMAsmPrinter.cpp b/llvm/lib/Target/ARM/ARMAsmPrinter.cpp index 2412b25eaad..2196f9b47f3 100644 --- a/llvm/lib/Target/ARM/ARMAsmPrinter.cpp +++ b/llvm/lib/Target/ARM/ARMAsmPrinter.cpp @@ -235,6 +235,15 @@ void ARMAsmPrinter::printOperand(const MachineInstr *MI, int OpNum, } } +MCSymbol *ARMAsmPrinter::GetCPISymbol(unsigned CPID) const { + // The AsmPrinter::GetCPISymbol superclass method tries to use CPID as + // indexes in MachineConstantPool, which isn't in sync with indexes used here. + const DataLayout &DL = getDataLayout(); + return OutContext.getOrCreateSymbol(Twine(DL.getPrivateGlobalPrefix()) + + "CPI" + Twine(getFunctionNumber()) + "_" + + Twine(CPID)); +} + //===--------------------------------------------------------------------===// MCSymbol *ARMAsmPrinter:: -- cgit v1.2.3