RFC: AArch64 Disassembler: Annotate undefined instructions
Richard Earnshaw (foss)
Richard.Earnshaw@arm.com
Thu Apr 30 13:08:08 GMT 2026
On 29/04/2026 12:03, Nick Clifton wrote:
> Hi Richard,
>
>>> OK, that makes sense. So the disassembler should check to see if closest
>>> previous mapping symbol is $d and only proceed with the annotation in this
>>> case, yes ?
>
>> Do you even need to do that? Just annotate the disassembly of .word values.
>
> But the disassembler only knows if an "undefined" instruction is actually
> meant to be data by looking at the mapping symbols.
>
> This is the test that I am now using in the v2 version of the patch (not
> posted yet as I am waiting to see if there are more comments):
>
> /* See if this "undefined instruction" is actually the address of something. */
> if (annotate_undefined_insns
> /* Skip values that have been explicitly tagged as code. */
> && last_type == MAP_DATA
> /* Skip static object files as symbol values have not be resolved yet. */
> && info->section != NULL
> && info->section->owner != NULL
> && (info->section->owner->flags & (EXEC_P | DYNAMIC)))
> { ... do the annotation ... }
>
>> Though I suspect you'll need to look at 64-bit quantities on a 64-bit machine.
>> 32-bit values aren't addresses.
>
> Can you get 32-bit undefined AArch64 instructions ?
I'm not sure I follow. All aarch64 instructions are 32 bits in size.
> The patch only annotates
> the disassembler's output for undefined instructions, so if it displaying something
> else then nothing new will happen.
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.
Is there some user reported case driving this?
R.
>
> Cheers
> Nick
>
>
More information about the Binutils
mailing list