diff --git a/lib/Target/X86/MCTargetDesc/X86WinCOFFObjectWriter.cpp b/lib/Target/X86/MCTargetDesc/X86WinCOFFObjectWriter.cpp index 5892f1de33e..807f7a6ddb1 100644 --- a/lib/Target/X86/MCTargetDesc/X86WinCOFFObjectWriter.cpp +++ b/lib/Target/X86/MCTargetDesc/X86WinCOFFObjectWriter.cpp @@ -44,7 +44,7 @@ unsigned X86WinCOFFObjectWriter::getRelocType(MCContext &Ctx, const MCAsmBackend &MAB) const { unsigned FixupKind = Fixup.getKind(); if (IsCrossSection) { - if (FixupKind != FK_Data_4) { + if (FixupKind != FK_Data_4 && FixupKind != llvm::X86::reloc_signed_4byte) { Ctx.reportError(Fixup.getLoc(), "Cannot represent this expression"); return COFF::IMAGE_REL_AMD64_ADDR32; } diff --git a/test/MC/X86/signed-coff-pcrel.s b/test/MC/X86/signed-coff-pcrel.s new file mode 100644 index 00000000000..768947bbf80 --- /dev/null +++ b/test/MC/X86/signed-coff-pcrel.s @@ -0,0 +1,12 @@ +// RUN: llvm-mc -triple i686-unknown-windows-msvc -filetype obj -o %t.o %s +// RUN: llvm-objdump -r %t.o | FileCheck %s + +// CHECK: 00000004 IMAGE_REL_I386_REL32 twop32 + + .section .rdata,"rd" +twop32: + .quad 0x41f0000000000000 + + .text +0: + mulsd twop32-0b(%eax), %xmm1