From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7867) id 1F5A63858D33; Wed, 22 Nov 2023 06:43:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1F5A63858D33 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: liu & zhensong To: bfd-cvs@sourceware.org Subject: [binutils-gdb] LoongArch: fix internal error when as handling unsupported modifier. X-Act-Checkin: binutils-gdb X-Git-Author: Lulu Cai X-Git-Refname: refs/heads/master X-Git-Oldrev: f178a375085d796ceeb8c6551b18e34b2653cc88 X-Git-Newrev: df4ffdd8c87b32357f929fb4a861760038f3bbb8 Message-Id: <20231122064304.1F5A63858D33@sourceware.org> Date: Wed, 22 Nov 2023 06:43:04 +0000 (GMT) X-BeenThere: binutils-cvs@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Nov 2023 06:43:04 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Ddf4ffdd8c87b= 32357f929fb4a861760038f3bbb8 commit df4ffdd8c87b32357f929fb4a861760038f3bbb8 Author: Lulu Cai Date: Wed Nov 15 19:20:53 2023 +0800 LoongArch: fix internal error when as handling unsupported modifier. Diff: --- bfd/elfxx-loongarch.c | 3 --- gas/config/loongarch-parse.y | 6 +++++- gas/testsuite/gas/loongarch/reloc_type.d | 3 +++ gas/testsuite/gas/loongarch/reloc_type.l | 2 ++ gas/testsuite/gas/loongarch/reloc_type.s | 3 +++ 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/bfd/elfxx-loongarch.c b/bfd/elfxx-loongarch.c index a970a257aa9..7f298c08fd3 100644 --- a/bfd/elfxx-loongarch.c +++ b/bfd/elfxx-loongarch.c @@ -1629,9 +1629,6 @@ loongarch_larch_reloc_name_lookup (bfd *abfd ATTRIBUT= E_UNUSED, return lht->bfd_type; } =20 - (*_bfd_error_handler) (_("%pB: unsupported relocation type name %s"), - abfd, l_r_name); - bfd_set_error (bfd_error_bad_value); return BFD_RELOC_NONE; } =20 diff --git a/gas/config/loongarch-parse.y b/gas/config/loongarch-parse.y index f4e1a63b972..f786fdaee5f 100644 --- a/gas/config/loongarch-parse.y +++ b/gas/config/loongarch-parse.y @@ -132,7 +132,11 @@ reloc (const char *op_c_str, const char *id_c_str, off= setT addend) if (0 =3D=3D strcmp (op_c_str, "plt")) btype =3D BFD_RELOC_LARCH_B26; else - btype =3D loongarch_larch_reloc_name_lookup (NULL, op_c_str); + { + btype =3D loongarch_larch_reloc_name_lookup (NULL, op_c_str); + if (btype =3D=3D BFD_RELOC_NONE) + as_fatal (_("unsupported modifier %s"), op_c_str); + } =20 if (id_c_str) { diff --git a/gas/testsuite/gas/loongarch/reloc_type.d b/gas/testsuite/gas/l= oongarch/reloc_type.d new file mode 100644 index 00000000000..0a8f77825a0 --- /dev/null +++ b/gas/testsuite/gas/loongarch/reloc_type.d @@ -0,0 +1,3 @@ +#as: +#source: reloc_type.s +#error_output: reloc_type.l diff --git a/gas/testsuite/gas/loongarch/reloc_type.l b/gas/testsuite/gas/l= oongarch/reloc_type.l new file mode 100644 index 00000000000..e981f6f2aa5 --- /dev/null +++ b/gas/testsuite/gas/loongarch/reloc_type.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*Fatal error: unsupported modifier (.*)$ diff --git a/gas/testsuite/gas/loongarch/reloc_type.s b/gas/testsuite/gas/l= oongarch/reloc_type.s new file mode 100644 index 00000000000..2ce277779db --- /dev/null +++ b/gas/testsuite/gas/loongarch/reloc_type.s @@ -0,0 +1,3 @@ +.L1: + nop + addi.d $a0,$a1,%reloc(x)