binutils-gdb/ld/testsuite/ld-arm/arm-movwt.d
Andrew Burgess 8cb6e17571 opcodes/arm: use '@' consistently for the comment character
Looking at the ARM disassembler output, every comment seems to start
with a ';' character, so I assumed this was the correct character to
start an assembler comment.

I then spotted a couple of places where there was no ';', but instead,
just a '@' character.  I thought that this was a case of a missing
';', and proposed a patch to add the missing ';' characters.

Turns out I was wrong, '@' is actually the ARM assembler comment
character, while ';' is the statement separator.  Thus this:

    nop    ;@ comment

is two statements, the first is the 'nop' instruction, while the
second contains no instructions, just the '@ comment' comment text.

This:

    nop    @ comment

is a single 'nop' instruction followed by a comment.  And finally,
this:

    nop    ; comment

is two statements, the first contains the 'nop' instruction, while the
second contains the instruction 'comment', which obviously isn't
actually an instruction at all.

Why this matters is that, in the next commit, I would like to add
libopcodes syntax styling support for ARM.

The question then is how should the disassembler style the three cases
above?

As '@' is the actual comment start character then clearly the '@' and
anything after it can be styled as a comment.  But what about ';' in
the second example?  Style as text?  Style as a comment?

And the third example is even harder, what about the 'comment' text?
Style as an instruction mnemonic?  Style as text?  Style as a comment?

I think the only sensible answer is to move the disassembler to use
'@' consistently as its comment character, and remove all the uses of
';'.

Then, in the next commit, it's obvious what to do.

There's obviously a *lot* of tests that get updated by this commit,
the only actual code changes are in opcodes/arm-dis.c.
2022-11-01 09:32:13 +00:00

40 lines
1.2 KiB
Makefile

.*: file format.*
Disassembly of section .text:
00008000 <[^>]*>:
8000: e3000000 movw r0, #0
8004: e3411234 movt r1, #4660 @ 0x1234
8008: e3082000 movw r2, #32768 @ 0x8000
800c: e3413233 movt r3, #4659 @ 0x1233
8010: e3004011 movw r4, #17
8014: e3415234 movt r5, #4660 @ 0x1234
8018: e3086011 movw r6, #32785 @ 0x8011
801c: e3417233 movt r7, #4659 @ 0x1233
00008020 <[^>]*>:
8020: f240 0700 movw r7, #0
8024: f2c1 2634 movt r6, #4660 @ 0x1234
8028: f248 0500 movw r5, #32768 @ 0x8000
802c: f2c1 2433 movt r4, #4659 @ 0x1233
8030: f240 0311 movw r3, #17
8034: f2c1 2234 movt r2, #4660 @ 0x1234
8038: f248 0111 movw r1, #32785 @ 0x8011
803c: f2c1 2033 movt r0, #4659 @ 0x1233
Disassembly of section .far:
12340000 <[^>]*>:
12340000: e3080000 movw r0, #32768 @ 0x8000
12340004: e34e0dcc movt r0, #60876 @ 0xedcc
12340008: e3080021 movw r0, #32801 @ 0x8021
1234000c: e34e0dcc movt r0, #60876 @ 0xedcc
12340010 <[^>]*>:
12340010: f248 0000 movw r0, #32768 @ 0x8000
12340014: f6ce 50cc movt r0, #60876 @ 0xedcc
12340018: f248 0021 movw r0, #32801 @ 0x8021
1234001c: f6ce 50cc movt r0, #60876 @ 0xedcc