[PATCH] MIPS: allow link o32 objects with mach mips64r6 and mips32r6
Richard Sandiford
richard.sandiford@arm.com
Mon Feb 13 15:47:25 GMT 2023
Sorry for the slow reply.
YunQiang Su <yunqiang.su@cipunited.com> writes:
> The `-32 -mips32r6` and `-32 mips64r6` option of gnu as
> will generate objects with different mach attributes.
>
> 0x90001407, noreorder, pic, cpic, nan2008, o32, mips32r6
> vs
> 0xa0001507, noreorder, pic, cpic, 32bitmode, nan2008, o32, mips64r6
>
> Let's allow link them togather, just like we did for r2 ones.
>
> bfd/ChangeLog:
>
> * elfxx-mips.c (mips_mach_extends_p): allow link o32 objects
> with mach mips64r6 and mips32r6.
Looks good, but how about making this more systematic by applying
it to all mipsisa32 revisions? E.g. have a second array of
mips_mach_extension objects that gives the mipsisa32 base and corresponding
mipsisa64 "extension" (ok, maybe not really an accurate term in this case,
but good enough).
Thanks,
Richard
> ---
> bfd/elfxx-mips.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
> index e9fb61ff9e7..1790b78e822 100644
> --- a/bfd/elfxx-mips.c
> +++ b/bfd/elfxx-mips.c
> @@ -14600,6 +14600,10 @@ mips_mach_extends_p (unsigned long base, unsigned long extension)
> && mips_mach_extends_p (bfd_mach_mipsisa64r2, extension))
> return true;
>
> + if (base == bfd_mach_mipsisa32r6
> + && mips_mach_extends_p (bfd_mach_mipsisa64r6, extension))
> + return true;
> +
> for (i = 0; i < ARRAY_SIZE (mips_mach_extensions); i++)
> if (extension == mips_mach_extensions[i].extension)
> {
More information about the Binutils
mailing list