PATCH: Add -mandroid support on Linux/i386

Joseph S. Myers joseph@codesourcery.com
Fri Dec 16 23:05:00 GMT 2011


On Wed, 14 Dec 2011, H.J. Lu wrote:

> Hi,
> 
> This patch adds -mandroid support on Linux/i386, similar to Linux/ARM.
> OK for trunk in stage 1?

This does not appear to be a patch against current trunk, but against a 
much older version.

> diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h
> index 3a23598..9918036 100644
> --- a/gcc/config/i386/linux.h
> +++ b/gcc/config/i386/linux.h
> @@ -79,8 +79,15 @@ along with GCC; see the file COPYING3.  If not see
>  #undef CPP_SPEC
>  #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"

config/i386/linux.h is almost empty; it only defines things that 
definitely vary between different kernels that may be used with GNU 
userspace.  Most of the contents currently go in gnu-user.h because they 
are equally applicable with HURD, GNU/kFreeBSD etc.

> +#define LINUX_TARGET_CC1_SPEC "%(cc1_cpu) %{profile:-p}"

> -#undef	LINK_SPEC
> -#define LINK_SPEC "-m %(link_emulation) %{shared:-shared} \
> +#define LINUX_TARGET_LINK_SPEC \

For various such definitions you probably want to define GNU_USER_TARGET_* 
in gnu-user.h; define the underlying macro such as LINK_SPEC in gnu-user.h 
to be GNU_USER_TARGET_LINK_SPEC etc.; then undefine and redefine LINK_SPEC 
in linux.h to add Android support.

-- 
Joseph S. Myers
joseph@codesourcery.com



More information about the Gcc-patches mailing list