RFC: Annotate immediates in x86 disassembly
Jan Beulich
jbeulich@suse.com
Fri May 8 12:27:21 GMT 2026
On 08.05.2026 12:56, Jan Beulich wrote:
> On 07.05.2026 15:24, Nick Clifton wrote:
>> Attached is a patch to x86 disassembler to make it use the new
>> comment buffer framework for printing addresses. I am not sure
>> if you will like it however... :-)
>
> Good guess. First and foremost I can't help the impression that is this
> tailored to objdump, but won't interact very well with gdb.
>
>> There are three FIXME comments in the patch which point out issues
>> that probably ought to be fixed. I did not do that as I wanted to
>> keep the patch simple, and because they would involve more work than I
>> was willing to put in. At least for a first draft of the patch.
>>
>> Anyway please take a look when you have the time and let me know what
>> you think.
>
> I think I'd like to do this quite a bit differently.
While doing this, I came to wonder: Is it really a good idea to include
this for shared libraries? They're commonly linked to address 0, and
hence relatively low numbers will (often bogusly) resolve to addresses.
Shared libraries ought to have (base) relocations for anything that's
an address, so there ought to be better ways to report the symbolic
targets. Same for PIE, really.
Further, quite a few insns have immediates which surely aren't addresses.
8- and often 16-bit ones, or the 32-bit ones used by the recently added
MSR-IMM and USER-MSR insns. Imo we'd better avoid the address lookup in
such cases.
Jan
More information about the Binutils
mailing list