Re: RFC: AArch64 Disassembler: Annotate undefined instructions
Alice Carlotti <[email protected]> Thu, 30 Jul 2026 00:32:25 +0100
| Newsgroups | gmane.comp.gnu.binutils |
|---|---|
| Message-ID | <[email protected]> |
On Mon, May 04, 2026 at 10:41:54AM +0100, Nick Clifton wrote:
> Hi Richard,
>
> > > Can you get 32-bit undefined AArch64 instructions ?
> > I'm not sure I follow. All aarch64 instructions are 32 bits in size.
>
> Doh! Please excuse my brain fart. Yes, I knew that. I was getting
> confused with the "64" in the "AArch64" name...
>
> > Also, .inst does not permit the use of a label - it has no meaning in that context. So for
> >
> > .text
> > .inst 0x12345678
> > .word 0x12345678
> > .word bar // truncated to 32 bits, but OK
> > .inst bar // Error, not a constant expression
> > bar:
> >
> > you get
> >
> > as test.s
> > test.s: Assembler messages:
> > test.s:5: Error: constant expression required
> >
> > So to even trigger this case you have to contort your sources in ways I really can't see users trying to do.
>
> Agreed. I tried to create a test case to make sure that .inst values
> were not annotated (but could of been because their value matched a
> legitimate symbol value in the linked executable) but I could not find
> any way to do this.
>
>
> > Is there some user reported case driving this?
>
> No, it is just me, trying to make the disassembler output slightly
> more informative.
>
> Cheers
> Nick
>
I think Richard and I came away with a different impression of how this
conversation concluded. We thought that the patch was not accepted and would
be dropped after this response, but I've just discovered from the release notes
that it was actually committed.
The issues I see with it are that it:
- Conflates 32-but values with 64-bit address, with the full address displayed as:
411030: 0040065c .inst 0x0040065c ; [func1]
411034: 00000000 udf #0
- Only supports symbols at addresses between 0 and 2^32-1
- Only supports 60% of the addresses in that range, since 40% of values are
recognised as instructions.
- Interprets content as data values when the user explicitly requested the
content to be interpreted as instructions.
Now that it's made it into a release, it might be a bit late to remove this.
However, if we keep it then I'd certainly want to explain some of the above
issues in the code comment, to reduce confusion there.
Alice