From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7867) id DA107385840D; Fri, 30 Jun 2023 02:29:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DA107385840D 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] opcodes/loongarch: print unrecognized insn words with the .word directive X-Act-Checkin: binutils-gdb X-Git-Author: WANG Xuerui X-Git-Refname: refs/heads/master X-Git-Oldrev: 8b6fefaddeec839e6b1121336ba5e6696491d91f X-Git-Newrev: 6ad6615a79843aa224710a70a33fd15777f74f49 Message-Id: <20230630022946.DA107385840D@sourceware.org> Date: Fri, 30 Jun 2023 02:29:46 +0000 (GMT) X-BeenThere: binutils-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jun 2023 02:29:47 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D6ad6615a7984= 3aa224710a70a33fd15777f74f49 commit 6ad6615a79843aa224710a70a33fd15777f74f49 Author: WANG Xuerui Date: Fri Jun 30 00:35:03 2023 +0800 opcodes/loongarch: print unrecognized insn words with the .word directi= ve =20 For better round-trip fidelity and readability in general. =20 gas/ChangeLog: =20 * testsuite/gas/loongarch/uleb128.d: Update test case. * testsuite/gas/loongarch/raw-insn.d: New test. * testsuite/gas/loongarch/raw-insn.s: Likewise. =20 opcodes/ChangeLog: =20 * loongarch-dis.c (disassemble_one): Print ".word" if !opc. =20 Signed-off-by: WANG Xuerui Diff: --- gas/testsuite/gas/loongarch/raw-insn.d | 11 +++++++++++ gas/testsuite/gas/loongarch/raw-insn.s | 7 +++++++ gas/testsuite/gas/loongarch/uleb128.d | 20 ++++++++++---------- opcodes/loongarch-dis.c | 1 + 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/gas/testsuite/gas/loongarch/raw-insn.d b/gas/testsuite/gas/loo= ngarch/raw-insn.d new file mode 100644 index 00000000000..64980e47f7b --- /dev/null +++ b/gas/testsuite/gas/loongarch/raw-insn.d @@ -0,0 +1,11 @@ +#as: +#objdump: -dr + +.*:[ ]+file format .* + + +Disassembly of section .text: + +0+000 : +[ ]+0:[ ]+00000000[ ]+.word[ ]+0x00000000 +[ ]+4:[ ]+feedf00d[ ]+.word[ ]+0xfeedf00d diff --git a/gas/testsuite/gas/loongarch/raw-insn.s b/gas/testsuite/gas/loo= ngarch/raw-insn.s new file mode 100644 index 00000000000..528b15263ae --- /dev/null +++ b/gas/testsuite/gas/loongarch/raw-insn.s @@ -0,0 +1,7 @@ +target: + .word 0 + # Given how the LoongArch encoding space is apparently centrally- + # managed and sequentially allocated in chunks of prefixes, it is + # highly unlikely this would become a valid LoongArch instruction in + # the foreseeable future. + .word 0xfeedf00d diff --git a/gas/testsuite/gas/loongarch/uleb128.d b/gas/testsuite/gas/loon= garch/uleb128.d index df66587b692..ad67ded9e7d 100644 --- a/gas/testsuite/gas/loongarch/uleb128.d +++ b/gas/testsuite/gas/loongarch/uleb128.d @@ -8,29 +8,29 @@ Disassembly of section .data: =20 00000000.* : -[ ]+0:[ ]+80030201[ ]+0x80030201 +[ ]+0:[ ]+80030201[ ]+\.word[ ]+0x80030201 [ ]+3:[ ]+R_LARCH_ADD_ULEB128[ ]+L2 [ ]+3:[ ]+R_LARCH_SUB_ULEB128[ ]+L1 [ ]+\.\.\. =20 0000000000000005[ ]+: [ ]+\.\.\. -[ ]+81:[ ]+ff040000[ ]+0xff040000 +[ ]+81:[ ]+ff040000[ ]+\.word[ ]+0xff040000 [ ]+85:[ ]+cacop[ ]+0x1f,[ ]+\$t3,[ ]+1 =20 0000000000000086[ ]+: -[ ]+86:[ ]+07060005[ ]+0x07060005 -[ ]+8a:[ ]+0x00008080 +[ ]+86:[ ]+07060005[ ]+\.word[ ]+0x07060005 +[ ]+8a:[ ]+\.word[ ]+0x00008080 [ ]+8a:[ ]+R_LARCH_ADD_ULEB128[ ]+L4 [ ]+8a:[ ]+R_LARCH_SUB_ULEB128[ ]+L3 =20 000000000000008d[ ]+: [ ]+\.\.\. -[ ]+4089:[ ]+ff080000[ ]+0xff080000 -[ ]+408d:[ ]+0x09ffffff +[ ]+4089:[ ]+ff080000[ ]+\.word[ ]+0xff080000 +[ ]+408d:[ ]+\.word[ ]+0x09ffffff =20 0000000000004090[ ]+: -[ ]+4090:[ ]+09090909[ ]+0x09090909 -[ ]+4094:[ ]+09090909[ ]+0x09090909 -[ ]+4098:[ ]+09090909[ ]+0x09090909 -[ ]+409c:[ ]+09090909[ ]+0x09090909 +[ ]+4090:[ ]+09090909[ ]+\.word[ ]+0x09090909 +[ ]+4094:[ ]+09090909[ ]+\.word[ ]+0x09090909 +[ ]+4098:[ ]+09090909[ ]+\.word[ ]+0x09090909 +[ ]+409c:[ ]+09090909[ ]+\.word[ ]+0x09090909 diff --git a/opcodes/loongarch-dis.c b/opcodes/loongarch-dis.c index c45c4fc617c..8d72519be9f 100644 --- a/opcodes/loongarch-dis.c +++ b/opcodes/loongarch-dis.c @@ -259,6 +259,7 @@ disassemble_one (insn_t insn, struct disassemble_info *= info) if (!opc) { info->insn_type =3D dis_noninsn; + info->fprintf_styled_func (info->stream, dis_style_assembler_directi= ve, ".word\t\t"); info->fprintf_styled_func (info->stream, dis_style_immediate, "0x%08= x", insn); return; }