[PATCH] D81908: [MIPS] Fix incorrect relocations of instruction
hev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 15 22:32:29 PDT 2020
hev created this revision.
hev added a reviewer: atanasyan.
Herald added subscribers: llvm-commits, jrtc27, hiraditya, arichardson, sdardis.
Herald added a project: LLVM.
The 32-bit type relocation (R_MIPS_32) is not possible used for MIPS instruction encoding. so, here should use explicit constraints:
daddiu $0, $0, label - .
to
daddiu $0, $0, %lo(label - .)
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D81908
Files:
llvm/lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp
Index: llvm/lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp
===================================================================
--- llvm/lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp
+++ llvm/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(), "should use explicit constraints!");
}
return 0;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81908.270959.patch
Type: text/x-patch
Size: 832 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200616/3ea4c4dd/attachment.bin>
More information about the llvm-commits
mailing list