RFC: AArch64 Disassembler: Annotate undefined instructions

Richard Earnshaw (foss) Richard.Earnshaw@arm.com
Tue Apr 28 15:18:42 GMT 2026


On 28/04/2026 14:51, Nick Clifton wrote:
> Hi Richard,
> 
>>>>    So for example without the option being enabled, disassembling
>>>>    non-code sections might produce results like this:
>>>>
>>>>      000000000041fdd8 <__frame_dummy_init_array_entry>:
>>>>        41fdd8:    00400764     .inst    0x00400764 ; undefined
>>>>        41fddc:    00000000     udf    #0
>>>>
>>>>    Whereas with the option enabled this changes to:
>>>>         000000000041fdd8 <__frame_dummy_init_array_entry>:
>>>>        41fdd8:    00400764     .inst    0x00400764 ; [frame_dummy]
>>>>        41fddc:    00000000     udf    #0
> 
>>> This is what mapping symbols are supposed to address.  If the user writes '.word' in a code section then the value will be tagged with $d and the output should then disassemble as data.  '.inst' means 'this is an instruction'.
> 
> True.
> 
>> For example:
>>
>>          .text
>>          .inst 0x12345678
>>          .word 0x12345678
>>
>> gives:
>>
>>   objdump -d test.o
>>
>> test.o:     file format elf64-littleaarch64
>>
>>
>> Disassembly of section .text:
>>
>> 0000000000000000 <.text>:
>>     0:   12345678        and     w24, w19, #0xfffff003
>>     4:   12345678        .word   0x12345678
>>
>> Maybe .word should be annotated with a suitable label, but I don't think .inst should.
> 
> 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.  Though I suspect you'll need to look at 64-bit quantities on a 64-bit machine.  32-bit values aren't addresses.

R.

> Cheers
>   Nick
> 
> 



More information about the Binutils mailing list