[PATCH v2 08/15] MIPS: Mask off lowest bit when disassembling compressed code.
Maciej W. Rozycki
macro@orcam.me.uk
Thu Oct 30 13:32:11 GMT 2025
On Wed, 29 Oct 2025, Jovan Dmitrovic via Binutils wrote:
> From: Simon Dardis <simon.dardis@imgtec.com>
>
> Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
Please explain in the commit description why this change is needed.
Also do you have a test case, does it happen in reality? And does this
change affect GDB?
> diff --git a/opcodes/mips-dis.c b/opcodes/mips-dis.c
> index 8ab2c736203..d246eef3917 100644
> --- a/opcodes/mips-dis.c
> +++ b/opcodes/mips-dis.c
> @@ -2305,7 +2305,7 @@ enum match_kind
> /* Disassemble mips16 instructions. */
>
> static int
> -print_insn_mips16 (bfd_vma memaddr, struct disassemble_info *info)
> +print_insn_mips16 (bfd_vma memaddr_base, struct disassemble_info *info)
> {
> const fprintf_styled_ftype infprintf = info->fprintf_styled_func;
> int status;
> @@ -2319,6 +2319,10 @@ print_insn_mips16 (bfd_vma memaddr, struct disassemble_info *info)
> unsigned int first;
> unsigned int full;
>
> + /* Some users of bfd may supply an address with the MIPS16 flag set,
> + e.g. objdump. MIPS16 instructions must be at least 2 byte aligned. */
> + bfd_vma memaddr = memaddr_base & ~1;
> +
Why a copy variable? I can't see any other use of `memaddr_base', so it
seems to me the adjustment can be done in place. Likewise in the other
part.
Maciej
More information about the Binutils
mailing list