Message ID | 20151011130719.GF4434@bubble.grove.modra.org |
---|---|
State | New |
Headers | show |
Alan Modra <amodra@gmail.com> writes: > diff --git a/gcc/go/gospec.c b/gcc/go/gospec.c > index ca3c2d7..fbb55be 100644 > --- a/gcc/go/gospec.c > +++ b/gcc/go/gospec.c > @@ -120,8 +120,10 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, > /* Whether the -S option was used. */ > bool saw_opt_S = false; > > - /* Whether the -m32 option was used. */ > - bool saw_opt_m32 ATTRIBUTE_UNUSED = false; > +#ifdef TARGET_CAN_SPLIT_STACK_64BIT > + /* Whether the -m64 option is in force. */ > + bool is_m64 = TARGET_CAN_SPLIT_STACK_64BIT; > +#endif > > /* The first input file with an extension of .go. */ > const char *first_go_file = NULL; > @@ -160,7 +162,11 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, > > #ifdef TARGET_CAN_SPLIT_STACK_64BIT > case OPT_m32: > - saw_opt_m32 = true; > + is_m64 = false; > + break; > + > + case OPT_m64: > + is_m64 = true; > break; > #endif > > @@ -253,7 +259,7 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, > #endif > > #ifdef TARGET_CAN_SPLIT_STACK_64BIT > - if (!saw_opt_m32) > + if (is_m64) > supports_split_stack = 1; > #endif Please remind me why this logic isn't implemented as a target hook. supports_split_stack = TARGET_CAN_SPLIT_STACK; /* rs6000.h */ #define TARGET_CAN_SPLIT_STACK TARGET_64BIT Andreas.
On Sun, Oct 11, 2015 at 7:43 AM, Andreas Schwab <schwab@linux-m68k.org> wrote > > Please remind me why this logic isn't implemented as a target hook. > > supports_split_stack = TARGET_CAN_SPLIT_STACK; > > /* rs6000.h */ > #define TARGET_CAN_SPLIT_STACK TARGET_64BIT There is a target hook for split stack support in gcc/common/common-target.def. The PPC version of it is in gcc/common/config/rs6000/rs6000-common.c. But the issue here is that we need access from the gccgo driver program. Can the driver program call the common target hooks? Ian
On Sun, Oct 11, 2015 at 11:29:36AM -0700, Ian Lance Taylor wrote: > On Sun, Oct 11, 2015 at 7:43 AM, Andreas Schwab <schwab@linux-m68k.org> wrote > > > > Please remind me why this logic isn't implemented as a target hook. > > > > supports_split_stack = TARGET_CAN_SPLIT_STACK; > > > > /* rs6000.h */ > > #define TARGET_CAN_SPLIT_STACK TARGET_64BIT > > There is a target hook for split stack support in > gcc/common/common-target.def. The PPC version of it is in > gcc/common/config/rs6000/rs6000-common.c. > > But the issue here is that we need access from the gccgo driver > program. Can the driver program call the common target hooks? Not the way the gccgo driver is currently written. In lang_specific_driver you get to see global_options as set up by init_options_struct. TARGET_64BIT, used by the hook, is at its default value rather than what you'd see after command line option processing. This isn't at all surprising when you consider that lang_specific_driver must run before option processing since one of its jobs is to insert command line options.
Thanks for doing this Alan. I agree this looks better to me. I assume by "etc" you mean you did biarch builds for your bootstraps on BE? On 10/11/2015 08:07 AM, Alan Modra wrote: > On Sat, Oct 10, 2015 at 11:25:38PM +0200, Andreas Schwab wrote: >> "Lynn A. Boger" <laboger@linux.vnet.ibm.com> writes: >> >>> Index: gcc/config/rs6000/sysv4.h >>> =================================================================== >>> --- gcc/config/rs6000/sysv4.h (revision 228653) >>> +++ gcc/config/rs6000/sysv4.h (working copy) >>> @@ -940,13 +940,15 @@ ncrtn.o%s" >>> #undef TARGET_ASAN_SHADOW_OFFSET >>> #define TARGET_ASAN_SHADOW_OFFSET rs6000_asan_shadow_offset >>> >>> -/* On ppc64 and ppc64le, split stack is only support for >>> - 64 bit. */ >>> +/* On ppc64 and ppc64le, split stack is only supported for >>> + 64 bit targets with a 64 bit compiler. */ >>> #undef TARGET_CAN_SPLIT_STACK_64BIT >>> +#if defined (__64BIT__) || defined (__powerpc64__) || defined (__ppc64__) >> This doesn't make sense. A target header cannot use host defines. > Right. Here's a better fix. A powerpc-linux biarch compiler can > default to either -m32 or -m64 so we need to take that into account, > and notice both -m32 and -m64 on the gccgo command line. It's also > possible to build a -m64 only compiler, so in that case we can define > TARGET_CAN_SPLIT_STACK. > > Bootstrapped etc. powerpc64-linux, powerpc-linux and > powerpc64le-linux. OK? > > gcc/ > * config/rs6000/sysv4.h (TARGET_CAN_SPLIT_STACK_64BIT): Don't define. > * config/rs6000/linux64.h (TARGET_CAN_SPLIT_STACK): Define. > (TARGET_CAN_SPLIT_STACK_64BIT): Define. > gcc/go/ > * gospec.c (saw_opt_m32): Rename to.. > (is_m64): ..this, initialised by TARGET_CAN_SPLIT_STACK_64BIT. > Update uses. > (lang_specific_driver): Set is_m64 if OPT_m64, clear if OPT_m32. > > diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h > index 7b2f9bd..f48af43 100644 > --- a/gcc/config/rs6000/sysv4.h > +++ b/gcc/config/rs6000/sysv4.h > @@ -940,14 +940,6 @@ ncrtn.o%s" > #undef TARGET_ASAN_SHADOW_OFFSET > #define TARGET_ASAN_SHADOW_OFFSET rs6000_asan_shadow_offset > > -/* On ppc64 and ppc64le, split stack is only support for > - 64 bit. */ > -#undef TARGET_CAN_SPLIT_STACK_64BIT > -#if TARGET_GLIBC_MAJOR > 2 \ > - || (TARGET_GLIBC_MAJOR == 2 && TARGET_GLIBC_MINOR >= 18) > -#define TARGET_CAN_SPLIT_STACK_64BIT > -#endif > - > /* This target uses the sysv4.opt file. */ > #define TARGET_USES_SYSV4_OPT 1 > > diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h > index 9599735..28c83e41 100644 > --- a/gcc/config/rs6000/linux64.h > +++ b/gcc/config/rs6000/linux64.h > @@ -245,6 +245,21 @@ extern int dot_symbols; > #define MULTILIB_DEFAULTS { "m32" } > #endif > > +/* Split stack is only supported for 64 bit, and requires glibc >= 2.18. */ > +#if TARGET_GLIBC_MAJOR * 1000 + TARGET_GLIBC_MINOR >= 2018 > +# ifndef RS6000_BI_ARCH > +# define TARGET_CAN_SPLIT_STACK > +# else > +# if DEFAULT_ARCH64_P > +/* Supported, and the default is -m64 */ > +# define TARGET_CAN_SPLIT_STACK_64BIT 1 > +# else > +/* Supported, and the default is -m32 */ > +# define TARGET_CAN_SPLIT_STACK_64BIT 0 > +# endif > +# endif > +#endif > + > #ifndef RS6000_BI_ARCH > > /* 64-bit PowerPC Linux always has a TOC. */ > diff --git a/gcc/go/gospec.c b/gcc/go/gospec.c > index ca3c2d7..fbb55be 100644 > --- a/gcc/go/gospec.c > +++ b/gcc/go/gospec.c > @@ -120,8 +120,10 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, > /* Whether the -S option was used. */ > bool saw_opt_S = false; > > - /* Whether the -m32 option was used. */ > - bool saw_opt_m32 ATTRIBUTE_UNUSED = false; > +#ifdef TARGET_CAN_SPLIT_STACK_64BIT > + /* Whether the -m64 option is in force. */ > + bool is_m64 = TARGET_CAN_SPLIT_STACK_64BIT; > +#endif > > /* The first input file with an extension of .go. */ > const char *first_go_file = NULL; > @@ -160,7 +162,11 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, > > #ifdef TARGET_CAN_SPLIT_STACK_64BIT > case OPT_m32: > - saw_opt_m32 = true; > + is_m64 = false; > + break; > + > + case OPT_m64: > + is_m64 = true; > break; > #endif > > @@ -253,7 +259,7 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, > #endif > > #ifdef TARGET_CAN_SPLIT_STACK_64BIT > - if (!saw_opt_m32) > + if (is_m64) > supports_split_stack = 1; > #endif > > >
On Mon, Oct 12, 2015 at 10:15:04AM -0500, Lynn A. Boger wrote: > Thanks for doing this Alan. I agree this looks better to me. > > I assume by "etc" you mean you did biarch builds for your bootstraps on BE? By "etc" I meant "and regression tested". I built four configurations, powerpc-linux 32-bit only, powerpc64le-linux 64-bit only, biarch powerpc-linux with 32-bit default, and biarch powerpc64-linux with 64-bit default.
On 13.10.2015 00:53, Alan Modra wrote: > On Mon, Oct 12, 2015 at 10:15:04AM -0500, Lynn A. Boger wrote: >> Thanks for doing this Alan. I agree this looks better to me. >> >> I assume by "etc" you mean you did biarch builds for your bootstraps on BE? > > By "etc" I meant "and regression tested". > > I built four configurations, powerpc-linux 32-bit only, > powerpc64le-linux 64-bit only, biarch powerpc-linux with 32-bit > default, and biarch powerpc64-linux with 64-bit default. thanks, that works for me as well (biarch powerpc-linux-gnu).
On Sun, Oct 11, 2015 at 9:07 AM, Alan Modra <amodra@gmail.com> wrote: > On Sat, Oct 10, 2015 at 11:25:38PM +0200, Andreas Schwab wrote: >> "Lynn A. Boger" <laboger@linux.vnet.ibm.com> writes: >> >> > Index: gcc/config/rs6000/sysv4.h >> > =================================================================== >> > --- gcc/config/rs6000/sysv4.h (revision 228653) >> > +++ gcc/config/rs6000/sysv4.h (working copy) >> > @@ -940,13 +940,15 @@ ncrtn.o%s" >> > #undef TARGET_ASAN_SHADOW_OFFSET >> > #define TARGET_ASAN_SHADOW_OFFSET rs6000_asan_shadow_offset >> > >> > -/* On ppc64 and ppc64le, split stack is only support for >> > - 64 bit. */ >> > +/* On ppc64 and ppc64le, split stack is only supported for >> > + 64 bit targets with a 64 bit compiler. */ >> > #undef TARGET_CAN_SPLIT_STACK_64BIT >> > +#if defined (__64BIT__) || defined (__powerpc64__) || defined (__ppc64__) >> >> This doesn't make sense. A target header cannot use host defines. > > Right. Here's a better fix. A powerpc-linux biarch compiler can > default to either -m32 or -m64 so we need to take that into account, > and notice both -m32 and -m64 on the gccgo command line. It's also > possible to build a -m64 only compiler, so in that case we can define > TARGET_CAN_SPLIT_STACK. > > Bootstrapped etc. powerpc64-linux, powerpc-linux and > powerpc64le-linux. OK? > > gcc/ > * config/rs6000/sysv4.h (TARGET_CAN_SPLIT_STACK_64BIT): Don't define. > * config/rs6000/linux64.h (TARGET_CAN_SPLIT_STACK): Define. > (TARGET_CAN_SPLIT_STACK_64BIT): Define. > gcc/go/ > * gospec.c (saw_opt_m32): Rename to.. > (is_m64): ..this, initialised by TARGET_CAN_SPLIT_STACK_64BIT. > Update uses. > (lang_specific_driver): Set is_m64 if OPT_m64, clear if OPT_m32. The rs6000 bits are okay with me, although I never saw a full test for all configurations from Lynn. Thanks, David
Alan said he did this, which was a bootstrap and regression test of all the combinations: /I built four configurations, powerpc-linux 32-bit only, powerpc64le-linux 64-bit only, biarch powerpc-linux with 32-bit default, and biarch powerpc64-linux with 64-bit default/ I also did verify that on the ppc64le build and the biarch ppc64 64-bit default that the gold linker and split stack were enabled as expected and ran the Go testsuite for those. On 10/15/2015 01:40 PM, David Edelsohn wrote: > On Sun, Oct 11, 2015 at 9:07 AM, Alan Modra <amodra@gmail.com> wrote: >> On Sat, Oct 10, 2015 at 11:25:38PM +0200, Andreas Schwab wrote: >>> "Lynn A. Boger" <laboger@linux.vnet.ibm.com> writes: >>> >>>> Index: gcc/config/rs6000/sysv4.h >>>> =================================================================== >>>> --- gcc/config/rs6000/sysv4.h (revision 228653) >>>> +++ gcc/config/rs6000/sysv4.h (working copy) >>>> @@ -940,13 +940,15 @@ ncrtn.o%s" >>>> #undef TARGET_ASAN_SHADOW_OFFSET >>>> #define TARGET_ASAN_SHADOW_OFFSET rs6000_asan_shadow_offset >>>> >>>> -/* On ppc64 and ppc64le, split stack is only support for >>>> - 64 bit. */ >>>> +/* On ppc64 and ppc64le, split stack is only supported for >>>> + 64 bit targets with a 64 bit compiler. */ >>>> #undef TARGET_CAN_SPLIT_STACK_64BIT >>>> +#if defined (__64BIT__) || defined (__powerpc64__) || defined (__ppc64__) >>> This doesn't make sense. A target header cannot use host defines. >> Right. Here's a better fix. A powerpc-linux biarch compiler can >> default to either -m32 or -m64 so we need to take that into account, >> and notice both -m32 and -m64 on the gccgo command line. It's also >> possible to build a -m64 only compiler, so in that case we can define >> TARGET_CAN_SPLIT_STACK. >> >> Bootstrapped etc. powerpc64-linux, powerpc-linux and >> powerpc64le-linux. OK? >> >> gcc/ >> * config/rs6000/sysv4.h (TARGET_CAN_SPLIT_STACK_64BIT): Don't define. >> * config/rs6000/linux64.h (TARGET_CAN_SPLIT_STACK): Define. >> (TARGET_CAN_SPLIT_STACK_64BIT): Define. >> gcc/go/ >> * gospec.c (saw_opt_m32): Rename to.. >> (is_m64): ..this, initialised by TARGET_CAN_SPLIT_STACK_64BIT. >> Update uses. >> (lang_specific_driver): Set is_m64 if OPT_m64, clear if OPT_m32. > The rs6000 bits are okay with me, although I never saw a full test for > all configurations from Lynn. > > Thanks, David > >
On Sun, Oct 11, 2015 at 6:07 AM, Alan Modra <amodra@gmail.com> wrote: > > gcc/ > * config/rs6000/sysv4.h (TARGET_CAN_SPLIT_STACK_64BIT): Don't define. > * config/rs6000/linux64.h (TARGET_CAN_SPLIT_STACK): Define. > (TARGET_CAN_SPLIT_STACK_64BIT): Define. > gcc/go/ > * gospec.c (saw_opt_m32): Rename to.. > (is_m64): ..this, initialised by TARGET_CAN_SPLIT_STACK_64BIT. > Update uses. > (lang_specific_driver): Set is_m64 if OPT_m64, clear if OPT_m32. This is OK. Thanks. Ian
diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h index 7b2f9bd..f48af43 100644 --- a/gcc/config/rs6000/sysv4.h +++ b/gcc/config/rs6000/sysv4.h @@ -940,14 +940,6 @@ ncrtn.o%s" #undef TARGET_ASAN_SHADOW_OFFSET #define TARGET_ASAN_SHADOW_OFFSET rs6000_asan_shadow_offset -/* On ppc64 and ppc64le, split stack is only support for - 64 bit. */ -#undef TARGET_CAN_SPLIT_STACK_64BIT -#if TARGET_GLIBC_MAJOR > 2 \ - || (TARGET_GLIBC_MAJOR == 2 && TARGET_GLIBC_MINOR >= 18) -#define TARGET_CAN_SPLIT_STACK_64BIT -#endif - /* This target uses the sysv4.opt file. */ #define TARGET_USES_SYSV4_OPT 1 diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h index 9599735..28c83e41 100644 --- a/gcc/config/rs6000/linux64.h +++ b/gcc/config/rs6000/linux64.h @@ -245,6 +245,21 @@ extern int dot_symbols; #define MULTILIB_DEFAULTS { "m32" } #endif +/* Split stack is only supported for 64 bit, and requires glibc >= 2.18. */ +#if TARGET_GLIBC_MAJOR * 1000 + TARGET_GLIBC_MINOR >= 2018 +# ifndef RS6000_BI_ARCH +# define TARGET_CAN_SPLIT_STACK +# else +# if DEFAULT_ARCH64_P +/* Supported, and the default is -m64 */ +# define TARGET_CAN_SPLIT_STACK_64BIT 1 +# else +/* Supported, and the default is -m32 */ +# define TARGET_CAN_SPLIT_STACK_64BIT 0 +# endif +# endif +#endif + #ifndef RS6000_BI_ARCH /* 64-bit PowerPC Linux always has a TOC. */ diff --git a/gcc/go/gospec.c b/gcc/go/gospec.c index ca3c2d7..fbb55be 100644 --- a/gcc/go/gospec.c +++ b/gcc/go/gospec.c @@ -120,8 +120,10 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, /* Whether the -S option was used. */ bool saw_opt_S = false; - /* Whether the -m32 option was used. */ - bool saw_opt_m32 ATTRIBUTE_UNUSED = false; +#ifdef TARGET_CAN_SPLIT_STACK_64BIT + /* Whether the -m64 option is in force. */ + bool is_m64 = TARGET_CAN_SPLIT_STACK_64BIT; +#endif /* The first input file with an extension of .go. */ const char *first_go_file = NULL; @@ -160,7 +162,11 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, #ifdef TARGET_CAN_SPLIT_STACK_64BIT case OPT_m32: - saw_opt_m32 = true; + is_m64 = false; + break; + + case OPT_m64: + is_m64 = true; break; #endif @@ -253,7 +259,7 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, #endif #ifdef TARGET_CAN_SPLIT_STACK_64BIT - if (!saw_opt_m32) + if (is_m64) supports_split_stack = 1; #endif