[PATCH 1/2] opcodes/arm: add missing ';' characters

Andrew Burgess aburgess@redhat.com
Thu Sep 22 18:20:39 GMT 2022


Richard Earnshaw <Richard.Earnshaw@foss.arm.com> writes:

> On 22/09/2022 10:08, Andrew Burgess wrote:
>> Richard Earnshaw <Richard.Earnshaw@foss.arm.com> writes:
>> 
>>> On 16/09/2022 14:21, Andrew Burgess via Binutils wrote:
>>>> I spotted a couple of places where the ARM disassembler produces what
>>>> seems to be some comment style text '@ Impl Def' without including a
>>>> comment character ';'.  In other places where we have similar messages
>>>> a comment character is emitted, so I suspect this was just an
>>>> oversight.
>>>>
>>>> Fixed in this commit by adding two new comment characters, and
>>>> updating the expected test results.
>>>
>>> No, this is incorrect. @ is the comment marker on Arm; ';' is the
>>> statement separator.
>>>
>> 
>> Wow!  OK.  So, I tested what you said, and you'd absolutely correct.
>> But does that mean all the places where the disassembler prints what (I
>> believe) is clearly a comment without printing '@' is actually a bug?
>> Or am I missing something really subtle here?
>> 
>> Here are just a few of the many examples that can be found in the gas
>> testsuite for ARM:
>> 
>>    sub     r0, r0, #32, 24 ; 0x2000
>>    add     r0, r0, #32, 24 ; 0x2000
>>    nop                     ; (mov r0, r0)
>>    subhi   pc, pc, #805306368      ; 0x30000000
>>    ldrh    r3, [pc, #-8]   ; 8 <foo>
>>    ldrsb   r2, [r3, #255]  ; 0xff
>>    ldrsh   r1, [r4, #-250] ; 0xffffff06
>>    ldrsb   r1, [r5, #240]  ; 0xf0
>>    strh    r2, [pc, #48]   ; 68 <bar>
>> 
>> There are many more, but they are all pretty similar in content.
>> 
>> Should I instead propose changing all these to use '@' ?
>> 
>> Thanks,
>> Andrew
>> 
>
> Technically, yes.  But I don't think we've ever claimed that you could 
> paste the output of the disassembler into an assembler and directly use 
> the result.  So while this would be good to fix, I don't think it's a 
> disaster.

Except I would like to style the disassembler output.  Right now, based
on what I was seeing, I've handled ';' as the start of a comment.  Which
is probably wrong.

I could continue to treat ';' (in addition to '@') as a comment marker
in disassembler output, which would proably give the best looking output.

Or I can fix the disassembler to use '@' consistently? Which is probably
the best all round solution.  It sounds like you wouldn't object to this?

Or I could treat ';' as a statement separator and style whatever's after
it as... whatever it would be, immediate, text, label, etc?  Which I
think will give the most confusing output.

Would value your thoughts,

Thanks,
Andrew



More information about the Binutils mailing list