[PATCH] D81908: [MIPS] Fix incorrect relocations of instruction
hev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 19 20:35:51 PDT 2020
hev updated this revision to Diff 272228.
hev edited the summary of this revision.
hev added a comment.
@MaskRay Sorry, I missed the comment. :)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D81908/new/
https://reviews.llvm.org/D81908
Files:
lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp
test/MC/Mips/reloc-implicit-constraints-error.s
Index: test/MC/Mips/reloc-implicit-constraints-error.s
===================================================================
--- /dev/null
+++ test/MC/Mips/reloc-implicit-constraints-error.s
@@ -0,0 +1,15 @@
+# RUN: not llvm-mc -triple mips-unknown-linux-gnu -filetype obj -o /dev/null %s 2>%t1
+# RUN: FileCheck %s < %t1
+
+# RUN: not llvm-mc -triple mips64-unknown-linux-gnu -filetype obj -o /dev/null %s 2>%t1
+# RUN: FileCheck %s < %t1
+
+# Check that implicit constraints error
+
+ ori $4, $4, start # CHECK: [[@LINE]]:{{[0-9]+}}: error: expected 16-bit signed immediate
+ ori $4, $4, (start - .) # CHECK: [[@LINE]]:{{[0-9]+}}: error: expected 16-bit signed immediate
+
+ addiu $4, $4, start # CHECK: [[@LINE]]:{{[0-9]+}}: error: expected 16-bit signed immediate
+ addiu $4, $4, (start - .) # CHECK: [[@LINE]]:{{[0-9]+}}: error: expected 16-bit signed immediate
+
+start:
Index: lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp
===================================================================
--- lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp
+++ lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp
@@ -724,19 +724,7 @@
}
if (Kind == MCExpr::SymbolRef) {
- Mips::Fixups FixupKind = Mips::Fixups(0);
-
- switch(cast<MCSymbolRefExpr>(Expr)->getKind()) {
- default: llvm_unreachable("Unknown fixup kind!");
- break;
- case MCSymbolRefExpr::VK_None:
- // FIXME: This is ok for O32/N32 but not N64.
- FixupKind = Mips::fixup_Mips_32;
- break;
- } // switch
-
- Fixups.push_back(MCFixup::create(0, Expr, MCFixupKind(FixupKind)));
- return 0;
+ Ctx.reportError(Expr->getLoc(), "expected 16-bit signed immediate");
}
return 0;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81908.272228.patch
Type: text/x-patch
Size: 1728 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200620/f34ae1db/attachment.bin>
More information about the llvm-commits
mailing list