> You should keep those *_SPEC and define them with new
> GNU_*_SPEC in gnu-user.h since gnu-user.h is also used
> by other non-linux targets.  In linux.h, you undef *_SPEC
> before defining them.
>
>
> --
> H.J.

Thanks for the note. Here is fixed version. Is it OK now?

Thanks,
Ilya
--
2012-02-27  Enkovich Ilya  <ilya.enkov...@intel.com>

        * gcc/config/i386/gnu-user.h (GNU_USER_TARGET_CC1_SPEC): New.
        (CC1_SPEC): Use GNU_USER_TARGET_CC1_SPEC.
        (GNU_USER_TARGET_LINK_SPEC): New.
        (LINK_SPEC): Use GNU_USER_TARGET_LINK_SPEC.
        (GNU_USER_TARGET_MATHFILE_SPEC): New.
        (ENDFILE_SPEC): Use GNU_USER_TARGET_MATHFILE_SPEC.

        * gcc/config/i386/linux.h (CC1_SPEC): New.
        (LINK_SPEC): New.
        (LIB_SPEC): New.
        (STARTFILE_SPEC): New.
        (ENDFILE_SPEC): New.


diff --git a/gcc/config/i386/gnu-user.h b/gcc/config/i386/gnu-user.h
index 98d0a25..33ceab7 100644
--- a/gcc/config/i386/gnu-user.h
+++ b/gcc/config/i386/gnu-user.h
@@ -77,8 +77,11 @@ along with GCC; see the file COPYING3.  If not see
 #undef CPP_SPEC
 #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"

+#undef GNU_USER_TARGET_CC1_SPEC
+#define GNU_USER_TARGET_CC1_SPEC "%(cc1_cpu) %{profile:-p}"
+
 #undef CC1_SPEC
-#define CC1_SPEC "%(cc1_cpu) %{profile:-p}"
+#define CC1_SPEC GNU_USER_TARGET_CC1_SPEC

 /* Provide a LINK_SPEC appropriate for GNU userspace.  Here we provide support
    for the special GCC options -static and -shared, which allow us to
@@ -97,22 +100,28 @@ along with GCC; see the file COPYING3.  If not see
   { "link_emulation", GNU_USER_LINK_EMULATION },\
   { "dynamic_linker", GNU_USER_DYNAMIC_LINKER }

-#undef LINK_SPEC
-#define LINK_SPEC "-m %(link_emulation) %{shared:-shared} \
+#define GNU_USER_TARGET_LINK_SPEC \
+  "-m %(link_emulation) %{shared:-shared} \
   %{!shared: \
     %{!static: \
       %{rdynamic:-export-dynamic} \
       -dynamic-linker %(dynamic_linker)} \
       %{static:-static}}"

+#undef LINK_SPEC
+#define LINK_SPEC GNU_USER_TARGET_LINK_SPEC
+
 /* Similar to standard GNU userspace, but adding -ffast-math support.  */
-#undef  ENDFILE_SPEC
-#define ENDFILE_SPEC \
+#define GNU_USER_TARGET_MATHFILE_SPEC \
   "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
    %{mpc32:crtprec32.o%s} \
    %{mpc64:crtprec64.o%s} \
-   %{mpc80:crtprec80.o%s} \
-   %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
+   %{mpc80:crtprec80.o%s}"
+
+#undef  ENDFILE_SPEC
+#define ENDFILE_SPEC \
+  GNU_USER_TARGET_MATHFILE_SPEC " " \
+  GNU_USER_TARGET_ENDFILE_SPEC

 /* A C statement (sans semicolon) to output to the stdio stream
    FILE the assembler definition of uninitialized global DECL named
diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h
index 73681fe..a832ddc 100644
--- a/gcc/config/i386/linux.h
+++ b/gcc/config/i386/linux.h
@@ -22,3 +22,30 @@ along with GCC; see the file COPYING3.  If not see

 #define GNU_USER_LINK_EMULATION "elf_i386"
 #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
+
+#undef CC1_SPEC
+#define CC1_SPEC \
+  LINUX_OR_ANDROID_CC (GNU_USER_TARGET_CC1_SPEC, \
+                      GNU_USER_TARGET_CC1_SPEC " " ANDROID_CC1_SPEC)
+
+#undef LINK_SPEC
+#define LINK_SPEC \
+  LINUX_OR_ANDROID_LD (GNU_USER_TARGET_LINK_SPEC, \
+                      GNU_USER_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC)
+
+#undef  LIB_SPEC
+#define LIB_SPEC \
+  LINUX_OR_ANDROID_LD (GNU_USER_TARGET_LIB_SPEC, \
+                      GNU_USER_TARGET_LIB_SPEC " " ANDROID_LIB_SPEC)
+
+#undef  STARTFILE_SPEC
+#define STARTFILE_SPEC \
+  LINUX_OR_ANDROID_LD (GNU_USER_TARGET_STARTFILE_SPEC, \
+                      ANDROID_STARTFILE_SPEC)
+
+#undef  ENDFILE_SPEC
+#define ENDFILE_SPEC \
+  LINUX_OR_ANDROID_LD (GNU_USER_TARGET_MATHFILE_SPEC " " \
+                      GNU_USER_TARGET_ENDFILE_SPEC,     \
+                      GNU_USER_TARGET_MATHFILE_SPEC " " \
+                      ANDROID_ENDFILE_SPEC)

Reply via email to