[0/2] s390: Optionally print instruction description in disassembly

Message ID 20231208160330.1387610-1-jremus@linux.ibm.com
Headers
Series s390: Optionally print instruction description in disassembly |

Message

Jens Remus Dec. 8, 2023, 4:03 p.m. UTC
  With this patch series the s390 disassembler optionally prints the
instruction descriptions as comment in the disassembly. This is enabled
by specifying the new s390-specific disassembler option "insndesc".

Patch 1 is a cleanup in the s390-mkopc build, that I stumbled upon.

Patch 2 allows to optionally print the instruction descriptions as
comments using s390-specific disassembler option "insndesc".

Example output:
$ objdump -d -M insndesc test
...
0000000000000620 <deregister_tm_clones>:
 620:   c0 10 00 00 0d 5c       larl    %r1,20d8 <__TMC_END__>  # load address relative long
 626:   c0 20 00 00 0d 59       larl    %r2,20d8 <__TMC_END__>  # load address relative long
 62c:   ec 12 00 0a 80 64       cgrje   %r1,%r2,640 <deregister_tm_clones+0x20> # compare and branch relative (64)
 632:   c4 18 00 00 0c d7       lgrl    %r1,1fe0 <_ITM_deregisterTMCloneTable@Base>     # load relative long (64)
 638:   ec 18 00 04 00 7c       cgije   %r1,0,640 <deregister_tm_clones+0x20>   # compare immediate and branch relative (64<8)
 63e:   07 f1                   br      %r1     # unconditional branch
 640:   07 fe                   br      %r14    # unconditional branch

Note that the readability can be enhanced by using a filter such as "expand":

$ objdump -d -M insndesc test | expand -t 8,16,24,32,40,80
...
0000000000000620 <deregister_tm_clones>:
 620:   c0 10 00 00 0d 5c       larl    %r1,20d8 <__TMC_END__>                  # load address relative long
 626:   c0 20 00 00 0d 59       larl    %r2,20d8 <__TMC_END__>                  # load address relative long
 62c:   ec 12 00 0a 80 64       cgrje   %r1,%r2,640 <deregister_tm_clones+0x20> # compare and branch relative (64)
 632:   c4 18 00 00 0c d7       lgrl    %r1,1fe0 <_ITM_deregisterTMCloneTable@Base> # load relative long (64)
 638:   ec 18 00 04 00 7c       cgije   %r1,0,640 <deregister_tm_clones+0x20>   # compare immediate and branch relative (64<8)
 63e:   07 f1                   br      %r1                                     # unconditional branch
 640:   07 fe                   br      %r14                                    # unconditional branch

Regards,
Jens

Jens Remus (2):
  s390: Fix build when using EXEEXT_FOR_BUILD
  s390: Optionally print instruction description in disassembly

 binutils/NEWS         |  5 ++++
 include/opcode/s390.h |  5 +++-
 opcodes/Makefile.am   |  7 +++--
 opcodes/Makefile.in   |  7 +++--
 opcodes/s390-dis.c    | 13 ++++++++-
 opcodes/s390-mkopc.c  | 18 ++++++++-----
 opcodes/s390-opc.c    | 62 +++++++++++++++++++++----------------------
 7 files changed, 73 insertions(+), 44 deletions(-)