* [libphobos, build] Enable libphobos on Solaris 11/x86
@ 2019-01-29 12:44 Rainer Orth
2019-02-18 22:44 ` Iain Buclaw
0 siblings, 1 reply; 11+ messages in thread
From: Rainer Orth @ 2019-01-29 12:44 UTC (permalink / raw)
To: gcc-patches; +Cc: Iain Buclaw
[-- Attachment #1: Type: text/plain, Size: 1437 bytes --]
With the set of libphobos Solaris patches just posted, it would become
possible to enable libphobos on Solaris 11/x86 by default.
This is what this patch does.
* It uses a LIBPHOBOS_SUPPORTED variable both in toplevel configure and
libphobos/configure.tgt, following what libvtv does.
* It's necessary to disable libphobos when Solaris as is in use: it has
a relatively low line length limit of 10240 which is exceeded in a few
libphobos files.
Bootstrapped without regressions on i386-pc-solaris2.11 (as and gas, gas
and gld, Solaris 11.3/11.4/11.5) on top of the previous set of patches.
Also tested manually that explicit
--enable-libphobos/--disable-libphobos give the desired results
(i.e. override the defaults).
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
2019-01-23 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
toplevel:
* configure.ac (enable_libphobos): Check LIBPHOBOS_SUPPORTED.
* configure: Regenerate.
libphobos:
* configure.tgt (LIBPHOBOS_SUPPORTED): Default to no.
Set to yes explicitly.
(x86_64-*-solaris2.11* | i?86-*-solaris2.11*): Mark supported.
* configure.ac (x86_64-*-solaris2.* | i?86-*-solaris2.*): Only
mark supported with gas.
(ENABLE_LIBPHOBOS): New conditional.
* configure: Regenerate.
* Makefile.am (SUBDIRS): Only set if ENABLE_LIBPHOBOS.
* Makefile.in: Regenerate.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: sol11x86-libphobos-enable.patch --]
[-- Type: text/x-patch, Size: 3013 bytes --]
# HG changeset patch
# Parent 7943668e276d15b949fddd7723cb5213fb465977
Enable libphobos on Solaris 11/x86
diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -694,7 +694,7 @@ if test -d ${srcdir}/libphobos; then
AC_MSG_CHECKING([for libphobos support])
if (srcdir=${srcdir}/libphobos; \
. ${srcdir}/configure.tgt; \
- test -n "$UNSUPPORTED")
+ test "$LIBPHOBOS_SUPPORTED" != "yes")
then
AC_MSG_RESULT([no])
noconfigdirs="$noconfigdirs target-libphobos"
diff --git a/libphobos/Makefile.am b/libphobos/Makefile.am
--- a/libphobos/Makefile.am
+++ b/libphobos/Makefile.am
@@ -15,7 +15,11 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-SUBDIRS = libdruntime src testsuite
+if ENABLE_LIBPHOBOS
+ SUBDIRS = libdruntime src testsuite
+else
+ SUBDIRS =
+endif
ACLOCAL_AMFLAGS = -I . -I .. -I ../config
diff --git a/libphobos/configure.ac b/libphobos/configure.ac
--- a/libphobos/configure.ac
+++ b/libphobos/configure.ac
@@ -114,6 +114,42 @@ AC_SUBST(phobos_compiler_shared_flag)
lt_prog_compiler_pic_D="$phobos_compiler_shared_flag"
pic_mode='default'
+AC_MSG_CHECKING([for --enable-libphobos])
+AC_ARG_ENABLE(libphobos,
+ [AS_HELP_STRING([--enable-libphobos], [Enable libphobos])])
+AC_MSG_RESULT($enable_libphobos)
+
+# See if supported.
+unset LIBPHOBOS_SUPPORTED
+AC_MSG_CHECKING([for host support for libphobos])
+. ${srcdir}/configure.tgt
+case ${host} in
+ x86_64-*-solaris2.* | i?86-*-solaris2.*)
+ # libphobos doesn't compile with the Solaris/x86 assembler due to a
+ # relatively low linelength limit.
+ as_prog=`$CC -print-prog-name=as`
+ if test -n "$as_prog" && $as_prog -v /dev/null 2>&1 | grep GNU > /dev/null 2>&1; then
+ druntime_cv_use_gas=yes;
+ else
+ druntime_cv_use_gas=no;
+ fi
+ rm -f a.out
+ if test x$druntime_cv_use_gas = xno; then
+ LIBPHOBOS_SUPPORTED=no
+ fi
+ ;;
+esac
+AC_MSG_RESULT($LIBPHOBOS_SUPPORTED)
+
+# Decide if it's usable.
+case $LIBPHOBOS_SUPPORTED:$enable_libphobos in
+*:no) use_libphobos=no ;;
+*:yes) use_libphobos=yes ;;
+yes:*) use_libphobos=yes ;;
+*:*) use_libphobos=no ;;
+esac
+AM_CONDITIONAL(ENABLE_LIBPHOBOS, test x$use_libphobos = xyes)
+
# Determine what GCC version number to use in filesystem paths.
GCC_BASE_VER
diff --git a/libphobos/configure.tgt b/libphobos/configure.tgt
--- a/libphobos/configure.tgt
+++ b/libphobos/configure.tgt
@@ -21,16 +21,21 @@
# Disable the libphobos or libdruntime components on untested or known
# broken systems. More targets shall be added after testing.
+LIBPHOBOS_SUPPORTED=no
case "${target}" in
arm*-*-linux*)
+ LIBPHOBOS_SUPPORTED=yes
;;
mips*-*-linux*)
+ LIBPHOBOS_SUPPORTED=yes
;;
x86_64-*-kfreebsd*-gnu | i?86-*-kfreebsd*-gnu)
+ LIBPHOBOS_SUPPORTED=yes
;;
x86_64-*-linux* | i?86-*-linux*)
+ LIBPHOBOS_SUPPORTED=yes
;;
- *)
- UNSUPPORTED=1
+ x86_64-*-solaris2.11* | i?86-*-solaris2.11*)
+ LIBPHOBOS_SUPPORTED=yes
;;
esac
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [libphobos, build] Enable libphobos on Solaris 11/x86
2019-01-29 12:44 [libphobos, build] Enable libphobos on Solaris 11/x86 Rainer Orth
@ 2019-02-18 22:44 ` Iain Buclaw
2019-02-19 9:32 ` Rainer Orth
2019-04-14 11:02 ` Rainer Orth
0 siblings, 2 replies; 11+ messages in thread
From: Iain Buclaw @ 2019-02-18 22:44 UTC (permalink / raw)
To: Rainer Orth; +Cc: gcc-patches
On Tue, 29 Jan 2019 at 13:35, Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote:
>
> With the set of libphobos Solaris patches just posted, it would become
> possible to enable libphobos on Solaris 11/x86 by default.
>
> This is what this patch does.
>
> * It uses a LIBPHOBOS_SUPPORTED variable both in toplevel configure and
> libphobos/configure.tgt, following what libvtv does.
>
> * It's necessary to disable libphobos when Solaris as is in use: it has
> a relatively low line length limit of 10240 which is exceeded in a few
> libphobos files.
>
> Bootstrapped without regressions on i386-pc-solaris2.11 (as and gas, gas
> and gld, Solaris 11.3/11.4/11.5) on top of the previous set of patches.
>
> Also tested manually that explicit
> --enable-libphobos/--disable-libphobos give the desired results
> (i.e. override the defaults).
>
OK.
--
Iain
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [libphobos, build] Enable libphobos on Solaris 11/x86
2019-02-18 22:44 ` Iain Buclaw
@ 2019-02-19 9:32 ` Rainer Orth
2019-02-19 12:38 ` Iain Buclaw
2019-04-14 11:02 ` Rainer Orth
1 sibling, 1 reply; 11+ messages in thread
From: Rainer Orth @ 2019-02-19 9:32 UTC (permalink / raw)
To: Iain Buclaw; +Cc: gcc-patches
Hi Iain,
> On Tue, 29 Jan 2019 at 13:35, Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote:
>>
>> With the set of libphobos Solaris patches just posted, it would become
>> possible to enable libphobos on Solaris 11/x86 by default.
>>
>> This is what this patch does.
>>
>> * It uses a LIBPHOBOS_SUPPORTED variable both in toplevel configure and
>> libphobos/configure.tgt, following what libvtv does.
>>
>> * It's necessary to disable libphobos when Solaris as is in use: it has
>> a relatively low line length limit of 10240 which is exceeded in a few
>> libphobos files.
>>
>> Bootstrapped without regressions on i386-pc-solaris2.11 (as and gas, gas
>> and gld, Solaris 11.3/11.4/11.5) on top of the previous set of patches.
>>
>> Also tested manually that explicit
>> --enable-libphobos/--disable-libphobos give the desired results
>> (i.e. override the defaults).
>>
>
> OK.
Thanks. This will have to wait for
[libphobos] Use sections_elf_shared.d on Solaris 11.5 (PR d/88150)
https://gcc.gnu.org/ml/gcc-patches/2019-01/msg01661.html
and
[libphobos] Work around lack of dlpi_tls_modid before Solaris 11.5
https://gcc.gnu.org/ml/gcc-patches/2019-01/msg01664.html
of course. Maybe even
[libphobos] Work around Solaris ld bug linking __tls_get_addr on 64-bit x86
https://gcc.gnu.org/ml/gcc-patches/2019-01/msg01663.html
will be needed depending on whether a proper ld fix makes it into
Solaris 11.5 or not.
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [libphobos, build] Enable libphobos on Solaris 11/x86
2019-02-19 9:32 ` Rainer Orth
@ 2019-02-19 12:38 ` Iain Buclaw
2019-02-19 12:58 ` Rainer Orth
0 siblings, 1 reply; 11+ messages in thread
From: Iain Buclaw @ 2019-02-19 12:38 UTC (permalink / raw)
To: Rainer Orth; +Cc: gcc-patches
On Tue, 19 Feb 2019 at 10:32, Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote:
>
> Hi Iain,
>
> > On Tue, 29 Jan 2019 at 13:35, Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote:
> >>
> >> With the set of libphobos Solaris patches just posted, it would become
> >> possible to enable libphobos on Solaris 11/x86 by default.
> >>
> >> This is what this patch does.
> >>
> >> * It uses a LIBPHOBOS_SUPPORTED variable both in toplevel configure and
> >> libphobos/configure.tgt, following what libvtv does.
> >>
> >> * It's necessary to disable libphobos when Solaris as is in use: it has
> >> a relatively low line length limit of 10240 which is exceeded in a few
> >> libphobos files.
> >>
> >> Bootstrapped without regressions on i386-pc-solaris2.11 (as and gas, gas
> >> and gld, Solaris 11.3/11.4/11.5) on top of the previous set of patches.
> >>
> >> Also tested manually that explicit
> >> --enable-libphobos/--disable-libphobos give the desired results
> >> (i.e. override the defaults).
> >>
> >
> > OK.
>
> Thanks. This will have to wait for
>
> [libphobos] Use sections_elf_shared.d on Solaris 11.5 (PR d/88150)
> https://gcc.gnu.org/ml/gcc-patches/2019-01/msg01661.html
I'll make a fork of sections support tonight, as that seems to be the
right way forwards.
Other parts will need upstreaming, I can do that as well.
> and
> [libphobos] Work around lack of dlpi_tls_modid before Solaris 11.5
> https://gcc.gnu.org/ml/gcc-patches/2019-01/msg01664.html
>
Johannes has already commented there, and he is right about needing a
way to get tls data from DSOs.
> of course. Maybe even
>
> [libphobos] Work around Solaris ld bug linking __tls_get_addr on 64-bit x86
> https://gcc.gnu.org/ml/gcc-patches/2019-01/msg01663.html
>
> will be needed depending on whether a proper ld fix makes it into
> Solaris 11.5 or not.
>
I'm not sure about this, but haven't looked at it properly just yet.
--
Iain
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [libphobos, build] Enable libphobos on Solaris 11/x86
2019-02-19 12:38 ` Iain Buclaw
@ 2019-02-19 12:58 ` Rainer Orth
2019-04-14 16:41 ` Iain Buclaw
0 siblings, 1 reply; 11+ messages in thread
From: Rainer Orth @ 2019-02-19 12:58 UTC (permalink / raw)
To: Iain Buclaw; +Cc: gcc-patches
Hi Iain,
>> Thanks. This will have to wait for
>>
>> [libphobos] Use sections_elf_shared.d on Solaris 11.5 (PR d/88150)
>> https://gcc.gnu.org/ml/gcc-patches/2019-01/msg01661.html
>
> I'll make a fork of sections support tonight, as that seems to be the
> right way forwards.
>
> Other parts will need upstreaming, I can do that as well.
that would be great, thanks.
>> and
>> [libphobos] Work around lack of dlpi_tls_modid before Solaris 11.5
>> https://gcc.gnu.org/ml/gcc-patches/2019-01/msg01664.html
>>
>
> Johannes has already commented there, and he is right about needing a
> way to get tls data from DSOs.
Understood. Maybe I can find a way to generalize the hack derived from
sections_ldc.d to TLS segments outside the executable.
>> of course. Maybe even
>>
>> [libphobos] Work around Solaris ld bug linking __tls_get_addr on
>> 64-bit x86
>> https://gcc.gnu.org/ml/gcc-patches/2019-01/msg01663.html
>>
>> will be needed depending on whether a proper ld fix makes it into
>> Solaris 11.5 or not.
>
> I'm not sure about this, but haven't looked at it properly just yet.
I don't think you need concern yourself with this very much: it's just a
hack around a Solaris ld bug, suggested by the Solaris linker engineers
for the moment. Once the dlpi_tls_modid patch lands in Solaris 11.5
(this week or next), I'll ask if they see a chance to have that bug
fixed in time for the Solaris 11.5 release. If so, nobody besides
myself will ever be exposed to this issue.
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [libphobos, build] Enable libphobos on Solaris 11/x86
2019-02-18 22:44 ` Iain Buclaw
2019-02-19 9:32 ` Rainer Orth
@ 2019-04-14 11:02 ` Rainer Orth
1 sibling, 0 replies; 11+ messages in thread
From: Rainer Orth @ 2019-04-14 11:02 UTC (permalink / raw)
To: Iain Buclaw; +Cc: gcc-patches
Hi Iain,
> On Tue, 29 Jan 2019 at 13:35, Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote:
>>
>> With the set of libphobos Solaris patches just posted, it would become
>> possible to enable libphobos on Solaris 11/x86 by default.
>>
>> This is what this patch does.
>>
>> * It uses a LIBPHOBOS_SUPPORTED variable both in toplevel configure and
>> libphobos/configure.tgt, following what libvtv does.
>>
>> * It's necessary to disable libphobos when Solaris as is in use: it has
>> a relatively low line length limit of 10240 which is exceeded in a few
>> libphobos files.
>>
>> Bootstrapped without regressions on i386-pc-solaris2.11 (as and gas, gas
>> and gld, Solaris 11.3/11.4/11.5) on top of the previous set of patches.
>>
>> Also tested manually that explicit
>> --enable-libphobos/--disable-libphobos give the desired results
>> (i.e. override the defaults).
>>
>
> OK.
I've now installed the patch since all the prerequisites are now in. As
I mentioned, the current lack of core.sys.solaris.link support for
Solaris 11.5 dlpi_tls_modid (to go upstream first) affects no one except
myself.
Thanks.
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [libphobos, build] Enable libphobos on Solaris 11/x86
2019-02-19 12:58 ` Rainer Orth
@ 2019-04-14 16:41 ` Iain Buclaw
2019-04-14 20:59 ` Rainer Orth
2019-05-07 8:15 ` Rainer Orth
0 siblings, 2 replies; 11+ messages in thread
From: Iain Buclaw @ 2019-04-14 16:41 UTC (permalink / raw)
To: Rainer Orth; +Cc: gcc-patches
On Tue, 19 Feb 2019 at 13:58, Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote:
>
> Hi Iain,
>
> >> Thanks. This will have to wait for
> >>
> >> [libphobos] Use sections_elf_shared.d on Solaris 11.5 (PR d/88150)
> >> https://gcc.gnu.org/ml/gcc-patches/2019-01/msg01661.html
> >
> > I'll make a fork of sections support tonight, as that seems to be the
> > right way forwards.
> >
> > Other parts will need upstreaming, I can do that as well.
>
> that would be great, thanks.
>
> >> and
> >> [libphobos] Work around lack of dlpi_tls_modid before Solaris 11.5
> >> https://gcc.gnu.org/ml/gcc-patches/2019-01/msg01664.html
> >>
> >
> > Johannes has already commented there, and he is right about needing a
> > way to get tls data from DSOs.
>
> Understood. Maybe I can find a way to generalize the hack derived from
> sections_ldc.d to TLS segments outside the executable.
>
> >> of course. Maybe even
> >>
> >> [libphobos] Work around Solaris ld bug linking __tls_get_addr on
> >> 64-bit x86
> >> https://gcc.gnu.org/ml/gcc-patches/2019-01/msg01663.html
> >>
> >> will be needed depending on whether a proper ld fix makes it into
> >> Solaris 11.5 or not.
> >
> > I'm not sure about this, but haven't looked at it properly just yet.
>
> I don't think you need concern yourself with this very much: it's just a
> hack around a Solaris ld bug, suggested by the Solaris linker engineers
> for the moment. Once the dlpi_tls_modid patch lands in Solaris 11.5
> (this week or next), I'll ask if they see a chance to have that bug
> fixed in time for the Solaris 11.5 release. If so, nobody besides
> myself will ever be exposed to this issue.
>
I've just given building gcc a try in an OpenIndiana VM, and get the following:
ld: fatal: option -z has illegal argument 'relax=transtls'
ld: fatal: flags processing errors
collect2: error: ld returned 1 exit status
$ ld --version
ld: Software Generation Utilities - Solaris Link Editors: 5.11-1.1756 (illumos)
My fatal mistake of course was not configuring with
--with-ld=/usr/gnu/bin/ld, however it is notable that not all Solaris
linkers support this relax=transtls option.
--
Iain
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [libphobos, build] Enable libphobos on Solaris 11/x86
2019-04-14 16:41 ` Iain Buclaw
@ 2019-04-14 20:59 ` Rainer Orth
2019-05-07 8:15 ` Rainer Orth
1 sibling, 0 replies; 11+ messages in thread
From: Rainer Orth @ 2019-04-14 20:59 UTC (permalink / raw)
To: Iain Buclaw; +Cc: gcc-patches
Hi Iain,
>> I don't think you need concern yourself with this very much: it's just a
>> hack around a Solaris ld bug, suggested by the Solaris linker engineers
>> for the moment. Once the dlpi_tls_modid patch lands in Solaris 11.5
>> (this week or next), I'll ask if they see a chance to have that bug
>> fixed in time for the Solaris 11.5 release. If so, nobody besides
>> myself will ever be exposed to this issue.
>>
>
> I've just given building gcc a try in an OpenIndiana VM, and get the following:
>
> ld: fatal: option -z has illegal argument 'relax=transtls'
> ld: fatal: flags processing errors
> collect2: error: ld returned 1 exit status
>
> $ ld --version
> ld: Software Generation Utilities - Solaris Link Editors: 5.11-1.1756 (illumos)
>
> My fatal mistake of course was not configuring with
> --with-ld=/usr/gnu/bin/ld, however it is notable that not all Solaris
> linkers support this relax=transtls option.
indeed. I don't have the time to try Illumos derivatives myself, but
looking closer that -z relax=transtls was neither in OpenSolaris (and
thus isn't in Illumos either) nor in Solaris 11.0. Must have been
introduced at some later point, but it's certainly present in Solaris
11.3, the oldest version I can easily try.
There are two options here:
* Either Illumos has already fixed the ld bug worked around by -z
transtls. Then the absence of the option doesn't matter and things
will work fine.
* Otherwise (and independently of the Illumos situation) I'll add a
check for Solaris ld supporting the option instead of using it
unconditionally.
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [libphobos, build] Enable libphobos on Solaris 11/x86
2019-04-14 16:41 ` Iain Buclaw
2019-04-14 20:59 ` Rainer Orth
@ 2019-05-07 8:15 ` Rainer Orth
2019-05-07 8:33 ` Iain Buclaw
1 sibling, 1 reply; 11+ messages in thread
From: Rainer Orth @ 2019-05-07 8:15 UTC (permalink / raw)
To: Iain Buclaw; +Cc: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 3553 bytes --]
Hi Iain,
> On Tue, 19 Feb 2019 at 13:58, Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote:
>>
>> Hi Iain,
>>
>> >> Thanks. This will have to wait for
>> >>
>> >> [libphobos] Use sections_elf_shared.d on Solaris 11.5 (PR d/88150)
>> >> https://gcc.gnu.org/ml/gcc-patches/2019-01/msg01661.html
>> >
>> > I'll make a fork of sections support tonight, as that seems to be the
>> > right way forwards.
>> >
>> > Other parts will need upstreaming, I can do that as well.
>>
>> that would be great, thanks.
>>
>> >> and
>> >> [libphobos] Work around lack of dlpi_tls_modid before Solaris 11.5
>> >> https://gcc.gnu.org/ml/gcc-patches/2019-01/msg01664.html
>> >>
>> >
>> > Johannes has already commented there, and he is right about needing a
>> > way to get tls data from DSOs.
>>
>> Understood. Maybe I can find a way to generalize the hack derived from
>> sections_ldc.d to TLS segments outside the executable.
>>
>> >> of course. Maybe even
>> >>
>> >> [libphobos] Work around Solaris ld bug linking __tls_get_addr on
>> >> 64-bit x86
>> >> https://gcc.gnu.org/ml/gcc-patches/2019-01/msg01663.html
>> >>
>> >> will be needed depending on whether a proper ld fix makes it into
>> >> Solaris 11.5 or not.
>> >
>> > I'm not sure about this, but haven't looked at it properly just yet.
>>
>> I don't think you need concern yourself with this very much: it's just a
>> hack around a Solaris ld bug, suggested by the Solaris linker engineers
>> for the moment. Once the dlpi_tls_modid patch lands in Solaris 11.5
>> (this week or next), I'll ask if they see a chance to have that bug
>> fixed in time for the Solaris 11.5 release. If so, nobody besides
>> myself will ever be exposed to this issue.
>>
>
> I've just given building gcc a try in an OpenIndiana VM, and get the following:
>
> ld: fatal: option -z has illegal argument 'relax=transtls'
> ld: fatal: flags processing errors
> collect2: error: ld returned 1 exit status
>
> $ ld --version
> ld: Software Generation Utilities - Solaris Link Editors: 5.11-1.1756 (illumos)
>
> My fatal mistake of course was not configuring with
> --with-ld=/usr/gnu/bin/ld, however it is notable that not all Solaris
> linkers support this relax=transtls option.
I finally got back to this and did some experiments of my own: even the
latest Illumos ld doesn't implement -z relax=transtls, neither has it
fixed the underlying bug, so it's useless for 64-bit Illumos/x86.
The following patch checks for those conditions (ld support for -z
relax=transtls or gld in use) and only enables libphobos if they are
met.
I had to move the whole enable_libphobos/LIBPHOBOS_SUPPORTED block down
in configure.ac so it's able to use the results of the augmented
DRUNTIME_OS_LINK_SPEC.
While I didn't test the patch on Illumos (gcc builds inside a VM are
slow), I tried it on Solaris 10/x86 with gas/ld and gas/gld (and an
improved version of the patch for PR d/88238) where it behaved as
expected. I've also included a previous version in a Solaris 11/x86
bootstrap.
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
2019-04-25 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* m4/druntime/os.m4 (DRUNTIME_OS_LINK_SPEC): Only use -z
relax=transtls if linker supports it.
* configure.ac (enable_libphobos, LIBPHOBOS_SUPPORTED): Move down.
(x86_64-*-solaris2.* | i?86-*-solaris2.*): Only
mark supported with either gld or ld -z relax=transtls.
* configure: Regenerate.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: solx64-libphobos-ld-transtls.patch --]
[-- Type: text/x-patch, Size: 4219 bytes --]
# HG changeset patch
# Parent c76abee7081bb8c24b2ca6f55749d092ae8cf3ea
Check if Solaris ld supports -z relax=transtls
diff --git a/libphobos/configure.ac b/libphobos/configure.ac
--- a/libphobos/configure.ac
+++ b/libphobos/configure.ac
@@ -113,42 +113,6 @@ AC_SUBST(phobos_compiler_shared_flag)
lt_prog_compiler_pic_D="$phobos_compiler_shared_flag"
pic_mode='default'
-AC_MSG_CHECKING([for --enable-libphobos])
-AC_ARG_ENABLE(libphobos,
- [AS_HELP_STRING([--enable-libphobos], [Enable libphobos])])
-AC_MSG_RESULT($enable_libphobos)
-
-# See if supported.
-unset LIBPHOBOS_SUPPORTED
-AC_MSG_CHECKING([for host support for libphobos])
-. ${srcdir}/configure.tgt
-case ${host} in
- x86_64-*-solaris2.* | i?86-*-solaris2.*)
- # libphobos doesn't compile with the Solaris/x86 assembler due to a
- # relatively low linelength limit.
- as_prog=`$CC -print-prog-name=as`
- if test -n "$as_prog" && $as_prog -v /dev/null 2>&1 | grep GNU > /dev/null 2>&1; then
- druntime_cv_use_gas=yes;
- else
- druntime_cv_use_gas=no;
- fi
- rm -f a.out
- if test x$druntime_cv_use_gas = xno; then
- LIBPHOBOS_SUPPORTED=no
- fi
- ;;
-esac
-AC_MSG_RESULT($LIBPHOBOS_SUPPORTED)
-
-# Decide if it's usable.
-case $LIBPHOBOS_SUPPORTED:$enable_libphobos in
-*:no) use_libphobos=no ;;
-*:yes) use_libphobos=yes ;;
-yes:*) use_libphobos=yes ;;
-*:*) use_libphobos=no ;;
-esac
-AM_CONDITIONAL(ENABLE_LIBPHOBOS, test x$use_libphobos = xyes)
-
# Determine what GCC version number to use in filesystem paths.
GCC_BASE_VER
@@ -184,6 +148,46 @@ DRUNTIME_LIBRARIES_NET
DRUNTIME_LIBRARIES_ZLIB
DRUNTIME_INSTALL_DIRECTORIES
+AC_MSG_CHECKING([for --enable-libphobos])
+AC_ARG_ENABLE(libphobos,
+ [AS_HELP_STRING([--enable-libphobos], [Enable libphobos])])
+AC_MSG_RESULT($enable_libphobos)
+
+# See if supported.
+unset LIBPHOBOS_SUPPORTED
+AC_MSG_CHECKING([for host support for libphobos])
+. ${srcdir}/configure.tgt
+case ${host} in
+ x86_64-*-solaris2.* | i?86-*-solaris2.*)
+ # libphobos doesn't compile with the Solaris/x86 assembler due to a
+ # relatively low linelength limit.
+ as_prog=`$CC -print-prog-name=as`
+ if test -n "$as_prog" && $as_prog -v /dev/null 2>&1 | grep GNU > /dev/null 2>&1; then
+ druntime_cv_use_gas=yes;
+ else
+ druntime_cv_use_gas=no;
+ fi
+ rm -f a.out
+ if test x$druntime_cv_use_gas = xno; then
+ LIBPHOBOS_SUPPORTED=no
+ fi
+ # 64-bit D execution fails with Solaris ld without -z relax=transtls support.
+ if test "$druntime_ld_gld" = "no" && test "$druntime_ld_relax_transtls" = "no"; then
+ LIBPHOBOS_SUPPORTED=no
+ fi
+ ;;
+esac
+AC_MSG_RESULT($LIBPHOBOS_SUPPORTED)
+
+# Decide if it's usable.
+case $LIBPHOBOS_SUPPORTED:$enable_libphobos in
+*:no) use_libphobos=no ;;
+*:yes) use_libphobos=yes ;;
+yes:*) use_libphobos=yes ;;
+*:*) use_libphobos=no ;;
+esac
+AM_CONDITIONAL(ENABLE_LIBPHOBOS, test x$use_libphobos = xyes)
+
# Add drtbegin.o/drtend.o to startfile/endfile specs in libgphobos.spec
if test "$DCFG_MINFO_BRACKETING" = "false"; then
DRTSTUFF_SPEC=$srcdir/src/drtstuff.spec
diff --git a/libphobos/m4/druntime/os.m4 b/libphobos/m4/druntime/os.m4
--- a/libphobos/m4/druntime/os.m4
+++ b/libphobos/m4/druntime/os.m4
@@ -209,10 +209,22 @@ AC_DEFUN([DRUNTIME_OS_LINK_SPEC],
# relocs. Work around by disabling TLS transitions. Not necessary
# on 32-bit x86, but cannot be distinguished reliably in specs.
druntime_ld_prog=`$CC -print-prog-name=ld`
+ druntime_ld_gld=no
+ druntime_ld_relax_transtls=no
if test -n "$druntime_ld_prog" \
&& $druntime_ld_prog -v 2>&1 | grep GNU > /dev/null 2>&1; then
- :
+ druntime_ld_gld=yes
else
+ echo 'int main (void) { return 0; }' > conftest.c
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -Wl,-z,relax=transtls"
+ if $CC $CFLAGS $LDFLAGS -o conftest conftest.c > /dev/null 2>&1; then
+ druntime_ld_relax_transtls=yes
+ fi
+ LDFLAGS="$save_LDFLAGS"
+ rm -f conftest.c conftest
+ fi
+ if test "$druntime_ld_relax_transtls" = "yes"; then
OS_LINK_SPEC='-z relax=transtls'
fi
;;
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [libphobos, build] Enable libphobos on Solaris 11/x86
2019-05-07 8:15 ` Rainer Orth
@ 2019-05-07 8:33 ` Iain Buclaw
2019-05-07 11:42 ` Rainer Orth
0 siblings, 1 reply; 11+ messages in thread
From: Iain Buclaw @ 2019-05-07 8:33 UTC (permalink / raw)
To: Rainer Orth; +Cc: gcc-patches
On Tue, 7 May 2019 at 10:15, Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote:
>
> Hi Iain,
>
> > On Tue, 19 Feb 2019 at 13:58, Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote:
> >>
> >> Hi Iain,
> >>
> >> >> Thanks. This will have to wait for
> >> >>
> >> >> [libphobos] Use sections_elf_shared.d on Solaris 11.5 (PR d/88150)
> >> >> https://gcc.gnu.org/ml/gcc-patches/2019-01/msg01661.html
> >> >
> >> > I'll make a fork of sections support tonight, as that seems to be the
> >> > right way forwards.
> >> >
> >> > Other parts will need upstreaming, I can do that as well.
> >>
> >> that would be great, thanks.
> >>
> >> >> and
> >> >> [libphobos] Work around lack of dlpi_tls_modid before Solaris 11.5
> >> >> https://gcc.gnu.org/ml/gcc-patches/2019-01/msg01664.html
> >> >>
> >> >
> >> > Johannes has already commented there, and he is right about needing a
> >> > way to get tls data from DSOs.
> >>
> >> Understood. Maybe I can find a way to generalize the hack derived from
> >> sections_ldc.d to TLS segments outside the executable.
> >>
> >> >> of course. Maybe even
> >> >>
> >> >> [libphobos] Work around Solaris ld bug linking __tls_get_addr on
> >> >> 64-bit x86
> >> >> https://gcc.gnu.org/ml/gcc-patches/2019-01/msg01663.html
> >> >>
> >> >> will be needed depending on whether a proper ld fix makes it into
> >> >> Solaris 11.5 or not.
> >> >
> >> > I'm not sure about this, but haven't looked at it properly just yet.
> >>
> >> I don't think you need concern yourself with this very much: it's just a
> >> hack around a Solaris ld bug, suggested by the Solaris linker engineers
> >> for the moment. Once the dlpi_tls_modid patch lands in Solaris 11.5
> >> (this week or next), I'll ask if they see a chance to have that bug
> >> fixed in time for the Solaris 11.5 release. If so, nobody besides
> >> myself will ever be exposed to this issue.
> >>
> >
> > I've just given building gcc a try in an OpenIndiana VM, and get the following:
> >
> > ld: fatal: option -z has illegal argument 'relax=transtls'
> > ld: fatal: flags processing errors
> > collect2: error: ld returned 1 exit status
> >
> > $ ld --version
> > ld: Software Generation Utilities - Solaris Link Editors: 5.11-1.1756 (illumos)
> >
> > My fatal mistake of course was not configuring with
> > --with-ld=/usr/gnu/bin/ld, however it is notable that not all Solaris
> > linkers support this relax=transtls option.
>
> I finally got back to this and did some experiments of my own: even the
> latest Illumos ld doesn't implement -z relax=transtls, neither has it
> fixed the underlying bug, so it's useless for 64-bit Illumos/x86.
>
> The following patch checks for those conditions (ld support for -z
> relax=transtls or gld in use) and only enables libphobos if they are
> met.
>
> I had to move the whole enable_libphobos/LIBPHOBOS_SUPPORTED block down
> in configure.ac so it's able to use the results of the augmented
> DRUNTIME_OS_LINK_SPEC.
>
> While I didn't test the patch on Illumos (gcc builds inside a VM are
> slow), I tried it on Solaris 10/x86 with gas/ld and gas/gld (and an
> improved version of the patch for PR d/88238) where it behaved as
> expected. I've also included a previous version in a Solaris 11/x86
> bootstrap.
>
OK, thanks for having a look into it.
--
Iain
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [libphobos, build] Enable libphobos on Solaris 11/x86
2019-05-07 8:33 ` Iain Buclaw
@ 2019-05-07 11:42 ` Rainer Orth
0 siblings, 0 replies; 11+ messages in thread
From: Rainer Orth @ 2019-05-07 11:42 UTC (permalink / raw)
To: Iain Buclaw; +Cc: gcc-patches
Hi Iain,
>> > I've just given building gcc a try in an OpenIndiana VM, and get the
>> > following:
>> >
>> > ld: fatal: option -z has illegal argument 'relax=transtls'
>> > ld: fatal: flags processing errors
>> > collect2: error: ld returned 1 exit status
>> >
>> > $ ld --version
>> > ld: Software Generation Utilities - Solaris Link Editors: 5.11-1.1756
>> > (illumos)
>> >
>> > My fatal mistake of course was not configuring with
>> > --with-ld=/usr/gnu/bin/ld, however it is notable that not all Solaris
>> > linkers support this relax=transtls option.
>>
>> I finally got back to this and did some experiments of my own: even the
>> latest Illumos ld doesn't implement -z relax=transtls, neither has it
>> fixed the underlying bug, so it's useless for 64-bit Illumos/x86.
>>
>> The following patch checks for those conditions (ld support for -z
>> relax=transtls or gld in use) and only enables libphobos if they are
>> met.
>>
>> I had to move the whole enable_libphobos/LIBPHOBOS_SUPPORTED block down
>> in configure.ac so it's able to use the results of the augmented
>> DRUNTIME_OS_LINK_SPEC.
>>
>> While I didn't test the patch on Illumos (gcc builds inside a VM are
>> slow), I tried it on Solaris 10/x86 with gas/ld and gas/gld (and an
>> improved version of the patch for PR d/88238) where it behaved as
>> expected. I've also included a previous version in a Solaris 11/x86
>> bootstrap.
>>
>
> OK, thanks for having a look into it.
installed on mainline now. I guess this should be backported to gcc-9
branch after some soak time?
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2019-05-07 11:42 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-29 12:44 [libphobos, build] Enable libphobos on Solaris 11/x86 Rainer Orth
2019-02-18 22:44 ` Iain Buclaw
2019-02-19 9:32 ` Rainer Orth
2019-02-19 12:38 ` Iain Buclaw
2019-02-19 12:58 ` Rainer Orth
2019-04-14 16:41 ` Iain Buclaw
2019-04-14 20:59 ` Rainer Orth
2019-05-07 8:15 ` Rainer Orth
2019-05-07 8:33 ` Iain Buclaw
2019-05-07 11:42 ` Rainer Orth
2019-04-14 11:02 ` Rainer Orth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).