Home | History | Annotate | Download | only in gcc
      1 From a8b43ba3fb0007f0e62365a33953bab0e989366a Mon Sep 17 00:00:00 2001
      2 From: Mark D Horn <mark.d.horn (a] intel.com>
      3 Date: Fri, 20 Apr 2012 17:32:57 +0200
      4 Subject: Enable x86 gcc defaults
      5 
      6 Enabling the same built-in defaults for the x86
      7 toolchain as is currently done for ARM.
      8 
      9 Change-Id: I1118569246c70496ae8e0971036916286321274c
     10 ---
     11  gcc-4.4.3/gcc/config.gcc              |    4 +-
     12  gcc-4.4.3/gcc/config/arm/linux-eabi.h |    2 +-
     13  gcc-4.4.3/gcc/config/i386/linux.h     |   38 +++++++++++++++++++++++++++-----
     14  gcc-4.4.3/gcc/config/linux-android.h  |    4 +-
     15  4 files changed, 37 insertions(+), 11 deletions(-)
     16 
     17 diff --git a/gcc-4.4.3/gcc/config.gcc b/gcc-4.4.3/gcc/config.gcc
     18 index 321cf55..e758dc4 100644
     19 --- a/gcc-4.4.3/gcc/config.gcc
     20 +++ b/gcc-4.4.3/gcc/config.gcc
     21 @@ -515,7 +515,7 @@ case ${target} in
     22        tm_defines="$tm_defines OPTION_GLIBC=1";;
     23    esac
     24    case $target in
     25 -    *-*-*android*)
     26 +    *-*-*android* | *-android-linux-*)
     27        tm_defines="$tm_defines DEFAULT_LIBC=LIBC_BIONIC"
     28        ;;
     29      *-*-*uclibc*)
     30 @@ -538,7 +538,7 @@ case ${target} in
     31    esac
     32    # Enable compilation for Android by default for *android* targets.
     33    case $target in
     34 -    *-*-*android*)
     35 +    *-*-*android* | *-android-linux-*)
     36        tm_defines="$tm_defines ANDROID_DEFAULT=1"
     37        ;;
     38      *)
     39 diff --git a/gcc-4.4.3/gcc/config/arm/linux-eabi.h b/gcc-4.4.3/gcc/config/arm/linux-eabi.h
     40 index 2ca8818..b295423 100644
     41 --- a/gcc-4.4.3/gcc/config/arm/linux-eabi.h
     42 +++ b/gcc-4.4.3/gcc/config/arm/linux-eabi.h
     43 @@ -74,7 +74,7 @@
     44  #undef  CC1_SPEC
     45  #define CC1_SPEC                                               \
     46    LINUX_OR_ANDROID_CC (LINUX_TARGET_CC1_SPEC,                  \
     47 -                      LINUX_TARGET_CC1_SPEC " " ANDROID_CC1_SPEC)
     48 +                      LINUX_TARGET_CC1_SPEC " " ANDROID_CC1_SPEC("-fpic"))
     49  
     50  #define CC1PLUS_SPEC \
     51    LINUX_OR_ANDROID_CC ("", ANDROID_CC1PLUS_SPEC)
     52 diff --git a/gcc-4.4.3/gcc/config/i386/linux.h b/gcc-4.4.3/gcc/config/i386/linux.h
     53 index f3a98c2..bc2a5d5 100644
     54 --- a/gcc-4.4.3/gcc/config/i386/linux.h
     55 +++ b/gcc-4.4.3/gcc/config/i386/linux.h
     56 @@ -72,15 +72,36 @@ along with GCC; see the file COPYING3.  If not see
     57  #define TARGET_OS_CPP_BUILTINS()		\
     58    do						\
     59      {						\
     60 -	LINUX_TARGET_OS_CPP_BUILTINS();		\
     61 +	    LINUX_TARGET_OS_CPP_BUILTINS();		\
     62 +        ANDROID_TARGET_OS_CPP_BUILTINS();	\
     63      }						\
     64    while (0)
     65  
     66  #undef CPP_SPEC
     67  #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
     68  
     69 +#define OVERRIDE_LINUX_TARGET_CC1_SPEC "%(cc1_cpu) %{profile:-p}"
     70  #undef CC1_SPEC
     71 -#define CC1_SPEC "%(cc1_cpu) %{profile:-p}"
     72 +#define CC1_SPEC                                               \
     73 +  LINUX_OR_ANDROID_CC (OVERRIDE_LINUX_TARGET_CC1_SPEC,                  \
     74 +                       OVERRIDE_LINUX_TARGET_CC1_SPEC \
     75 +                       " -march=i686 -mtune=atom" \
     76 +                       " -mstackrealign -msse3 -mfpmath=sse" \
     77 +                       " -m32 -fno-short-enums" \
     78 +                       " " \
     79 +                       ANDROID_CC1_SPEC("-fPIC"))
     80 +
     81 +#define CC1PLUS_SPEC \
     82 +  LINUX_OR_ANDROID_CC ("", ANDROID_CC1PLUS_SPEC)
     83 +
     84 +#undef  LIB_SPEC
     85 +#define LIB_SPEC                                           \
     86 +  LINUX_OR_ANDROID_LD (LINUX_TARGET_LIB_SPEC,                  \
     87 +                      LINUX_TARGET_LIB_SPEC " " ANDROID_LIB_SPEC)
     88 +
     89 +#undef STARTFILE_SPEC
     90 +#define STARTFILE_SPEC \
     91 +  LINUX_OR_ANDROID_LD (LINUX_TARGET_STARTFILE_SPEC, ANDROID_STARTFILE_SPEC)
     92  
     93  /* Provide a LINK_SPEC appropriate for Linux.  Here we provide support
     94     for the special GCC options -static and -shared, which allow us to
     95 @@ -121,23 +142,28 @@ along with GCC; see the file COPYING3.  If not see
     96    { "link_emulation", LINK_EMULATION },\
     97    { "dynamic_linker", LINUX_DYNAMIC_LINKER }
     98  
     99 -#undef	LINK_SPEC
    100 -#define LINK_SPEC "-m %(link_emulation) %{shared:-shared} \
    101 +#define OVERRIDE_LINUX_TARGET_LINK_SPEC "-m %(link_emulation) %{shared:-shared} \
    102    %{!shared: \
    103      %{!ibcs: \
    104        %{!static: \
    105  	%{rdynamic:-export-dynamic} \
    106  	%{!dynamic-linker:-dynamic-linker %(dynamic_linker)}} \
    107  	%{static:-static}}}"
    108 +#undef	LINK_SPEC
    109 +#define LINK_SPEC                                              \
    110 +  LINUX_OR_ANDROID_LD (OVERRIDE_LINUX_TARGET_LINK_SPEC,                 \
    111 +                      OVERRIDE_LINUX_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC)
    112  
    113  /* Similar to standard Linux, but adding -ffast-math support.  */
    114 -#undef  ENDFILE_SPEC
    115 -#define ENDFILE_SPEC \
    116 +#define OVERRIDE_LINUX_TARGET_ENDFILE_SPEC \
    117    "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
    118     %{mpc32:crtprec32.o%s} \
    119     %{mpc64:crtprec64.o%s} \
    120     %{mpc80:crtprec80.o%s} \
    121     %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
    122 +#undef  ENDFILE_SPEC
    123 +#define ENDFILE_SPEC \
    124 +  LINUX_OR_ANDROID_LD (OVERRIDE_LINUX_TARGET_ENDFILE_SPEC, ANDROID_ENDFILE_SPEC)
    125  
    126  /* A C statement (sans semicolon) to output to the stdio stream
    127     FILE the assembler definition of uninitialized global DECL named
    128 diff --git a/gcc-4.4.3/gcc/config/linux-android.h b/gcc-4.4.3/gcc/config/linux-android.h
    129 index d938c22..1c8ee50 100644
    130 --- a/gcc-4.4.3/gcc/config/linux-android.h
    131 +++ b/gcc-4.4.3/gcc/config/linux-android.h
    132 @@ -41,9 +41,9 @@
    133  #define ANDROID_LINK_SPEC \
    134    "%{shared: -Bsymbolic}"
    135  
    136 -#define ANDROID_CC1_SPEC						\
    137 +#define ANDROID_CC1_SPEC(ANDROID_PIC_DEFAULT)   \
    138    "%{!mglibc:%{!muclibc:%{!mbionic: -mbionic}}} "			\
    139 -  "%{!fno-pic:%{!fno-PIC:%{!fpic:%{!fPIC: -fPIC}}}}"
    140 +  "%{!fno-pic:%{!fno-PIC:%{!fpic:%{!fPIC: " ANDROID_PIC_DEFAULT "}}}}"
    141  
    142  #define ANDROID_CC1PLUS_SPEC						\
    143    "%{!fexceptions:%{!fno-exceptions: -fexceptions}} "		\
    144 -- 
    145 1.7.6.rc0
    146 
    147