[PATCH RFA] small fix to MIPS abi selection/decoding.

Thiemo Seufer ica2_ts@csv.ica.uni-stuttgart.de
Sun Mar 10 06:02:00 GMT 2002


cgd@broadcom.com wrote:
[snip]
> Index: gas/config/tc-mips.c
> ===================================================================
> RCS file: /cvs/src/src/gas/config/tc-mips.c,v
> retrieving revision 1.112
> diff -u -p -r1.112 tc-mips.c
> --- tc-mips.c	2002/02/26 22:18:51	1.112
> +++ tc-mips.c	2002/03/09 19:55:02
> @@ -1098,9 +1098,9 @@ md_begin ()
>        /* Default mips_abi.  */
>        if (mips_opts.abi == NO_ABI)
>  	{
> -	  if (mips_opts.isa == ISA_MIPS1 || mips_opts.isa == ISA_MIPS2)
> +	  if (! ISA_HAS_64BIT_REGS (mips_opts.isa))
>  	    mips_opts.abi = O32_ABI;
> -	  else if (mips_opts.isa == ISA_MIPS3 || mips_opts.isa == ISA_MIPS4)
> +	  else
>  	    mips_opts.abi = O64_ABI;

Please don't do this. As Daniel already explained, it's for gcc backward
compatibility where -mips2 was used meaning "create o32 objects for a
64bit capable processor". It shouldn't be expanded more than absolutely
needed.

>  	}
>      }
> Index: opcodes/mips-dis.c
> ===================================================================
> RCS file: /cvs/src/src/opcodes/mips-dis.c,v
> retrieving revision 1.24
> diff -u -p -r1.24 mips-dis.c
> --- mips-dis.c	2001/11/05 03:07:51	1.24
> +++ mips-dis.c	2002/03/09 19:55:07
> @@ -397,10 +397,11 @@ static int
>  is_newabi (header)
>       Elf_Internal_Ehdr *header;
>  {
> -  if ((header->e_flags
> -       & (E_MIPS_ABI_EABI32 | E_MIPS_ABI_EABI64 | EF_MIPS_ABI2)) != 0
> +  if ((header->e_flags & EF_MIPS_ABI2) != 0
> +      || (header->e_flags & EF_MIPS_ABI) == E_MIPS_ABI_EABI32
> +      || (header->e_flags & EF_MIPS_ABI) == E_MIPS_ABI_EABI64
>        || (header->e_ident[EI_CLASS] == ELFCLASS64
> -	  && (header->e_flags & E_MIPS_ABI_O64) == 0))
> +	  && (header->e_flags & EF_MIPS_ABI) != E_MIPS_ABI_O64))

o64 is ELFCLASS32. AFAICS the test for ELFCLASS64 should be the first
(and unconditional). Otherwise it looks ok.


Thiemo



More information about the Binutils mailing list