MIPS Android patch

Richard Sandiford rdsandiford@googlemail.com
Fri Apr 20 07:58:00 GMT 2012


"Fu, Chao-Ying" <fu@mips.com> writes:
> Index: gcc/config/mips/gnu-user.h
> ===================================================================
> --- gcc/config/mips/gnu-user.h	(revision 186580)
> +++ gcc/config/mips/gnu-user.h	(working copy)
> @@ -45,8 +45,10 @@
>  /* A standard GNU/Linux mapping.  On most targets, it is included in
>     CC1_SPEC itself by config/linux.h, but mips.h overrides CC1_SPEC
>     and provides this hook instead.  */
> +#undef GNU_USER_SUBTARGET_CC1_SPEC
> +#define GNU_USER_SUBTARGET_CC1_SPEC "%{profile:-p}"

This is the default GNU_USER_TARGET_CC1_SPEC, so let's remove these
two lines and use GNU_USER_TARGET_CC1_SPEC...

> -#define SUBTARGET_CC1_SPEC "%{profile:-p}"
> +#define SUBTARGET_CC1_SPEC GNU_USER_SUBTARGET_CC1_SPEC

...here.

> @@ -89,12 +93,14 @@
>  #undef ASM_OUTPUT_REG_PUSH
>  #undef ASM_OUTPUT_REG_POP
>  
> -#undef LIB_SPEC
> -#define LIB_SPEC "\
> +#undef GNU_USER_TARGET_LIB_SPEC
> +#define GNU_USER_TARGET_LIB_SPEC "\
>  %{pthread:-lpthread} \
>  %{shared:-lc} \
>  %{!shared: \
>    %{profile:-lc_p} %{!profile:-lc}}"

This is the default GNU_USER_TARGET_LIB_SPEC, except that the default
one has an -mieee-fp rule that would be unnecessary but harmless on MIPS.
Let's remove this definition entirely and just have:

> +#undef LIB_SPEC
> +#define LIB_SPEC GNU_USER_TARGET_LIB_SPEC

...this bit.

> @@ -133,7 +139,10 @@
>    LINUX_DRIVER_SELF_SPECS
>  
>  /* Similar to standard Linux, but adding -ffast-math support.  */
> +#undef	GNU_USER_TARGET_MATHFILE_SPEC
> +#define GNU_USER_TARGET_MATHFILE_SPEC \
> +  "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}"
>  #undef  ENDFILE_SPEC
>  #define ENDFILE_SPEC \
> -  "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
> -   %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
> +  GNU_USER_TARGET_MATHFILE_SPEC " " \
> +  GNU_USER_TARGET_ENDFILE_SPEC

Nice reuse of GNU_USER_TARGET_ENDFILE_SPEC.  More cut-&-paste gone. :-)

> Index: gcc/config/mips/gnu-user64.h
> ===================================================================
> --- gcc/config/mips/gnu-user64.h	(revision 186580)
> +++ gcc/config/mips/gnu-user64.h	(working copy)
> @@ -27,15 +27,17 @@
>    " %{!EB:%{!EL:%(endian_spec)}}" \
>    " %{!mabi=*: -" MULTILIB_ABI_DEFAULT "}"
>  
> -#undef LIB_SPEC
> -#define LIB_SPEC "\
> +#undef GNU_USER_TARGET_LIB_SPEC
> +#define GNU_USER_TARGET_LIB_SPEC "\
>  %{pthread:-lpthread} \
>  %{shared:-lc} \
>  %{!shared: \
>    %{profile:-lc_p} %{!profile:-lc}}"

gnu-user64.h has to be included after gnu-user.h, so it looks like
this code was already redundant before your patch.  Let's just remove it.

The config/mips parts are OK from my POV with those changes.  And with
those changes this is a nice cleanup in its own right, thanks.

Richard



More information about the Gcc-patches mailing list