[PATCH] D41857: [Mips] Handle one byte illegal relocations
Stefan Maksimovic via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 9 02:47:32 PST 2018
smaksimovic created this revision.
smaksimovic added reviewers: sdardis, zoran.jovanovic.
Herald added a subscriber: arichardson.
Exit gracefully instead of crashing upon encountering
this type of relocation.
https://reviews.llvm.org/D41857
Files:
lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
test/MC/Mips/illegal-relocation.s
Index: test/MC/Mips/illegal-relocation.s
===================================================================
--- test/MC/Mips/illegal-relocation.s
+++ test/MC/Mips/illegal-relocation.s
@@ -0,0 +1,11 @@
+# RUN: not llvm-mc -triple mips-unknown-linux -filetype=obj %s 2>%t
+# RUN: FileCheck %s < %t
+
+ .globl x
+
+ .data
+foo:
+ .byte x
+ .byte x+1
+
+# CHECK: LLVM ERROR: Mips does not support one byte fixups
Index: lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
===================================================================
--- lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
+++ lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
@@ -225,6 +225,8 @@
switch (Kind) {
case Mips::fixup_Mips_NONE:
return ELF::R_MIPS_NONE;
+ case FK_Data_1:
+ report_fatal_error("Mips does not support one byte fixups");
case Mips::fixup_Mips_16:
case FK_Data_2:
return IsPCRel ? ELF::R_MIPS_PC16 : ELF::R_MIPS_16;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41857.129052.patch
Type: text/x-patch
Size: 974 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180109/92478078/attachment.bin>
More information about the llvm-commits
mailing list