On Thursday, November 19th, 2026 at 13:36, segaloco <[email protected]>
wrote:
> Hello, I'm finding that there seems to be inconsistency in the numeric
> base that constants are emitted in from M68K objdump, in particular the
> address register indirect with index mode (110) appears to emit the
> displacement as a hexadecimal number (without 0x qualifier) where other
> values are emitted in decimal.
>
I've got a patch for this now:
> --- binutils.old/opcodes/m68k-dis.c 2026-11-19 18:56:23.916047495 -0800
> +++ binutils/opcodes/m68k-dis.c 2026-11-19 18:56:52.626306724 -0800
> @@ -525,7 +525,7 @@
> "%s", reg_names[regno]);
> (*info->fprintf_styled_func) (info->stream, dis_style_text, "@(");
> (*info->fprintf_styled_func) (info->stream, dis_style_immediate,
> - "%" PRIx64, (uint64_t) disp);
> + "%" PRIu64, (uint64_t) disp);
> }
> }
>
> @@ -638,7 +638,7 @@
> (*info->fprintf_styled_func) (info->stream, dis_style_text,
> ")@(");
> (*info->fprintf_styled_func) (info->stream, dis_style_address_offset,
> - "%" PRIx64, (uint64_t) outer_disp);
> + "%" PRIu64, (uint64_t) outer_disp);
> if (print_index)
> {
> (*info->fprintf_styled_func) (info->stream, dis_style_text, ",");
>
With this, I then get the expected decimal offsets. It looks like this
was changed from sprintf_vma back in 2.40, but I pulled 2.39 and it
similarly printed an undecorated hexadecimal number. Given the change
from 2.39 to 2.40 preserved this behavior, I'd be wary of folks who may
have grown to depend on this behavior long term. Needless to say it
seems to have been around for a while.
- Matt G.