mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 11:02:59 +02:00
[Mips] Handle one byte unsupported relocations
Fail gracefully instead of crashing upon encountering this type of relocation. Differential revision: https://reviews.llvm.org/D41857 llvm-svn: 322266
This commit is contained in:
parent
e2057ac4a6
commit
e61ac366bf
@ -225,6 +225,8 @@ unsigned MipsELFObjectWriter::getRelocType(MCContext &Ctx,
|
||||
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 relocations");
|
||||
case Mips::fixup_Mips_16:
|
||||
case FK_Data_2:
|
||||
return IsPCRel ? ELF::R_MIPS_PC16 : ELF::R_MIPS_16;
|
||||
|
13
test/MC/Mips/unsupported-relocation.s
Normal file
13
test/MC/Mips/unsupported-relocation.s
Normal file
@ -0,0 +1,13 @@
|
||||
# RUN: not llvm-mc -triple mips-unknown-linux -filetype=obj %s 2>%t
|
||||
# RUN: FileCheck %s < %t
|
||||
|
||||
# Check that we emit an error for unsupported relocations instead of crashing.
|
||||
|
||||
.globl x
|
||||
|
||||
.data
|
||||
foo:
|
||||
.byte x
|
||||
.byte x+1
|
||||
|
||||
# CHECK: LLVM ERROR: MIPS does not support one byte relocations
|
Loading…
Reference in New Issue
Block a user