]> granicus.if.org Git - llvm/commitdiff
Fix PR33625.
authorRafael Espindola <rafael.espindola@gmail.com>
Wed, 28 Jun 2017 17:56:07 +0000 (17:56 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Wed, 28 Jun 2017 17:56:07 +0000 (17:56 +0000)
We were failing to convert this expression to pcrel.

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

lib/Target/X86/MCTargetDesc/X86WinCOFFObjectWriter.cpp
test/MC/X86/signed-coff-pcrel.s [new file with mode: 0644]

index 5892f1de33eece1312b916b5a694d63483d1695d..807f7a6ddb198f232004daf40f27fd27c7903745 100644 (file)
@@ -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 (file)
index 0000000..768947b
--- /dev/null
@@ -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