[google/main] Fix regression - SUBTARGET_EXTRA_SPECS overridden by LINUX_GRTE_EXTRA_SPECS
Hi, the google/gcc-main fails to linking anything (on x86-generic chromeos). 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 This fix was submitted to google/gcc-4_7 and had gone thorough tests for past weeks. Tested by crosstool-validate.py --crosstool_ver=v16 --gcc_dir=`pwd` --testers=crosstool Jing, could you take a look at this? -- Han Shen 2012-09-13 Han Shen shen...@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 diff --git a/gcc/config/i386/gnu-user.h b/gcc/config/i386/gnu-user.h index 98d0a25..ba120b8 100644 --- a/gcc/config/i386/gnu-user.h +++ b/gcc/config/i386/gnu-user.h @@ -92,10 +92,12 @@ 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} \ diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h index ade524c..61d5c68 100644 --- 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
Re: [google/google-main] Fix regression - SUBTARGET_EXTRA_SPECS overridden by LINUX_GRTE_EXTRA_SPECS (issue 6016047)
Hi Jing, thanks! The SUBTARGET_EXTRA_SPECS is defined in config/i386/gnu-user.h In linux.h, the original value of SUBTARGET_EXTRA_SPECS is overwritten by LINUX_GRTE_EXTRA_SPECS, which is not right! Instead, SUBTARGET_EXTRA_SPECS and LINUX_GRTE_EXTRA_SPECS must be concatenated. For every target, SUBTARET_EXTRA_SPECS has its own value, for example, for darwin, darwin.h just redefines SUBTARGET_EXTRA_SPECS, so the patch does not affect targets other than i386. Regards, -Han On Tue, May 15, 2012 at 3:26 PM, jin...@google.com wrote: I suspect this patch would change specs of non-i386 platform. For example, LINUX_GRTE_EXTRA_SPECS is not part of SUBTARGET_EXTRA_SPECS for darwin. Can you tell where SUBTARGET_EXTRA_SPECS is firstly defined for chromeos toolchain? On 2012/05/14 18:32:17, shenhan wrote: On 2012/04/12 21:14:29, shenhan wrote: Hi, the newest chrome gcc (from google-main) fails to linking anything, by looking into specs file, it seems that 'link_emulation' section is missing in specs. The problem I found is that SUBTARGET_EXTRA_SPECS, which is not empty for chromeos, is overridden by LINUX_GRTE_EXTRA_SPECS. Please review the proposed a patch. (Tested by buildit bootstrap). -Han Hi Jing and Rong, could you take a look at this? Thanks, -Han http://codereview.appspot.com/6016047/ -- Han Shen | Software Engineer | shen...@google.com | +1-650-440-3330
Re: [google/google-main] Fix regression - SUBTARGET_EXTRA_SPECS overridden by LINUX_GRTE_EXTRA_SPECS (issue 6016047)
I suspect this patch would change specs of non-i386 platform. For example, LINUX_GRTE_EXTRA_SPECS is not part of SUBTARGET_EXTRA_SPECS for darwin. Can you tell where SUBTARGET_EXTRA_SPECS is firstly defined for chromeos toolchain? On 2012/05/14 18:32:17, shenhan wrote: On 2012/04/12 21:14:29, shenhan wrote: Hi, the newest chrome gcc (from google-main) fails to linking anything, by looking into specs file, it seems that 'link_emulation' section is missing in specs. The problem I found is that SUBTARGET_EXTRA_SPECS, which is not empty for chromeos, is overridden by LINUX_GRTE_EXTRA_SPECS. Please review the proposed a patch. (Tested by buildit bootstrap). -Han Hi Jing and Rong, could you take a look at this? Thanks, -Han http://codereview.appspot.com/6016047/
Re: [google/google-main] Fix regression - SUBTARGET_EXTRA_SPECS overridden by LINUX_GRTE_EXTRA_SPECS (issue 6016047)
On 2012/04/12 21:14:29, shenhan wrote: Hi, the newest chrome gcc (from google-main) fails to linking anything, by looking into specs file, it seems that 'link_emulation' section is missing in specs. The problem I found is that SUBTARGET_EXTRA_SPECS, which is not empty for chromeos, is overridden by LINUX_GRTE_EXTRA_SPECS. Please review the proposed a patch. (Tested by buildit bootstrap). -Han Hi Jing and Rong, could you take a look at this? Thanks, -Han http://codereview.appspot.com/6016047/
[google/google-main] Fix regression - SUBTARGET_EXTRA_SPECS overridden by LINUX_GRTE_EXTRA_SPECS (issue 6016047)
Reviewers: asharif1, jingyu, Diego Novillo, Message: Hi, the newest chrome gcc (from google-main) fails to linking anything, by looking into specs file, it seems that 'link_emulation' section is missing in specs. The problem I found is that SUBTARGET_EXTRA_SPECS, which is not empty for chromeos, is overridden by LINUX_GRTE_EXTRA_SPECS. Please review the proposed a patch. (Tested by buildit bootstrap). -Han Description: In linux.h, macro SUBTARGET_EXTRA_SPECS is overridden by LINUX_GRTE_EXTRA_SPECS, so the origin content of SUBTARGET_EXTRA_SPECS never gets written into gcc spec, which causes linking failure for chrome gcc. Please review this at http://codereview.appspot.com/6016047/ Affected files: M gcc/config/i386/i386.h M gcc/config/i386/linux.h Index: gcc/config/i386/i386.h diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 7721c46..29fdd0b 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -621,8 +621,9 @@ enum target_cpu_default #endif #define EXTRA_SPECS\ - { cc1_cpu, CC1_CPU_SPEC }, \ - SUBTARGET_EXTRA_SPECS + { cc1_cpu, CC1_CPU_SPEC }, \ +LINUX_GRTE_EXTRA_SPECS \ +SUBTARGET_EXTRA_SPECS /* Set the value of FLT_EVAL_METHOD in float.h. When using only the Index: gcc/config/i386/linux.h diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h index ade524c..383dedf 100644 --- a/gcc/config/i386/linux.h +++ b/gcc/config/i386/linux.h @@ -30,7 +30,3 @@ along with GCC; see the file COPYING3. If not see #ifndef LINUX_GRTE_EXTRA_SPECS #define LINUX_GRTE_EXTRA_SPECS #endif - -#undef SUBTARGET_EXTRA_SPECS -#define SUBTARGET_EXTRA_SPECS \ - LINUX_GRTE_EXTRA_SPECS