Re: [PATCH] PR66870 PowerPC64 Enable gold linker with split stack

2015-10-16 Thread Ian Lance Taylor
On Sun, Oct 11, 2015 at 6:07 AM, Alan Modra  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


Re: [PATCH] PR66870 PowerPC64 Enable gold linker with split stack

2015-10-15 Thread Lynn A. Boger

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  wrote:

On Sat, Oct 10, 2015 at 11:25:38PM +0200, Andreas Schwab wrote:

"Lynn A. Boger"  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






Re: [PATCH] PR66870 PowerPC64 Enable gold linker with split stack

2015-10-15 Thread David Edelsohn
On Sun, Oct 11, 2015 at 9:07 AM, Alan Modra  wrote:
> On Sat, Oct 10, 2015 at 11:25:38PM +0200, Andreas Schwab wrote:
>> "Lynn A. Boger"  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


Re: [PATCH] PR66870 PowerPC64 Enable gold linker with split stack

2015-10-13 Thread Matthias Klose

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).



Re: [PATCH] PR66870 PowerPC64 Enable gold linker with split stack

2015-10-12 Thread Alan Modra
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.

-- 
Alan Modra
Australia Development Lab, IBM


Re: [PATCH] PR66870 PowerPC64 Enable gold linker with split stack

2015-10-12 Thread Lynn A. Boger

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"  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







Re: [PATCH] PR66870 PowerPC64 Enable gold linker with split stack

2015-10-11 Thread Alan Modra
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  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.

-- 
Alan Modra
Australia Development Lab, IBM


Re: [PATCH] PR66870 PowerPC64 Enable gold linker with split stack

2015-10-11 Thread Ian Lance Taylor
On Sun, Oct 11, 2015 at 7:43 AM, Andreas Schwab  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


Re: [PATCH] PR66870 PowerPC64 Enable gold linker with split stack

2015-10-11 Thread Andreas Schwab
Alan Modra  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.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


Re: [PATCH] PR66870 PowerPC64 Enable gold linker with split stack

2015-10-11 Thread Alan Modra
On Sat, Oct 10, 2015 at 11:25:38PM +0200, Andreas Schwab wrote:
> "Lynn A. Boger"  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
 


-- 
Alan Modra
Australia Development Lab, IBM


Re: [PATCH] PR66870 PowerPC64 Enable gold linker with split stack

2015-10-10 Thread Andreas Schwab
"Lynn A. Boger"  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.

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


Re: [PATCH] PR66870 PowerPC64 Enable gold linker with split stack

2015-10-10 Thread Matthias Klose

On 10.10.2015 16:00, David Edelsohn wrote:

On Fri, Oct 9, 2015 at 3:51 PM, Lynn A. Boger
 wrote:

Here's a new one.

Tried all the variations, verified that split stack is still enabled and
uses gold linker for 64 bit targets
when using a 64 bit default compiler, and does not give the split stack
error for 32 bit default
compilers.


This is okay if Matthias confirms that it works.


yes, that fixes the build error.

using the preprocessor for this kind of check, you get wrong results for gcc 
-m32 on powerpc64, and for gcc -m64 on powerpc.  The former looks like wrong 
code, while the latter is just missed optimization.  Not sure if it is worth 
fixing this.


I lost track of the x86 status. Is this now enabled there as well?

Matthias



Re: [PATCH] PR66870 PowerPC64 Enable gold linker with split stack

2015-10-10 Thread David Edelsohn
On Fri, Oct 9, 2015 at 3:51 PM, Lynn A. Boger
 wrote:
> Here's a new one.
>
> Tried all the variations, verified that split stack is still enabled and
> uses gold linker for 64 bit targets
> when using a 64 bit default compiler, and does not give the split stack
> error for 32 bit default
> compilers.

This is okay if Matthias confirms that it works.

Thanks, David


Re: [PATCH] PR66870 PowerPC64 Enable gold linker with split stack

2015-10-09 Thread Lynn A. Boger

Here's a new one.

Tried all the variations, verified that split stack is still enabled and 
uses gold linker for 64 bit targets
when using a 64 bit default compiler, and does not give the split stack 
error for 32 bit default

compilers.

On 10/08/2015 03:46 PM, Matthias Klose wrote:

On 08.10.2015 20:56, Lynn A. Boger wrote:

I think my original fix with linux.h doing the #undef on
TARGET_CAN_SPLIT_STACK_64BIT is the right fix at least
for powerpc-linux-gnu 32 bit only.

It works for powerpc-linux-gnu without multilib and doesn't break
powerpc64-linux-gnu or powerpc64le-linux-gnu.

Can you tell me how you are configuring the multilib build that 
defaults to

powerpc-linux-gnu and how it
fails?  Maybe there is another problem for that combination.


Configured with: -v
 --with-pkgversion='Ubuntu 20151005-0ubuntu1'
--with-bugurl='file:///usr/share/doc/gcc-snapshot/README.Bugs'
 --enable-languages=c,ada,c++,java,go,fortran,objc,obj-c++
 --prefix=/usr/lib/gcc-snapshot
 --enable-shared
 --enable-linker-build-id
 --disable-nls
 --with-sysroot=/
 --enable-clocale=gnu
 --enable-libstdcxx-debug
 --enable-libstdcxx-time=yes
 --with-default-libstdcxx-abi=new
 --enable-gnu-unique-object
 --disable-libitm
 --disable-libquadmath
 --enable-plugin
 --with-system-zlib
 --disable-browser-plugin
 --enable-java-awt=gtk
 --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-snap-powerpc/jre
 --enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-snap-powerpc
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-snap-powerpc
 --with-arch-directory=ppc
 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
 --enable-objc-gc
 --enable-secureplt
 --disable-softfloat
 --with-cpu=default32
 --disable-softfloat
 --enable-targets=powerpc-linux,powerpc64-linux
 --enable-multiarch
 --disable-werror
 --with-long-double-128
 --enable-multilib
 --enable-checking=yes
 --build=powerpc-linux-gnu
 --host=powerpc-linux-gnu
 --target=powerpc-linux-gnu

fails in gotools with:
cc1: error: '-fsplit-stack' currently only supported on PowerPC64 
GNU/Linux with glibc-2.18 or later
cc1: error: '-fsplit-stack' is not supported by this compiler 
configuration


this information is from the log below, but it's a parallel build, so 
a bit useless
https://launchpadlibrarian.net/220374353/buildlog_ubuntu-wily-powerpc.gcc-snapshot_20151005-0ubuntu1_BUILDING.txt.gz 



As David noted, the use of TARGET_64BIT or TARGET_POWERPC64 won't 
work for this

#define.


I found that out too =)  Note that ada builds are currently broken on 
the trunk.


Matthias




Index: gcc/common/config/rs6000/rs6000-common.c
===
--- gcc/common/config/rs6000/rs6000-common.c	(revision 228653)
+++ gcc/common/config/rs6000/rs6000-common.c	(working copy)
@@ -303,10 +303,12 @@ rs6000_supports_split_stack (bool report,
 #define TARGET_GLIBC_MINOR 0
 #endif
   /* Note: Can't test DEFAULT_ABI here, it isn't set until later.  */
+#ifdef TARGET_CAN_SPLIT_STACK_64BIT
   if (TARGET_GLIBC_MAJOR * 1000 + TARGET_GLIBC_MINOR >= 2018
   && TARGET_64BIT
   && TARGET_ELF)
 return true;
+#endif
 
   if (report)
 error ("%<-fsplit-stack%> currently only supported on PowerPC64 GNU/Linux with glibc-2.18 or later");
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__)
 #if TARGET_GLIBC_MAJOR > 2 \
   || (TARGET_GLIBC_MAJOR == 2 && TARGET_GLIBC_MINOR >= 18)
 #define TARGET_CAN_SPLIT_STACK_64BIT
 #endif
+#endif
 
 /* This target uses the sysv4.opt file.  */
 #define TARGET_USES_SYSV4_OPT 1


Re: [PATCH] PR66870 PowerPC64 Enable gold linker with split stack

2015-10-08 Thread Matthias Klose

On 08.10.2015 20:56, Lynn A. Boger wrote:

I think my original fix with linux.h doing the #undef on
TARGET_CAN_SPLIT_STACK_64BIT is the right fix at least
for powerpc-linux-gnu 32 bit only.

It works for powerpc-linux-gnu without multilib and doesn't break
powerpc64-linux-gnu or powerpc64le-linux-gnu.

Can you tell me how you are configuring the multilib build that defaults to
powerpc-linux-gnu and how it
fails?  Maybe there is another problem for that combination.


Configured with: -v
 --with-pkgversion='Ubuntu 20151005-0ubuntu1'
 --with-bugurl='file:///usr/share/doc/gcc-snapshot/README.Bugs'
 --enable-languages=c,ada,c++,java,go,fortran,objc,obj-c++
 --prefix=/usr/lib/gcc-snapshot
 --enable-shared
 --enable-linker-build-id
 --disable-nls
 --with-sysroot=/
 --enable-clocale=gnu
 --enable-libstdcxx-debug
 --enable-libstdcxx-time=yes
 --with-default-libstdcxx-abi=new
 --enable-gnu-unique-object
 --disable-libitm
 --disable-libquadmath
 --enable-plugin
 --with-system-zlib
 --disable-browser-plugin
 --enable-java-awt=gtk
 --enable-gtk-cairo
 --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-snap-powerpc/jre
 --enable-java-home
 --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-snap-powerpc
 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-snap-powerpc
 --with-arch-directory=ppc
 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
 --enable-objc-gc
 --enable-secureplt
 --disable-softfloat
 --with-cpu=default32
 --disable-softfloat
 --enable-targets=powerpc-linux,powerpc64-linux
 --enable-multiarch
 --disable-werror
 --with-long-double-128
 --enable-multilib
 --enable-checking=yes
 --build=powerpc-linux-gnu
 --host=powerpc-linux-gnu
 --target=powerpc-linux-gnu

fails in gotools with:
cc1: error: '-fsplit-stack' currently only supported on PowerPC64 GNU/Linux with 
glibc-2.18 or later

cc1: error: '-fsplit-stack' is not supported by this compiler configuration

this information is from the log below, but it's a parallel build, so a bit 
useless
https://launchpadlibrarian.net/220374353/buildlog_ubuntu-wily-powerpc.gcc-snapshot_20151005-0ubuntu1_BUILDING.txt.gz


As David noted, the use of TARGET_64BIT or TARGET_POWERPC64 won't work for this
#define.


I found that out too =)  Note that ada builds are currently broken on the trunk.

Matthias



Re: [PATCH] PR66870 PowerPC64 Enable gold linker with split stack

2015-10-08 Thread Lynn A. Boger
I think my original fix with linux.h doing the #undef on 
TARGET_CAN_SPLIT_STACK_64BIT is the right fix at least

for powerpc-linux-gnu 32 bit only.

It works for powerpc-linux-gnu without multilib and doesn't break 
powerpc64-linux-gnu or powerpc64le-linux-gnu.


Can you tell me how you are configuring the multilib build that defaults 
to powerpc-linux-gnu and how it

fails?  Maybe there is another problem for that combination.

As David noted, the use of TARGET_64BIT or TARGET_POWERPC64 won't work 
for this #define.


On 10/07/2015 12:31 PM, Matthias Klose wrote:

On 07.10.2015 17:36, Lynn A. Boger wrote:

Pretty sure this is the fix, but still doing some testing.


linux.h isn't included for multilib enabled builds defaulting to 
powerpc-linux-gnu, I am currently testing


--- gcc/config/rs6000/sysv4.h(revision 228571)
+++ gcc/config/rs6000/sysv4.h(working copy)
@@ -943,8 +943,9 @@
 /* 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)
+#if TARGET_64BIT \
+  && (TARGET_GLIBC_MAJOR > 2 \
+  || (TARGET_GLIBC_MAJOR == 2 && TARGET_GLIBC_MINOR >= 18))
 #define TARGET_CAN_SPLIT_STACK_64BIT
 #endif








Re: [PATCH] PR66870 PowerPC64 Enable gold linker with split stack

2015-10-07 Thread David Edelsohn
On Wed, Oct 7, 2015 at 3:37 PM, Lynn A. Boger
 wrote:
> Right I didn't think of the multilib on powerpc-linux-gnu (actually didn't
> think that was allowed).
>
> I don't think TARGET_64BIT will work here (I tried it), because on ppc64 &
> ppc64le it gets replaced with a code snippet to check
> a value in rs6000_isa_flags.  Based on how it is used here, it has to be a
> compile time define, not a bit checked
> at runtime.
>
> However, I think #if TARGET_POWERPC64 == 1 should work instead of
> TARGET_64BIT and I believe that will do the trick.
>
> Let me try that out on the ppc64 & ppc64le targets to make sure it still
> works as it should.

TARGET_POWERPC64 is not the correct test.

- David


Re: [PATCH] PR66870 PowerPC64 Enable gold linker with split stack

2015-10-07 Thread Matthias Klose

On 07.10.2015 17:36, Lynn A. Boger wrote:

Pretty sure this is the fix, but still doing some testing.


linux.h isn't included for multilib enabled builds defaulting to 
powerpc-linux-gnu, I am currently testing


--- gcc/config/rs6000/sysv4.h   (revision 228571)
+++ gcc/config/rs6000/sysv4.h   (working copy)
@@ -943,8 +943,9 @@
 /* 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)
+#if TARGET_64BIT \
+  && (TARGET_GLIBC_MAJOR > 2 \
+  || (TARGET_GLIBC_MAJOR == 2 && TARGET_GLIBC_MINOR >= 18))
 #define TARGET_CAN_SPLIT_STACK_64BIT
 #endif





Re: [PATCH] PR66870 PowerPC64 Enable gold linker with split stack

2015-10-07 Thread David Edelsohn
On Wed, Oct 7, 2015 at 1:04 PM, Ian Lance Taylor  wrote:
> On Wed, Oct 7, 2015 at 8:36 AM, Lynn A. Boger
>  wrote:
>> Pretty sure this is the fix, but still doing some testing.
>
> Looks good to me but I suppose David E. should approve.

It's fine with me.  Thanks for fixing this.

Thanks, David


Re: [PATCH] PR66870 PowerPC64 Enable gold linker with split stack

2015-10-07 Thread Ian Lance Taylor
On Wed, Oct 7, 2015 at 8:36 AM, Lynn A. Boger
 wrote:
> Pretty sure this is the fix, but still doing some testing.

Looks good to me but I suppose David E. should approve.

Ian


Re: [PATCH] PR66870 PowerPC64 Enable gold linker with split stack

2015-10-03 Thread Matthias Klose

On 01.10.2015 01:07, Ian Lance Taylor wrote:

On Thu, Sep 17, 2015 at 12:13 PM, Lynn A. Boger
 wrote:

Here is my updated patch, with the changes suggested by
Ian for gcc/gospec.c and David for gcc/configure.ac.

Bootstrap built and tested on ppc64le, ppc64 multilib.

2015-09-17Lynn Boger 
gcc/
 PR target/66870
 config/rs6000/sysv4.h:  Define TARGET_CAN_SPLIT_STACK_64BIT
 config.in:  Set up HAVE_GOLD_ALTERNATE_SPLIT_STACK
 configure.ac:  Define HAVE_GOLD_ALTERNATE_SPLIT_STACK
 on Power based on gold linker version
 configure:  Regenerate
 gcc.c:  Add -fuse-ld=gold to STACK_SPLIT_SPEC if
 HAVE_GOLD_ALTERNATE_SPLIT_STACK defined
 go/gospec.c:  (lang_specific_driver):  Set appropriate split
stack
 options for 64 bit compiles based on
TARGET_CAN_SPLIT_STACK_64BIT


Thanks.  I had to add ATTRIBUTE_UNUSED to the new variable in
go/gospec.c.  Committed with these ChangeLog entries:

2015-10-01  Lynn Boger  

PR target/66870
* config/rs6000/sysv4.h (TARGET_CAN_SPLIT_STACK_64BIT): Define.
* configure.ac: Define HAVE_GOLD_ALTERNATE_SPLIT_STACK on Power
based on gold linker version.
* gcc.c: Add -fuse-ld=gold to STACK_SPLIT_SPEC if
HAVE_GOLD_ALTERNATE_SPLIT_STACK defined.
* configure, config.in: Regenerate.

2015-10-01  Lynn Boger  

PR target/66870
* gospec.c (lang_specific_driver): Set appropriate split stack
options for 64 bit compiles based on TARGET_CAN_SPLIT_STACK_64BIT.

Ian



this causes the build to fail on powerpc-linux-gnu:

make[4]: Entering directory '/home/doko/gcc/gcc-snapshot-20151003/build/gotools'
/home/doko/gcc/gcc-snapshot-20151003/build/./gcc/gccgo 
-B/home/doko/gcc/gcc-snapshot-20151003/build/./gcc/ -g -O2  -static-libstdc++ 
-static-libgcc -Wl,-z,relro -L ../powerpc-linux-gnu/libgo -L 
../powerpc-linux-gnu/libgo/.libs -o go 
../../src/gotools/../libgo/go/cmd/go/build.go 
../../src/gotools/../libgo/go/cmd/go/clean.go 
../../src/gotools/../libgo/go/cmd/go/context.go 
../../src/gotools/../libgo/go/cmd/go/discovery.go 
../../src/gotools/../libgo/go/cmd/go/env.go 
../../src/gotools/../libgo/go/cmd/go/fix.go 
../../src/gotools/../libgo/go/cmd/go/fmt.go 
../../src/gotools/../libgo/go/cmd/go/generate.go 
../../src/gotools/../libgo/go/cmd/go/get.go 
../../src/gotools/../libgo/go/cmd/go/go11.go 
../../src/gotools/../libgo/go/cmd/go/help.go 
../../src/gotools/../libgo/go/cmd/go/http.go 
../../src/gotools/../libgo/go/cmd/go/list.go 
../../src/gotools/../libgo/go/cmd/go/main.go 
../../src/gotools/../libgo/go/cmd/go/pkg.go 
../../src/gotools/../libgo/go/cmd/go/run.go 
../../src/gotools/../libgo/go/cmd/go/signal.go 
../../src/gotools/../libgo/go/cmd/go/signal_unix.go 
../../src/gotools/../libgo/go/cmd/go/test.go 
../../src/gotools/../libgo/go/cmd/go/testflag.go 
../../src/gotools/../libgo/go/cmd/go/tool.go 
../../src/gotools/../libgo/go/cmd/go/vcs.go 
../../src/gotools/../libgo/go/cmd/go/version.go 
../../src/gotools/../libgo/go/cmd/go/vet.go 
../powerpc-linux-gnu/libgo/zstdpkglist.go zdefaultcc.go
go1: error: '-fsplit-stack' currently only supported on PowerPC64 GNU/Linux with 
glibc-2.18 or later

go1: error: '-fsplit-stack' is not supported by this compiler configuration
Makefile:667: recipe for target 'go' failed
make[4]: *** [go] Error 1
make[4]: Leaving directory '/home/doko/gcc/gcc-snapshot-20151003/build/gotools'
Makefile:12908: recipe for target 'all-gotools' failed
make[3]: *** [all-gotools] Error 2



Re: [PATCH] PR66870 PowerPC64 Enable gold linker with split stack

2015-09-30 Thread Ian Lance Taylor
On Thu, Sep 17, 2015 at 12:13 PM, Lynn A. Boger
 wrote:
> Here is my updated patch, with the changes suggested by
> Ian for gcc/gospec.c and David for gcc/configure.ac.
>
> Bootstrap built and tested on ppc64le, ppc64 multilib.
>
> 2015-09-17Lynn Boger 
> gcc/
> PR target/66870
> config/rs6000/sysv4.h:  Define TARGET_CAN_SPLIT_STACK_64BIT
> config.in:  Set up HAVE_GOLD_ALTERNATE_SPLIT_STACK
> configure.ac:  Define HAVE_GOLD_ALTERNATE_SPLIT_STACK
> on Power based on gold linker version
> configure:  Regenerate
> gcc.c:  Add -fuse-ld=gold to STACK_SPLIT_SPEC if
> HAVE_GOLD_ALTERNATE_SPLIT_STACK defined
> go/gospec.c:  (lang_specific_driver):  Set appropriate split
> stack
> options for 64 bit compiles based on
> TARGET_CAN_SPLIT_STACK_64BIT

Thanks.  I had to add ATTRIBUTE_UNUSED to the new variable in
go/gospec.c.  Committed with these ChangeLog entries:

2015-10-01  Lynn Boger  

PR target/66870
* config/rs6000/sysv4.h (TARGET_CAN_SPLIT_STACK_64BIT): Define.
* configure.ac: Define HAVE_GOLD_ALTERNATE_SPLIT_STACK on Power
based on gold linker version.
* gcc.c: Add -fuse-ld=gold to STACK_SPLIT_SPEC if
HAVE_GOLD_ALTERNATE_SPLIT_STACK defined.
* configure, config.in: Regenerate.

2015-10-01  Lynn Boger  

PR target/66870
* gospec.c (lang_specific_driver): Set appropriate split stack
options for 64 bit compiles based on TARGET_CAN_SPLIT_STACK_64BIT.

Ian


Re: [PATCH] PR66870 PowerPC64 Enable gold linker with split stack

2015-09-30 Thread Lynn A. Boger

Any update on this patch?

On 09/18/2015 07:48 AM, David Edelsohn wrote:

On Thu, Sep 17, 2015 at 3:13 PM, Lynn A. Boger
 wrote:

Here is my updated patch, with the changes suggested by
Ian for gcc/gospec.c and David for gcc/configure.ac.

Bootstrap built and tested on ppc64le, ppc64 multilib.

2015-09-17Lynn Boger 
gcc/
 PR target/66870
 config/rs6000/sysv4.h:  Define TARGET_CAN_SPLIT_STACK_64BIT
 config.in:  Set up HAVE_GOLD_ALTERNATE_SPLIT_STACK
 configure.ac:  Define HAVE_GOLD_ALTERNATE_SPLIT_STACK
 on Power based on gold linker version
 configure:  Regenerate
 gcc.c:  Add -fuse-ld=gold to STACK_SPLIT_SPEC if
 HAVE_GOLD_ALTERNATE_SPLIT_STACK defined
 go/gospec.c:  (lang_specific_driver):  Set appropriate split
stack
 options for 64 bit compiles based on
TARGET_CAN_SPLIT_STACK_64BIT

The rs6000 bits are okay with me.

Ian needs to approve the go bits.  And Ian or a configure maintainer
needs to approve the other bits.

Thanks, David






Re: [PATCH] PR66870 PowerPC64 Enable gold linker with split stack

2015-09-18 Thread David Edelsohn
On Thu, Sep 17, 2015 at 3:13 PM, Lynn A. Boger
 wrote:
> Here is my updated patch, with the changes suggested by
> Ian for gcc/gospec.c and David for gcc/configure.ac.
>
> Bootstrap built and tested on ppc64le, ppc64 multilib.
>
> 2015-09-17Lynn Boger 
> gcc/
> PR target/66870
> config/rs6000/sysv4.h:  Define TARGET_CAN_SPLIT_STACK_64BIT
> config.in:  Set up HAVE_GOLD_ALTERNATE_SPLIT_STACK
> configure.ac:  Define HAVE_GOLD_ALTERNATE_SPLIT_STACK
> on Power based on gold linker version
> configure:  Regenerate
> gcc.c:  Add -fuse-ld=gold to STACK_SPLIT_SPEC if
> HAVE_GOLD_ALTERNATE_SPLIT_STACK defined
> go/gospec.c:  (lang_specific_driver):  Set appropriate split
> stack
> options for 64 bit compiles based on
> TARGET_CAN_SPLIT_STACK_64BIT

The rs6000 bits are okay with me.

Ian needs to approve the go bits.  And Ian or a configure maintainer
needs to approve the other bits.

Thanks, David


Re: [PATCH] PR66870 PowerPC64 Enable gold linker with split stack

2015-09-17 Thread Lynn A. Boger

Here is my updated patch, with the changes suggested by
Ian for gcc/gospec.c and David for gcc/configure.ac.

Bootstrap built and tested on ppc64le, ppc64 multilib.

2015-09-17Lynn Boger 
gcc/
PR target/66870
config/rs6000/sysv4.h:  Define TARGET_CAN_SPLIT_STACK_64BIT
config.in:  Set up HAVE_GOLD_ALTERNATE_SPLIT_STACK
configure.ac:  Define HAVE_GOLD_ALTERNATE_SPLIT_STACK
on Power based on gold linker version
configure:  Regenerate
gcc.c:  Add -fuse-ld=gold to STACK_SPLIT_SPEC if
HAVE_GOLD_ALTERNATE_SPLIT_STACK defined
go/gospec.c:  (lang_specific_driver):  Set appropriate 
split stack
options for 64 bit compiles based on 
TARGET_CAN_SPLIT_STACK_64BIT


On 09/15/2015 02:58 PM, Ian Lance Taylor wrote:

On Tue, Sep 15, 2015 at 11:24 AM, Lynn A. Boger
  wrote:

I need some feedback on whether to enable the gold linker at
all for split stack on platforms other than Power in gcc/configure.ac.
I don't know if there are gold linker versions that should be verified for
non-Power platforms.  My first patch only enabled it on Power and that
  is what I think should be done.  Those who would like to use gold
with split stack for other platforms can enable it under the appropriate
conditions.

I think that is fine for now.  If you want to enable gold for
i386/x86_64 with -fsplit-stack, that is also fine.

Ian




Index: gcc/config/rs6000/sysv4.h
===
--- gcc/config/rs6000/sysv4.h	(revision 227812)
+++ gcc/config/rs6000/sysv4.h	(working copy)
@@ -940,6 +940,14 @@ 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
 
Index: gcc/config.in
===
--- gcc/config.in	(revision 227812)
+++ gcc/config.in	(working copy)
@@ -1310,6 +1310,12 @@
 #endif
 
 
+/* Define if the gold linker with split stack is available as a non-default */
+#ifndef USED_FOR_TARGET
+#undef HAVE_GOLD_NON_DEFAULT_SPLIT_STACK
+#endif
+
+
 /* Define if you have the iconv() function. */
 #ifndef USED_FOR_TARGET
 #undef HAVE_ICONV
Index: gcc/configure.ac
===
--- gcc/configure.ac	(revision 227812)
+++ gcc/configure.ac	(working copy)
@@ -2247,6 +2247,42 @@ if test x$gcc_cv_ld != x; then
 fi
 AC_MSG_RESULT($ld_is_gold)
 
+AC_MSG_CHECKING(gold linker with split stack support as non default)
+# Check to see if default ld is not gold, but gold is
+# available and has support for split stack.  If gcc was configured
+# with gold then no checking is done.
+# 
+if test x$ld_is_gold = xno && which ${gcc_cv_ld}.gold >/dev/null 2>&1; then
+
+# For platforms other than powerpc64*, enable as appropriate.
+
+  gold_non_default=no
+  ld_gold=`which ${gcc_cv_ld}.gold`
+# Make sure this gold has minimal split stack support
+  if $ld_gold --help 2>/dev/null | grep split-stack-adjust-size >/dev/null 2>&1; then
+ld_vers=`$ld_gold --version | sed 1q`
+gold_vers=`echo $ld_vers | sed -n \
+  -e 's,^[[^)]]*[[  ]]\([[0-9]][[0-9]]*\.[[0-9]][[0-9]]*[[^)]]*\)) .*$,\1,p'`
+case $target in
+# check that the gold version contains the complete split stack support
+# on powerpc64 big and little endian
+  powerpc64*-*-*)
+case "$gold_vers" in
+  2.25.[[1-9]]*|2.2[[6-9]][[.0-9]]*|2.[[3-9]][[.0-9]]*|[[3-9]].[[.0-9]]*) gold_non_default=yes
+  ;;
+  *) gold_non_default=no
+  ;;
+esac
+;;
+esac
+  fi
+  if test $gold_non_default = yes; then
+AC_DEFINE(HAVE_GOLD_NON_DEFAULT_SPLIT_STACK, 1,
+	[Define if the gold linker supports split stack and is available as a non-default])
+  fi
+fi
+AC_MSG_RESULT($gold_non_default)
+
 ORIGINAL_LD_FOR_TARGET=$gcc_cv_ld
 AC_SUBST(ORIGINAL_LD_FOR_TARGET)
 case "$ORIGINAL_LD_FOR_TARGET" in
Index: gcc/gcc.c
===
--- gcc/gcc.c	(revision 227812)
+++ gcc/gcc.c	(working copy)
@@ -666,7 +666,11 @@ proper position among the other output files.  */
libgcc.  This is not yet a real spec, though it could become one;
it is currently just stuffed into LINK_SPEC.  FIXME: This wrapping
only works with GNU ld and gold.  */
+#ifdef HAVE_GOLD_NON_DEFAULT_SPLIT_STACK
+#define STACK_SPLIT_SPEC " %{fsplit-stack: -fuse-ld=gold --wrap=pthread_create}"
+#else
 #define STACK_SPLIT_SPEC " %{fsplit-stack: --wrap=pthread_create}"
+#endif
 
 #ifndef LIBASAN_SPEC
 #define STATIC_LIBASAN_LIBS \
Index: gcc/go/gospec.c
=

Re: [PATCH] PR66870 PowerPC64 Enable gold linker with split stack

2015-09-15 Thread Ian Lance Taylor
On Tue, Sep 15, 2015 at 11:24 AM, Lynn A. Boger
 wrote:
>
> I need some feedback on whether to enable the gold linker at
> all for split stack on platforms other than Power in gcc/configure.ac.
> I don't know if there are gold linker versions that should be verified for
> non-Power platforms.  My first patch only enabled it on Power and that
>  is what I think should be done.  Those who would like to use gold
> with split stack for other platforms can enable it under the appropriate
> conditions.

I think that is fine for now.  If you want to enable gold for
i386/x86_64 with -fsplit-stack, that is also fine.

Ian


Re: [PATCH] PR66870 PowerPC64 Enable gold linker with split stack

2015-09-15 Thread Lynn A. Boger

I will make the changes Ian suggested to gospec.c and was
planning to fix the sed string in gcc/configure.ac as David suggested.

I need some feedback on whether to enable the gold linker at
all for split stack on platforms other than Power in gcc/configure.ac.
I don't know if there are gold linker versions that should be verified for
non-Power platforms.  My first patch only enabled it on Power and that
 is what I think should be done.  Those who would like to use gold
with split stack for other platforms can enable it under the appropriate
conditions.

On 09/15/2015 01:18 PM, David Edelsohn wrote:

On Thu, Aug 27, 2015 at 5:00 PM, Lynn A. Boger
 wrote:

Here is an updated patch, with a summary of the differences from my previous
patch:

- In my previous patch gcc configure was verifying the gold linker even if
it was the
default linker, but that is not necessary since in that case -fuse-ld=gold
does not
need to be set.  Gold version checking is now only done if the alternate
linker is gold
and the default linker is not.
- The STACK_SPLIT_STACK spec define found in gcc/gcc.c now adds
-fuse-ld=gold
if the gcc configure determines the alternate gold linker has split stack
support.
- A case statement is now used in gcc configure to verify the gold version,
to make it
easier for other platforms to add their checks if necessary.  I don't know
if other
platforms require this checking; Matthias' patch did not check the version.
For powerpc64
big and little endian we have to check the gold linker version because the
split
stack support was added recently and older gold linkers won't work.
- The version checking of the gold linker was removed from the libgo
configure
  since gcc configure has already decided if it is correct.
- TARGET_CAN_SPLIT_STACK_64BIT is now defined in sysv4.h if the glibc
version
is correct for split stack for powerpc64 big and little endian. This define
is used in
go/gospec.c in the same way that TARGET_CAN_SPLIT_STACK is used now but,
  additionally verifies that it is a 64 bit compile.  This is necessary
because split
stack support is not available for ppc 32 bit big endian in gcc or the gold
linker.

Bootstrapped and tested on x86_64, ppc64le, ppc64 (ran m32, m64 tests)


2015-08-27Lynn Boger 

gcc/
  PR target/66870
  config/rs6000/sysv4.h:  Define TARGET_CAN_SPLIT_STACK_64BIT
  based on LIBC version.
  config.in:  Set up HAVE_GOLD_ALTERNATE.
  configure.ac:  Define HAVE_GOLD_ALTERNATE if the version of the
gold
  linker supports split stack.
  configure: Regenerate.
  gcc.c:  Add -fuse-ld=gold to STACK_SPLIT_SPEC if
HAVE_GOLD_ALTERNATE
  is defined.
  go/gospec.c:  (lang_specific_driver):  Use
TARGET_CAN_SPLIT_STACK_64BIT
  to control setting of fsplit-stack and u,pthread_create options for
64 bit
  compiles.

I don't have authority to approve for most of the patch.

I noticed that the test for Gold version number is different than a
similar test in another part of configure.  And the sed pattern seems
to be too restrictive -- it fails to extract a version number for my
tests with Gold in a few different Linux distros.  This should be
addressed instead of silently misidentifying split stack support in
some distros.

- David






Re: [PATCH] PR66870 PowerPC64 Enable gold linker with split stack

2015-09-15 Thread David Edelsohn
On Thu, Aug 27, 2015 at 5:00 PM, Lynn A. Boger
 wrote:
> Here is an updated patch, with a summary of the differences from my previous
> patch:
>
> - In my previous patch gcc configure was verifying the gold linker even if
> it was the
> default linker, but that is not necessary since in that case -fuse-ld=gold
> does not
> need to be set.  Gold version checking is now only done if the alternate
> linker is gold
> and the default linker is not.
> - The STACK_SPLIT_STACK spec define found in gcc/gcc.c now adds
> -fuse-ld=gold
> if the gcc configure determines the alternate gold linker has split stack
> support.
> - A case statement is now used in gcc configure to verify the gold version,
> to make it
> easier for other platforms to add their checks if necessary.  I don't know
> if other
> platforms require this checking; Matthias' patch did not check the version.
> For powerpc64
> big and little endian we have to check the gold linker version because the
> split
> stack support was added recently and older gold linkers won't work.
> - The version checking of the gold linker was removed from the libgo
> configure
>  since gcc configure has already decided if it is correct.
> - TARGET_CAN_SPLIT_STACK_64BIT is now defined in sysv4.h if the glibc
> version
> is correct for split stack for powerpc64 big and little endian. This define
> is used in
> go/gospec.c in the same way that TARGET_CAN_SPLIT_STACK is used now but,
>  additionally verifies that it is a 64 bit compile.  This is necessary
> because split
> stack support is not available for ppc 32 bit big endian in gcc or the gold
> linker.
>
> Bootstrapped and tested on x86_64, ppc64le, ppc64 (ran m32, m64 tests)
>
>
> 2015-08-27Lynn Boger 
>
> gcc/
>  PR target/66870
>  config/rs6000/sysv4.h:  Define TARGET_CAN_SPLIT_STACK_64BIT
>  based on LIBC version.
>  config.in:  Set up HAVE_GOLD_ALTERNATE.
>  configure.ac:  Define HAVE_GOLD_ALTERNATE if the version of the
> gold
>  linker supports split stack.
>  configure: Regenerate.
>  gcc.c:  Add -fuse-ld=gold to STACK_SPLIT_SPEC if
> HAVE_GOLD_ALTERNATE
>  is defined.
>  go/gospec.c:  (lang_specific_driver):  Use
> TARGET_CAN_SPLIT_STACK_64BIT
>  to control setting of fsplit-stack and u,pthread_create options for
> 64 bit
>  compiles.

I don't have authority to approve for most of the patch.

I noticed that the test for Gold version number is different than a
similar test in another part of configure.  And the sed pattern seems
to be too restrictive -- it fails to extract a version number for my
tests with Gold in a few different Linux distros.  This should be
addressed instead of silently misidentifying split stack support in
some distros.

- David


Re: [PATCH] PR66870 PowerPC64 Enable gold linker with split stack

2015-09-15 Thread Ian Lance Taylor
On Thu, Aug 27, 2015 at 2:00 PM, Lynn A. Boger
 wrote:
> Here is an updated patch, with a summary of the differences from my previous
> patch:
>
> - In my previous patch gcc configure was verifying the gold linker even if
> it was the
> default linker, but that is not necessary since in that case -fuse-ld=gold
> does not
> need to be set.  Gold version checking is now only done if the alternate
> linker is gold
> and the default linker is not.
> - The STACK_SPLIT_STACK spec define found in gcc/gcc.c now adds
> -fuse-ld=gold
> if the gcc configure determines the alternate gold linker has split stack
> support.
> - A case statement is now used in gcc configure to verify the gold version,
> to make it
> easier for other platforms to add their checks if necessary.  I don't know
> if other
> platforms require this checking; Matthias' patch did not check the version.
> For powerpc64
> big and little endian we have to check the gold linker version because the
> split
> stack support was added recently and older gold linkers won't work.
> - The version checking of the gold linker was removed from the libgo
> configure
>  since gcc configure has already decided if it is correct.
> - TARGET_CAN_SPLIT_STACK_64BIT is now defined in sysv4.h if the glibc
> version
> is correct for split stack for powerpc64 big and little endian. This define
> is used in
> go/gospec.c in the same way that TARGET_CAN_SPLIT_STACK is used now but,
>  additionally verifies that it is a 64 bit compile.  This is necessary
> because split
> stack support is not available for ppc 32 bit big endian in gcc or the gold
> linker.
>
> Bootstrapped and tested on x86_64, ppc64le, ppc64 (ran m32, m64 tests)
>
>
> 2015-08-27Lynn Boger 
>
> gcc/
>  PR target/66870
>  config/rs6000/sysv4.h:  Define TARGET_CAN_SPLIT_STACK_64BIT
>  based on LIBC version.
>  config.in:  Set up HAVE_GOLD_ALTERNATE.
>  configure.ac:  Define HAVE_GOLD_ALTERNATE if the version of the
> gold
>  linker supports split stack.
>  configure: Regenerate.
>  gcc.c:  Add -fuse-ld=gold to STACK_SPLIT_SPEC if
> HAVE_GOLD_ALTERNATE
>  is defined.
>  go/gospec.c:  (lang_specific_driver):  Use
> TARGET_CAN_SPLIT_STACK_64BIT
>  to control setting of fsplit-stack and u,pthread_create options for
> 64 bit
>  compiles.


I'm not sure who is going to approve this patch overall, but I'd
rather the gospec.c changes weren't so #ifdef heavy.  I would set m32
unconditionally.  Then write something like

   supports_split_stack = 0;
#ifdef TARGET_CAN_SPLIT_STACK
  supports_split_stack = 1;
#endif
#ifdef TARGET_CAN_SPLIT_STACK64
  if (m32)
supports_split_stack = 0;
#endif

Then change the #ifdef TARGET_CAN_SPLIT_STACK code to test supports_split_stack.

Thanks.

Ian


Re: [PATCH] PR66870 PowerPC64 Enable gold linker with split stack

2015-08-27 Thread Lynn A. Boger

Here is an updated patch, with a summary of the differences from my previous
patch:

- In my previous patch gcc configure was verifying the gold linker even 
if it was the
default linker, but that is not necessary since in that case 
-fuse-ld=gold does not
need to be set.  Gold version checking is now only done if the alternate 
linker is gold

and the default linker is not.
- The STACK_SPLIT_STACK spec define found in gcc/gcc.c now adds 
-fuse-ld=gold
if the gcc configure determines the alternate gold linker has split 
stack support.
- A case statement is now used in gcc configure to verify the gold 
version, to make it
easier for other platforms to add their checks if necessary.  I don't 
know if other
platforms require this checking; Matthias' patch did not check the 
version.  For powerpc64
big and little endian we have to check the gold linker version because 
the split

stack support was added recently and older gold linkers won't work.
- The version checking of the gold linker was removed from the libgo 
configure

 since gcc configure has already decided if it is correct.
- TARGET_CAN_SPLIT_STACK_64BIT is now defined in sysv4.h if the glibc 
version
is correct for split stack for powerpc64 big and little endian. This 
define is used in

go/gospec.c in the same way that TARGET_CAN_SPLIT_STACK is used now but,
 additionally verifies that it is a 64 bit compile.  This is necessary 
because split
stack support is not available for ppc 32 bit big endian in gcc or the 
gold linker.


Bootstrapped and tested on x86_64, ppc64le, ppc64 (ran m32, m64 tests)


2015-08-27Lynn Boger 

gcc/
 PR target/66870
 config/rs6000/sysv4.h:  Define TARGET_CAN_SPLIT_STACK_64BIT
 based on LIBC version.
 config.in:  Set up HAVE_GOLD_ALTERNATE.
 configure.ac:  Define HAVE_GOLD_ALTERNATE if the version of 
the gold

 linker supports split stack.
 configure: Regenerate.
 gcc.c:  Add -fuse-ld=gold to STACK_SPLIT_SPEC if 
HAVE_GOLD_ALTERNATE

 is defined.
 go/gospec.c:  (lang_specific_driver):  Use 
TARGET_CAN_SPLIT_STACK_64BIT
 to control setting of fsplit-stack and u,pthread_create 
options for 64 bit

 compiles.


On 08/19/2015 06:05 PM, Lynn A. Boger wrote:

Also, I don't think it is sufficient to add the option to enable the
gold linker in gospec.c.  That will only affect links when using gccgo.
You also want to use the gold linker with gcc if -fsplit-stack is used.
That is why I had to add it to a spec in linux64.h, so that -fuse-ld=gold
 is added if fsplit-stack is set for all compilers, not just gccgo.

On 08/19/2015 02:33 PM, Matthias Klose wrote:

On 08/18/2015 10:36 PM, Lynn A. Boger wrote:

As discussed in PR 66870, for ppc64le and ppc64le it is preferred to
  use the gold linker with gccgo or gcc if the split stack option is 
enabled.
Use of the gold linker with the split stack option results in less 
storage

allocated for goroutine stacks; if split stack is used without the gold
linker then some testcase failures can occur.

   Since the use of the gold linker has not been well tested
with all gcc compilers on Power, it is only used as the linker if the
split stack option is used.

This adds the capability to the configure for gcc and libgo to 
determine
if the gold linker is available at build time, either in the path or 
explicitly
  configured, and its version supports split stack.  If that is the 
case then
defines are set that cause the gold linker to be used by the 
compiler when
-fsplit-stack is used.  This applies to ppc64 and ppc64le. Other 
platforms

with split stack work as before.

2015-08-18Lynn Boger 

gcc/
 PR target/66870
 config/rs6000/linux64.h: When 
HAVE_LD_GOLD_SUPPORTS_SPLIT_STACK

 is defined add -fuse-ld=gold if fsplit-stack and not m32
 config/rs6000/sysv4.h:  Define TARGET_CAN_SPLIT_STACK based on
 LIBC version.
 config.in:  Set up HAVE_LD_GOLD_SUPPORTS_SPLIT_STACK.
 configure.ac:  When gold linker is available and its version
 supports split stack on ppc64, ppc64le, define
 HAVE_LD_GOLD_SUPPORTS_SPLIT_STACK.
 configure:  Regenerate.

libgo/
 PR target/66870
 configure.ac:  When gccgo for building libgo uses the gold 
version

 containing split stack support on ppc64, ppc64le, define
 LINKER_SUPPORTS_SPLIT_STACK.
 configure:  Regenerate.

For platforms other than ppc64 and ppc64le, the configure for gcc
and libgo behave as before.
why keep the old behaviour for other archs that have split stack 
support? Is it
really necessary to make this dependent on the target? I'm still 
using an

unreviewed/unpinged patch to enable gold for gccgo (attached).

Matthias








Index: gcc/config/rs6000/sysv4.h
===
--- gcc/config/rs6000/sysv4.h	(revision 227266)
+++ gcc/config/rs6000/sysv4.h	(working copy)
@@ -946,6 +94

Re: [PATCH] PR66870 PowerPC64 Enable gold linker with split stack

2015-08-26 Thread Lynn A. Boger

I am working on a new patch to address some of the previous concerns
and plan to post it soon after some final testing.

On 08/25/2015 05:51 PM, Ian Lance Taylor wrote:

On Tue, Aug 18, 2015 at 1:36 PM, Lynn A. Boger
 wrote:

libgo/
 PR target/66870
 configure.ac:  When gccgo for building libgo uses the gold version
 containing split stack support on ppc64, ppc64le, define
 LINKER_SUPPORTS_SPLIT_STACK.
 configure:  Regenerate.

Your version test for gold isn't robust: if the major version >= 3,
then presumably split stack is supported.  And since you have numbers,
I suggest not trying to use switch, but instead writing something like
 if expr "$gold_minor" == 25; then
 ...
 elif expr "$gold_minor" > 25; then
 ...
 fi

If that is fixed, I'm fine with the libgo part of this patch.

Ian






Re: [PATCH] PR66870 PowerPC64 Enable gold linker with split stack

2015-08-25 Thread Ian Lance Taylor
On Tue, Aug 18, 2015 at 1:36 PM, Lynn A. Boger
 wrote:
>
> libgo/
> PR target/66870
> configure.ac:  When gccgo for building libgo uses the gold version
> containing split stack support on ppc64, ppc64le, define
> LINKER_SUPPORTS_SPLIT_STACK.
> configure:  Regenerate.

Your version test for gold isn't robust: if the major version >= 3,
then presumably split stack is supported.  And since you have numbers,
I suggest not trying to use switch, but instead writing something like
if expr "$gold_minor" == 25; then
...
elif expr "$gold_minor" > 25; then
...
fi

If that is fixed, I'm fine with the libgo part of this patch.

Ian


Re: [PATCH] PR66870 PowerPC64 Enable gold linker with split stack

2015-08-19 Thread Lynn A. Boger

Also, I don't think it is sufficient to add the option to enable the
gold linker in gospec.c.  That will only affect links when using gccgo.
You also want to use the gold linker with gcc if -fsplit-stack is used.
That is why I had to add it to a spec in linux64.h, so that -fuse-ld=gold
 is added if fsplit-stack is set for all compilers, not just gccgo.

On 08/19/2015 02:33 PM, Matthias Klose wrote:

On 08/18/2015 10:36 PM, Lynn A. Boger wrote:

As discussed in PR 66870, for ppc64le and ppc64le it is preferred to
  use the gold linker with gccgo or gcc if the split stack option is enabled.
Use of the gold linker with the split stack option results in less storage
allocated for goroutine stacks; if split stack is used without the gold
linker then some testcase failures can occur.

   Since the use of the gold linker has not been well tested
with all gcc compilers on Power, it is only used as the linker if the
split stack option is used.

This adds the capability to the configure for gcc and libgo to determine
if the gold linker is available at build time, either in the path or explicitly
  configured, and its version supports split stack.  If that is the case then
defines are set that cause the gold linker to be used by the compiler when
-fsplit-stack is used.  This applies to ppc64 and ppc64le.  Other platforms
with split stack work as before.

2015-08-18Lynn Boger 

gcc/
 PR target/66870
 config/rs6000/linux64.h: When HAVE_LD_GOLD_SUPPORTS_SPLIT_STACK
 is defined add -fuse-ld=gold if fsplit-stack and not m32
 config/rs6000/sysv4.h:  Define TARGET_CAN_SPLIT_STACK based on
 LIBC version.
 config.in:  Set up HAVE_LD_GOLD_SUPPORTS_SPLIT_STACK.
 configure.ac:  When gold linker is available and its version
 supports split stack on ppc64, ppc64le, define
 HAVE_LD_GOLD_SUPPORTS_SPLIT_STACK.
 configure:  Regenerate.

libgo/
 PR target/66870
 configure.ac:  When gccgo for building libgo uses the gold version
 containing split stack support on ppc64, ppc64le, define
 LINKER_SUPPORTS_SPLIT_STACK.
 configure:  Regenerate.

For platforms other than ppc64 and ppc64le, the configure for gcc
and libgo behave as before.

why keep the old behaviour for other archs that have split stack support? Is it
really necessary to make this dependent on the target? I'm still using an
unreviewed/unpinged patch to enable gold for gccgo (attached).

Matthias






Re: [PATCH] PR66870 PowerPC64 Enable gold linker with split stack

2015-08-19 Thread Lynn A. Boger

The split stack support only recently went into the gold
linker for Power so the configure needs to detect if the
gold linker version contains that support.  If the build tries
 to use a gold linker without that support the build
will fail on Power.  My understanding was that the gold
linker support had been there for other platforms.  That is why
the configure check is target dependent and only Power cares
about the version number.

I started out with a simpler patch like you have but after trying to 
build it

on ppc64le, ppc64, and ppc this is what I ended up with and I didn't
want to mess up other platforms so I left those as is.

On 08/19/2015 02:33 PM, Matthias Klose wrote:

On 08/18/2015 10:36 PM, Lynn A. Boger wrote:

As discussed in PR 66870, for ppc64le and ppc64le it is preferred to
  use the gold linker with gccgo or gcc if the split stack option is enabled.
Use of the gold linker with the split stack option results in less storage
allocated for goroutine stacks; if split stack is used without the gold
linker then some testcase failures can occur.

   Since the use of the gold linker has not been well tested
with all gcc compilers on Power, it is only used as the linker if the
split stack option is used.

This adds the capability to the configure for gcc and libgo to determine
if the gold linker is available at build time, either in the path or explicitly
  configured, and its version supports split stack.  If that is the case then
defines are set that cause the gold linker to be used by the compiler when
-fsplit-stack is used.  This applies to ppc64 and ppc64le.  Other platforms
with split stack work as before.

2015-08-18Lynn Boger 

gcc/
 PR target/66870
 config/rs6000/linux64.h: When HAVE_LD_GOLD_SUPPORTS_SPLIT_STACK
 is defined add -fuse-ld=gold if fsplit-stack and not m32
 config/rs6000/sysv4.h:  Define TARGET_CAN_SPLIT_STACK based on
 LIBC version.
 config.in:  Set up HAVE_LD_GOLD_SUPPORTS_SPLIT_STACK.
 configure.ac:  When gold linker is available and its version
 supports split stack on ppc64, ppc64le, define
 HAVE_LD_GOLD_SUPPORTS_SPLIT_STACK.
 configure:  Regenerate.

libgo/
 PR target/66870
 configure.ac:  When gccgo for building libgo uses the gold version
 containing split stack support on ppc64, ppc64le, define
 LINKER_SUPPORTS_SPLIT_STACK.
 configure:  Regenerate.

For platforms other than ppc64 and ppc64le, the configure for gcc
and libgo behave as before.

why keep the old behaviour for other archs that have split stack support? Is it
really necessary to make this dependent on the target? I'm still using an
unreviewed/unpinged patch to enable gold for gccgo (attached).

Matthias






Re: [PATCH] PR66870 PowerPC64 Enable gold linker with split stack

2015-08-19 Thread David Edelsohn
On Wed, Aug 19, 2015 at 3:33 PM, Matthias Klose  wrote:

> why keep the old behaviour for other archs that have split stack support? Is 
> it
> really necessary to make this dependent on the target? I'm still using an
> unreviewed/unpinged patch to enable gold for gccgo (attached).

I much prefer your patch.

Thanks, David


Re: [PATCH] PR66870 PowerPC64 Enable gold linker with split stack

2015-08-19 Thread Matthias Klose
On 08/18/2015 10:36 PM, Lynn A. Boger wrote:
> As discussed in PR 66870, for ppc64le and ppc64le it is preferred to
>  use the gold linker with gccgo or gcc if the split stack option is enabled.
> Use of the gold linker with the split stack option results in less storage
> allocated for goroutine stacks; if split stack is used without the gold
> linker then some testcase failures can occur.
> 
>   Since the use of the gold linker has not been well tested
> with all gcc compilers on Power, it is only used as the linker if the
> split stack option is used.
> 
> This adds the capability to the configure for gcc and libgo to determine
> if the gold linker is available at build time, either in the path or 
> explicitly
>  configured, and its version supports split stack.  If that is the case then
> defines are set that cause the gold linker to be used by the compiler when
> -fsplit-stack is used.  This applies to ppc64 and ppc64le.  Other platforms
> with split stack work as before.
> 
> 2015-08-18Lynn Boger 
> 
> gcc/
> PR target/66870
> config/rs6000/linux64.h: When HAVE_LD_GOLD_SUPPORTS_SPLIT_STACK
> is defined add -fuse-ld=gold if fsplit-stack and not m32
> config/rs6000/sysv4.h:  Define TARGET_CAN_SPLIT_STACK based on
> LIBC version.
> config.in:  Set up HAVE_LD_GOLD_SUPPORTS_SPLIT_STACK.
> configure.ac:  When gold linker is available and its version
> supports split stack on ppc64, ppc64le, define
> HAVE_LD_GOLD_SUPPORTS_SPLIT_STACK.
> configure:  Regenerate.
> 
> libgo/
> PR target/66870
> configure.ac:  When gccgo for building libgo uses the gold version
> containing split stack support on ppc64, ppc64le, define
> LINKER_SUPPORTS_SPLIT_STACK.
> configure:  Regenerate.
> 
> For platforms other than ppc64 and ppc64le, the configure for gcc
> and libgo behave as before.

why keep the old behaviour for other archs that have split stack support? Is it
really necessary to make this dependent on the target? I'm still using an
unreviewed/unpinged patch to enable gold for gccgo (attached).

Matthias


# DP: Pass -fuse-ld=gold to gccgo on targets supporting -fsplit-stack

gcc/go/ 
 

 
* gospec.c (lang_specific_driver): Pass -fuse-ld=gold on targets
 
supporting -fsplit-stack, unless overwritten.   
 

 
gcc/
 
* configure.ac: New define HAVE_GOLD_NON_DEFAULT.   
 
* config.in: Regenerate.
 

 
Index: b/src/gcc/go/gospec.c
===
--- a/src/gcc/go/gospec.c
+++ b/src/gcc/go/gospec.c
@@ -117,6 +117,10 @@ lang_specific_driver (struct cl_decoded_
   /* Whether the -S option was used.  */
   bool saw_opt_S = false;
 
+  /* "-fuse-ld=" if it appears on the command line.  */
+  bool saw_use_ld ATTRIBUTE_UNUSED = false;
+  int need_gold = 0;
+
   /* The first input file with an extension of .go.  */
   const char *first_go_file = NULL;  
 
@@ -217,6 +221,11 @@ lang_specific_driver (struct cl_decoded_
}
 
  break;
+
+   case OPT_fuse_ld_bfd:
+   case OPT_fuse_ld_gold:
+ saw_use_ld = true;
+ break;
}
 }
 
@@ -226,8 +235,14 @@ lang_specific_driver (struct cl_decoded_
   shared_libgcc = 0;
 #endif
 
+#if defined(TARGET_CAN_SPLIT_STACK) && defined(HAVE_GOLD_NON_DEFAULT)
+  if (!saw_use_ld)
+need_gold = 1;
+#endif
+
   /* Make sure to have room for the trailing NULL argument.  */
-  num_args = argc + need_math + shared_libgcc + (library > 0) * 5 + 10;
+  num_args = argc + need_math + shared_libgcc + need_gold +
+(library > 0) * 5 + 10;
   new_decoded_options = XNEWVEC (struct cl_decoded_option, num_args);
 
   i = 0;
@@ -244,6 +259,14 @@ lang_specific_driver (struct cl_decoded_
   &new_decoded_options[j]);
   j++;
 }
+#ifdef HAVE_GOLD_NON_DEFAULT
+  if (need_gold)
+{
+  generate_option (OPT_fuse_ld_gold, NULL, 1, CL_DRIVER,
+  &new_decoded_options[j]);
+  j++;
+}
+#endif
 #endif
 
   /* NOTE: We start at 1 now, not 0.  */
Index: b/src/gcc/config.in
===
--- a/src/gcc/config.in
+++ b/src/gcc/config.in
@@ -1277,6 +1277,12 @@
 #endif
 
 
+/* Define if the gold linker is available as a non-default */
+#ifndef USED_FOR_TARGET
+#undef HAVE_GOLD_NON_

[PATCH] PR66870 PowerPC64 Enable gold linker with split stack

2015-08-18 Thread Lynn A. Boger

As discussed in PR 66870, for ppc64le and ppc64le it is preferred to
 use the gold linker with gccgo or gcc if the split stack option is 
enabled.

Use of the gold linker with the split stack option results in less storage
allocated for goroutine stacks; if split stack is used without the gold
linker then some testcase failures can occur.

  Since the use of the gold linker has not been well tested
with all gcc compilers on Power, it is only used as the linker if the
split stack option is used.

This adds the capability to the configure for gcc and libgo to determine
if the gold linker is available at build time, either in the path or 
explicitly
 configured, and its version supports split stack.  If that is the case 
then

defines are set that cause the gold linker to be used by the compiler when
-fsplit-stack is used.  This applies to ppc64 and ppc64le.  Other platforms
with split stack work as before.

2015-08-18Lynn Boger 

gcc/
PR target/66870
config/rs6000/linux64.h: When HAVE_LD_GOLD_SUPPORTS_SPLIT_STACK
is defined add -fuse-ld=gold if fsplit-stack and not m32
config/rs6000/sysv4.h:  Define TARGET_CAN_SPLIT_STACK based on
LIBC version.
config.in:  Set up HAVE_LD_GOLD_SUPPORTS_SPLIT_STACK.
configure.ac:  When gold linker is available and its version
supports split stack on ppc64, ppc64le, define
HAVE_LD_GOLD_SUPPORTS_SPLIT_STACK.
configure:  Regenerate.

libgo/
PR target/66870
configure.ac:  When gccgo for building libgo uses the gold version
containing split stack support on ppc64, ppc64le, define
LINKER_SUPPORTS_SPLIT_STACK.
configure:  Regenerate.

For platforms other than ppc64 and ppc64le, the configure for gcc
and libgo behave as before.

Bootstrapped and ran libgo and go testsuite on ppc64, ppc64le, x86_64.



Index: gcc/config/rs6000/linux64.h
===
--- gcc/config/rs6000/linux64.h	(revision 226894)
+++ gcc/config/rs6000/linux64.h	(working copy)
@@ -227,8 +227,12 @@ extern int dot_symbols;
 #endif
 
 #ifndef LINK_OS_EXTRA_SPEC64
+#ifdef HAVE_LD_GOLD_SUPPORTS_SPLIT_STACK
+#define LINK_OS_EXTRA_SPEC64   "%{fsplit-stack: %{!m32: -fuse-ld=gold}}"
+#else
 #define LINK_OS_EXTRA_SPEC64	""
 #endif
+#endif
 
 #ifndef LINK_OS_NEW_DTAGS_SPEC
 #define LINK_OS_NEW_DTAGS_SPEC	""
Index: gcc/config/rs6000/sysv4.h
===
--- gcc/config/rs6000/sysv4.h	(revision 226894)
+++ gcc/config/rs6000/sysv4.h	(working copy)
@@ -946,6 +946,12 @@ ncrtn.o%s"
 #undef TARGET_ASAN_SHADOW_OFFSET
 #define TARGET_ASAN_SHADOW_OFFSET rs6000_asan_shadow_offset
 
+#undef TARGET_CAN_SPLIT_STACK
+#if TARGET_GLIBC_MAJOR > 2 \
+  || (TARGET_GLIBC_MAJOR == 2 && TARGET_GLIBC_MINOR >= 18)
+#define TARGET_CAN_SPLIT_STACK 1
+#endif
+
 /* This target uses the sysv4.opt file.  */
 #define TARGET_USES_SYSV4_OPT 1
 
Index: gcc/config.in
===
--- gcc/config.in	(revision 226894)
+++ gcc/config.in	(working copy)
@@ -1484,6 +1484,11 @@
 #endif
 
 
+/* Define to 1 if there is a gold linker in the path which supports split stack. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_LD_GOLD_SUPPORTS_SPLIT_STACK
+#endif
+
 /* Define to 1 if you have the  header file. */
 #ifndef USED_FOR_TARGET
 #undef HAVE_LIMITS_H
Index: gcc/configure.ac
===
--- gcc/configure.ac	(revision 226894)
+++ gcc/configure.ac	(working copy)
@@ -5174,7 +5174,41 @@ EOF
   AC_DEFINE_UNQUOTED(POWERPC64_TOC_POINTER_ALIGNMENT, $gcc_cv_ld_toc_align,
 [Define to .TOC. alignment forced by your linker.])
 fi
-;;
+
+# Check for split stack support within the gold linker
+AC_CACHE_CHECK(gold linker supports split stack,
+gcc_cv_ld_gold_supports_split_stack,
+[gcc_cv_ld_gold_supports_split_stack=no
+if test x"$ld_is_gold" = xyes; then
+gold_linker=$gcc_cv_ld
+elif "$ORIGINAL_LD_GOLD_FOR_TARGET" --version | grep gold >/dev/null 2>&1; then
+gold_linker=$ORIGINAL_LD_GOLD_FOR_TARGET
+else
+gold_linker=""
+fi
+if test "$gold_linker" != ""; then
+gold_vers=`$gold_linker --version | sed 1q | sed -n -e 's/.*Binutils.* \([[0-9]][[0-9]]*\.[[^)]]*\)).*$/\1/p'`
+gold_vers_major=`expr "$gold_vers" : '\([[0-9]]*\)'`
+gold_vers_minor=`expr "$gold_vers" : '[[0-9]]*\.\([[0-9]]*\)'`
+gold_vers_patch=`expr "$gold_vers" : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
+
+case x"$gold_vers_minor" in
+  x25)
+if test x"$gold_vers_patch" != ""; then
+  gcc_cv_ld_gold_supports_split_stack=yes
+fi
+;;
+  x2[[6-9]])
+gcc_cv_ld_gold_supports_split_stack=yes
+;;
+esac 
+   fi
+   ])
+   if test x"$gcc_cv_ld_gold_supports_split_stack" = xyes; then
+  AC_DEFINE(HA