[PATCH] PR66870 PowerPC64 Enable gold linker with split stack

Lynn A. Boger laboger@linux.vnet.ibm.com
Thu Aug 27 21:37:00 GMT 2015


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-27    Lynn Boger <laboger@linux.vnet.ibm.com>

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-18    Lynn Boger <laboger@linux.vnet.ibm.com>
>>>
>>> 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
>>
>>
>
>
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: gccgo-config-gold-submit3.diff
Type: text/x-patch
Size: 5366 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20150827/5fc880eb/attachment.bin>


More information about the Gcc-patches mailing list