Patchwork [google/gcc-4_7] Fix regression - SUBTARGET_EXTRA_SPECS overridden by LINUX_GRTE_EXTRA_SPECS

login
register
mail settings
Submitter Han Shen
Date Aug. 13, 2012, 5:58 p.m.
Message ID <CACkGtrj21FfQJYNnW9jskJu0Uiy6w1EZyhgdxgp1gyeQi36ZEw@mail.gmail.com>
Download mbox | patch
Permalink /patch/177014/
State New
Headers show

Comments

Han Shen - Aug. 13, 2012, 5:58 p.m.
Hi, the google/gcc-4_7 fails to linking anything (on x86-generic), by
looking into specs file, it seems that 'link_emulation' section is
missing in specs.

The problem is in config/i386/linux.h, SUBTARGET_EXTRA_SPECS (which is
not empty for chrome x86-generic) is overridden by
"LINUX_GRTE_EXTRA_SPECS".

My fix is to prepend LINUX_GRTE_EXTRA_SPECS to SUBTARGET_EXTRA_SPECS in linux.h

Jing, could you take a look at this?

--
Han Shen

2012-08-13 Han Shen  <shenhan@google.com>
    * gcc/config/i386/gnu-user.h (SUBTARGET_EXTRA_SPECS): Compute
    new value of LINUX_GRTE_EXTRA_SPECS by pre-pending LINUX_GRTE_EXTRA_SPECS
    to its origin value.
    * gcc/config/i386/gnu-user.h (SUBTARGET_EXTRA_SPECS_STR): Add
    new MACRO to hold value of SUBTARET_EXTRA_SPECS so that
    SUBTARET_EXTRA_SPECS could be replaced later in gnu-user.h
Han Shen - Aug. 15, 2012, 10:11 p.m.
Hi Jing, ping?

On Mon, Aug 13, 2012 at 10:58 AM, Han Shen(沈涵) <shenhan@google.com> wrote:
> Hi, the google/gcc-4_7 fails to linking anything (on x86-generic), by
> looking into specs file, it seems that 'link_emulation' section is
> missing in specs.
>
> The problem is in config/i386/linux.h, SUBTARGET_EXTRA_SPECS (which is
> not empty for chrome x86-generic) is overridden by
> "LINUX_GRTE_EXTRA_SPECS".
>
> My fix is to prepend LINUX_GRTE_EXTRA_SPECS to SUBTARGET_EXTRA_SPECS in linux.h
>
> Jing, could you take a look at this?
>
> --
> Han Shen
>
> 2012-08-13 Han Shen  <shenhan@google.com>
>     * gcc/config/i386/gnu-user.h (SUBTARGET_EXTRA_SPECS): Compute
>     new value of LINUX_GRTE_EXTRA_SPECS by pre-pending LINUX_GRTE_EXTRA_SPECS
>     to its origin value.
>     * gcc/config/i386/gnu-user.h (SUBTARGET_EXTRA_SPECS_STR): Add
>     new MACRO to hold value of SUBTARET_EXTRA_SPECS so that
>     SUBTARET_EXTRA_SPECS could be replaced later in gnu-user.h
>
> --- a/gcc/config/i386/gnu-user.h
> +++ b/gcc/config/i386/gnu-user.h
> @@ -92,11 +92,14 @@ along with GCC; see the file COPYING3.  If not see
>  #define ASM_SPEC \
>    "--32 %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}}"
>
> -#undef  SUBTARGET_EXTRA_SPECS
> -#define SUBTARGET_EXTRA_SPECS \
> +#undef  SUBTARGET_EXTRA_SPECS_STR
> +#define SUBTARGET_EXTRA_SPECS_STR \
>    { "link_emulation", GNU_USER_LINK_EMULATION },\
>    { "dynamic_linker", GNU_USER_DYNAMIC_LINKER }
>
> +#undef  SUBTARGET_EXTRA_SPECS
> +#define SUBTARGET_EXTRA_SPECS SUBTARGET_EXTRA_SPECS_STR
> +
>  #undef LINK_SPEC
>  #define LINK_SPEC "-m %(link_emulation) %{shared:-shared} \
>    %{!shared: \
> --- a/gcc/config/i386/linux.h
> +++ b/gcc/config/i386/linux.h
> @@ -32,5 +32,11 @@ along with GCC; see the file COPYING3.  If not see
>  #endif
>
>  #undef  SUBTARGET_EXTRA_SPECS
> +#ifndef SUBTARGET_EXTRA_SPECS_STR
>  #define SUBTARGET_EXTRA_SPECS \
>    LINUX_GRTE_EXTRA_SPECS
> +#else
> +#define SUBTARGET_EXTRA_SPECS \
> +  LINUX_GRTE_EXTRA_SPECS \
> +  SUBTARGET_EXTRA_SPECS_STR
> +#endif
Han Shen - Aug. 21, 2012, 3:49 p.m.
Hi Jing, the crosstool test passed. You can start the review, thanks! -Han

On Wed, Aug 15, 2012 at 3:11 PM, Han Shen(沈涵) <shenhan@google.com> wrote:
> Hi Jing, ping?
>
> On Mon, Aug 13, 2012 at 10:58 AM, Han Shen(沈涵) <shenhan@google.com> wrote:
>> Hi, the google/gcc-4_7 fails to linking anything (on x86-generic), by
>> looking into specs file, it seems that 'link_emulation' section is
>> missing in specs.
>>
>> The problem is in config/i386/linux.h, SUBTARGET_EXTRA_SPECS (which is
>> not empty for chrome x86-generic) is overridden by
>> "LINUX_GRTE_EXTRA_SPECS".
>>
>> My fix is to prepend LINUX_GRTE_EXTRA_SPECS to SUBTARGET_EXTRA_SPECS in linux.h
>>
>> Jing, could you take a look at this?
>>
>> --
>> Han Shen
>>
>> 2012-08-13 Han Shen  <shenhan@google.com>
>>     * gcc/config/i386/gnu-user.h (SUBTARGET_EXTRA_SPECS): Compute
>>     new value of LINUX_GRTE_EXTRA_SPECS by pre-pending LINUX_GRTE_EXTRA_SPECS
>>     to its origin value.
>>     * gcc/config/i386/gnu-user.h (SUBTARGET_EXTRA_SPECS_STR): Add
>>     new MACRO to hold value of SUBTARET_EXTRA_SPECS so that
>>     SUBTARET_EXTRA_SPECS could be replaced later in gnu-user.h
>>
>> --- a/gcc/config/i386/gnu-user.h
>> +++ b/gcc/config/i386/gnu-user.h
>> @@ -92,11 +92,14 @@ along with GCC; see the file COPYING3.  If not see
>>  #define ASM_SPEC \
>>    "--32 %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}}"
>>
>> -#undef  SUBTARGET_EXTRA_SPECS
>> -#define SUBTARGET_EXTRA_SPECS \
>> +#undef  SUBTARGET_EXTRA_SPECS_STR
>> +#define SUBTARGET_EXTRA_SPECS_STR \
>>    { "link_emulation", GNU_USER_LINK_EMULATION },\
>>    { "dynamic_linker", GNU_USER_DYNAMIC_LINKER }
>>
>> +#undef  SUBTARGET_EXTRA_SPECS
>> +#define SUBTARGET_EXTRA_SPECS SUBTARGET_EXTRA_SPECS_STR
>> +
>>  #undef LINK_SPEC
>>  #define LINK_SPEC "-m %(link_emulation) %{shared:-shared} \
>>    %{!shared: \
>> --- a/gcc/config/i386/linux.h
>> +++ b/gcc/config/i386/linux.h
>> @@ -32,5 +32,11 @@ along with GCC; see the file COPYING3.  If not see
>>  #endif
>>
>>  #undef  SUBTARGET_EXTRA_SPECS
>> +#ifndef SUBTARGET_EXTRA_SPECS_STR
>>  #define SUBTARGET_EXTRA_SPECS \
>>    LINUX_GRTE_EXTRA_SPECS
>> +#else
>> +#define SUBTARGET_EXTRA_SPECS \
>> +  LINUX_GRTE_EXTRA_SPECS \
>> +  SUBTARGET_EXTRA_SPECS_STR
>> +#endif
>
>
>
> --
> Han Shen |  Software Engineer |  shenhan@google.com |  +1-650-440-3330

Patch

--- a/gcc/config/i386/gnu-user.h
+++ b/gcc/config/i386/gnu-user.h
@@ -92,11 +92,14 @@  along with GCC; see the file COPYING3.  If not see
 #define ASM_SPEC \
   "--32 %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}}"

-#undef  SUBTARGET_EXTRA_SPECS
-#define SUBTARGET_EXTRA_SPECS \
+#undef  SUBTARGET_EXTRA_SPECS_STR
+#define SUBTARGET_EXTRA_SPECS_STR \
   { "link_emulation", GNU_USER_LINK_EMULATION },\
   { "dynamic_linker", GNU_USER_DYNAMIC_LINKER }

+#undef  SUBTARGET_EXTRA_SPECS
+#define SUBTARGET_EXTRA_SPECS SUBTARGET_EXTRA_SPECS_STR
+
 #undef	LINK_SPEC
 #define LINK_SPEC "-m %(link_emulation) %{shared:-shared} \
   %{!shared: \
--- a/gcc/config/i386/linux.h
+++ b/gcc/config/i386/linux.h
@@ -32,5 +32,11 @@  along with GCC; see the file COPYING3.  If not see
 #endif

 #undef  SUBTARGET_EXTRA_SPECS
+#ifndef SUBTARGET_EXTRA_SPECS_STR
 #define SUBTARGET_EXTRA_SPECS \
   LINUX_GRTE_EXTRA_SPECS
+#else
+#define SUBTARGET_EXTRA_SPECS \
+  LINUX_GRTE_EXTRA_SPECS \
+  SUBTARGET_EXTRA_SPECS_STR
+#endif