On Fri, Mar 30, 2012 at 09:18:13AM -0700, H.J. Lu wrote:
> On Fri, Mar 30, 2012 at 8:11 AM, Rainer Orth
> <[email protected]> wrote:
> > Mike Stump <[email protected]> writes:
> >
> >>> Here is the new patch. OK for trunk if there are no regressions on
> >>> Linux/ia32 and Linux/x86-64?
> >>
> >> Too bad you didn't test 32-bit darwin, causes:
> >>
> >> http://gcc.gnu.org/PR52784
> >>
> >> Could you please revert or fix, thanks.
> >
> > Same problem on Solaris 10 and 11/x86.
> >
> > Rainer
> >
>
> When i[34567]86-*-* targets are configured with --enable-targets=all,
> TARGET_BI_ARCH is defined as 1, but TARGET_64BIT_DEFAULT
> isn't defined. It leads to
>
> if (!TARGET_64BIT)
> ix86_isa_flags &= ~(OPTION_MASK_ABI_64 | OPTION_MASK_ABI_X32);
>
> Since TARGET_64BIT is false by default, -m64 and -mx32 don't work
> correctly. This patch changes TARGET_BI_ARCH to 3 for
> i[34567]86-*-* targets configured with --enable-targets=all. Tested on
> Linux/ia32 with bootstrap and Linux/ia32 with --enable-targets=all
> --disable-bootstrap. Please try on other OSes.
H.J.,
This patch solves the bootstrap of current gcc trunk on
i386-apple-darwin10. Thanks.
Jack
>
> Thanks.
>
>
> --
> H.J.
> ---
> 2012-03-30 H.J. Lu <[email protected]>
>
> PR bootstrap/52784
> * config.gcc (tm_defines): Replace TARGET_BI_ARCH=1 with
> TARGET_BI_ARCH=3 for i[34567]86-*-* targets.
>
> * config/i386/i386.c (ix86_option_override_internal): Don't
> check OPTION_MASK_ABI_64 nor OPTION_MASK_ABI_X32 if
> TARGET_BI_ARCH isn't defined or TARGET_BI_ARCH == 3.
> 2012-03-30 H.J. Lu <[email protected]>
>
> PR bootstrap/52784
> * config.gcc (tm_defines): Replace TARGET_BI_ARCH=1 with
> TARGET_BI_ARCH=3 for i[34567]86-*-* targets.
>
> * config/i386/i386.c (ix86_option_override_internal): Don't
> check OPTION_MASK_ABI_64 nor OPTION_MASK_ABI_X32 if
> TARGET_BI_ARCH isn't defined or TARGET_BI_ARCH == 3.
>
> diff --git a/gcc/config.gcc b/gcc/config.gcc
> index c30bb24..d1e0480 100644
> --- a/gcc/config.gcc
> +++ b/gcc/config.gcc
> @@ -1208,7 +1208,7 @@ i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu |
> i[34567]86-*-knetbsd*-gnu | i
> default_gnu_indirect_function=yes
> if test x$enable_targets = xall; then
> tm_file="${tm_file} i386/x86-64.h i386/gnu-user64.h
> i386/linux64.h"
> - tm_defines="${tm_defines} TARGET_BI_ARCH=1"
> + tm_defines="${tm_defines} TARGET_BI_ARCH=3"
> tmake_file="${tmake_file} i386/t-linux64"
> x86_multilibs="${with_multilib_list}"
> if test "$x86_multilibs" = "default"; then
> @@ -1338,7 +1338,7 @@ i[34567]86-*-solaris2* | x86_64-*-solaris2.1[0-9]*)
> case ${target} in
> *-*-solaris2.1[0-9]*)
> tm_file="${tm_file} i386/x86-64.h i386/sol2-bi.h sol2-bi.h"
> - tm_defines="${tm_defines} TARGET_BI_ARCH=1"
> + tm_defines="${tm_defines} TARGET_BI_ARCH=3"
> tmake_file="$tmake_file i386/t-sol2-64"
> need_64bit_isa=yes
> case X"${with_cpu}" in
> @@ -1406,7 +1406,7 @@ i[34567]86-*-mingw* | x86_64-*-mingw*)
> user_headers_inc_next_pre="${user_headers_inc_next_pre}
> stddef.h stdarg.h"
> tm_file="${tm_file} i386/mingw-w64.h"
> if test x$enable_targets = xall; then
> - tm_defines="${tm_defines} TARGET_BI_ARCH=1"
> + tm_defines="${tm_defines} TARGET_BI_ARCH=3"
> case X"${with_cpu}" in
>
> Xgeneric|Xatom|Xcore2|Xcorei7|Xcorei7-avx|Xnocona|Xx86-64|Xbdver2|Xbdver1|Xbtver1|Xamdfam10|Xbarcelona|Xk8|Xopteron|Xathlon64|Xathlon-fx|Xathlon64-sse3|Xk8-sse3|Xopteron-sse3)
> ;;
> diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
> index 42746e4..62ed2c0 100644
> --- a/gcc/config/i386/i386.c
> +++ b/gcc/config/i386/i386.c
> @@ -3117,11 +3117,14 @@ ix86_option_override_internal (bool main_args_p)
> SUBSUBTARGET_OVERRIDE_OPTIONS;
> #endif
>
> - /* Turn off both OPTION_MASK_ABI_64 and OPTION_MASK_ABI_X32 if
> - TARGET_64BIT is false. */
> +#if defined TARGET_BI_ARCH && TARGET_BI_ARCH != 3
> + /* When TARGET_BI_ARCH isn't defined or TARGET_BI_ARCH == 3,
> + TARGET_64BIT is false by default and there is no need to check
> + OPTION_MASK_ABI_64 nor OPTION_MASK_ABI_X32. Turn off both
> + OPTION_MASK_ABI_64 and OPTION_MASK_ABI_X32 if TARGET_64BIT is
> + false. */
> if (!TARGET_64BIT)
> ix86_isa_flags &= ~(OPTION_MASK_ABI_64 | OPTION_MASK_ABI_X32);
> -#ifdef TARGET_BI_ARCH
> else
> {
> #if TARGET_BI_ARCH == 1