LoongArch: fix internal error when as handling unsupported modifier.

This commit is contained in:
Lulu Cai 2023-11-15 19:20:53 +08:00 committed by liuzhensong
parent f178a37508
commit df4ffdd8c8
5 changed files with 13 additions and 4 deletions

View file

@ -1629,9 +1629,6 @@ loongarch_larch_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
return lht->bfd_type;
}
(*_bfd_error_handler) (_("%pB: unsupported relocation type name %s"),
abfd, l_r_name);
bfd_set_error (bfd_error_bad_value);
return BFD_RELOC_NONE;
}

View file

@ -132,7 +132,11 @@ reloc (const char *op_c_str, const char *id_c_str, offsetT addend)
if (0 == strcmp (op_c_str, "plt"))
btype = BFD_RELOC_LARCH_B26;
else
btype = loongarch_larch_reloc_name_lookup (NULL, op_c_str);
{
btype = loongarch_larch_reloc_name_lookup (NULL, op_c_str);
if (btype == BFD_RELOC_NONE)
as_fatal (_("unsupported modifier %s"), op_c_str);
}
if (id_c_str)
{

View file

@ -0,0 +1,3 @@
#as:
#source: reloc_type.s
#error_output: reloc_type.l

View file

@ -0,0 +1,2 @@
.*Assembler messages:
.*Fatal error: unsupported modifier (.*)$

View file

@ -0,0 +1,3 @@
.L1:
nop
addi.d $a0,$a1,%reloc(x)