public inbox for jit@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Seeking Release Manager approval for: [PATCH] jit: fix link on OS X and Solaris (PR jit/64089 and PR jit/84288)
  2018-01-01  0:00               ` David Malcolm
@ 2018-01-01  0:00                 ` Richard Biener
  0 siblings, 0 replies; 13+ messages in thread
From: Richard Biener @ 2018-01-01  0:00 UTC (permalink / raw)
  To: David Malcolm; +Cc: Rainer Orth, jakub, FX, gcc patches, jit

On Tue, 20 Mar 2018, David Malcolm wrote:

> On Wed, 2018-03-21 at 00:39 +0100, Rainer Orth wrote:
> > Hi Malcolm,
> > 
> > > > I've now tested the patch (together with the one from PR
> > > > jit/84288
> > > > for
> > > > several remaining issues).  I've needed another snippet for
> > > > Solaris/SPARC which links libkstat into xgcc and needs it in
> > > > libgccjit.so, too.  Bootstrapped without regressions on
> > > > i386-pc-solaris2.11 and sparc-sun-solaris2.11.
> > > 
> > > FWIW I've successfully tested this on x86_64-pc-linux-gnu
> > > (regenerating
> > > the gcc/configure), and, as jit maintainer, it looks good to me
> > > [1],
> > > though it may still need RM approval given stage 4.
> > 
> > thanks for trying this.
> > 
> > > [1] ...though I have a slight preference for listing
> > > $(EXTRA_GCC_LIBS) on the same line as $(EXTRA_GCC_OBJS) in
> > > jit/Make-
> > > lang.in, so that these two items needed to embed the driver code
> > > into
> > > the libgccjit shared library are visually grouped together.
> > 
> > I've selected the location of $(EXTRA_GCC_LIBS) in the link line to
> > match what gcc/Makefile.in does for xgcc etc.
> 
> Indeed, I don't want to bikeshed it - I care much more about whether it
> works ;)

I'm fine with this patch.

Richard.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] jit: fix link on OS X and Solaris (PR jit/64089 and PR jit/84288)
       [not found] <78D7B2DA-5677-4211-9C4E-F7B1B5AB51B5@gmail.com>
@ 2018-01-01  0:00 ` David Malcolm
  2018-01-01  0:00   ` Rainer Orth
  2018-01-01  0:00   ` FX
  0 siblings, 2 replies; 13+ messages in thread
From: David Malcolm @ 2018-01-01  0:00 UTC (permalink / raw)
  To: FX, Rainer Orth, gcc-patches, jit; +Cc: David Malcolm

libgccjit fails to link on OS X and Solaris due to jit/Make-lang.in,
due to the assumption there that the linker is GNU ld.  Specifically,
jit/Make-lang.in hardcodes the use of two options: --version-script
and -soname.

* on Darwin, --version-script doesn't seem to exist in the linker, and
  it uses -install_name rather than -soname.

* on Solaris, ld doesn't support --version-script.  However, the version
  script used for libgccjit.so doesn't use any gld extensions, so one can
  just use -M instead.

This patch fixes these issues by using variables emitted by gcc's "configure"
rather than hardcoding the options in jit/Make-lang.in.

It's based on the first part of Rainer's patch for PR jit/84288, but I
made the following changes:
* the GNU ld case in configure.ac wasn't setting ld_version_script_option.
  I set it to "--version-script" for that case.
* I moved the:
    LD_VERSION_SCRIPT_OPTION = @ld_version_script_option@
  from gcc/jit/Make-lang.in to gcc/Makefile.in, as the Make-lang.in files
  aren't substituted, only the gcc/Makefile.in.
  Rainer: how did this work for you?
* added LD_SONAME_OPTION, done in the same way
* conditionalized the usage of the options in Make-lang.in to cope with
  empty LD_VERSION_SCRIPT_OPTION (as is presumably the case on OS X).
  I used ($if condition,then-part[,else-part]) for this.
  I had to add a $(COMMA) since the "then-part" contains commas, which
  need to be treated as part of the "then-part", rather than separators
  for the "else-part".
  Hopefully this is compatible with every "make" implementation that we
  support.

Successfully bootstrapped&regrtested on x86_64-pc-linux-gnu.

I lightly tested the not-recognized case by hacking up the configure.ac
(on x86_64-pc-linux-gnu) and verifying that it links, and that a
smoketest of jit.dg/test-factorial works.

Does this fix the jit linker issues on OS X and Solaris?
(I didn't include the autogenerate configure changes)

gcc/ChangeLog:
	PR jit/64089
	PR jit/84288
	* Makefile.in (LD_VERSION_SCRIPT_OPTION, LD_SONAME_OPTION): New.
	* configure: Regenerate.
	* configure.ac ("linker --version-script option"): New.
	("linker soname option"): New.

gcc/jit/ChangeLog:
	PR jit/64089
	PR jit/84288
	* Make-lang.in (COMMA): New.
	(LIBGCCJIT_VERSION_SCRIPT_OPTION): New.
	(LIBGCCJIT_SONAME_OPTION): New.
	(jit): Move --version-script and -soname linker options to the
	above.
---
 gcc/Makefile.in      |  4 ++++
 gcc/configure.ac     | 38 ++++++++++++++++++++++++++++++++++++++
 gcc/jit/Make-lang.in | 17 +++++++++++++++--
 3 files changed, 57 insertions(+), 2 deletions(-)

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 6c37e46..903da58 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -1116,6 +1116,10 @@ endif
 
 LANG_MAKEFRAGS = @all_lang_makefrags@
 
+# Used by gcc/jit/Make-lang.in
+LD_VERSION_SCRIPT_OPTION = @ld_version_script_option@
+LD_SONAME_OPTION = @ld_soname_option@
+
 # Flags to pass to recursive makes.
 # CC is set by configure.
 # ??? The choices here will need some experimenting with.
diff --git a/gcc/configure.ac b/gcc/configure.ac
index b7f9728..265920c 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -3640,6 +3640,44 @@ if test x"$gcc_cv_ld_static_dynamic" = xyes; then
 fi
 AC_MSG_RESULT($gcc_cv_ld_static_dynamic)
 
+AC_MSG_CHECKING(linker --version-script option)
+gcc_cv_ld_version_script=no
+ld_version_script_option='--version-script'
+if test $in_tree_ld = yes || test x"$gnu_ld" = xyes; then
+  gcc_cv_ld_version_script=yes
+  ld_version_script_option='--version-script'
+elif test x$gcc_cv_ld != x; then
+  case "$target" in
+    # Solaris 2 ld always supports -M.  It also supports a subset of
+    # --version-script since Solaris 11.4, but requires
+    # -z gnu-version-script-compat to activate.
+    *-*-solaris2*)
+      gcc_cv_ld_version_script=yes
+      ld_version_script_option='-M'
+      ;;
+  esac
+fi
+# Don't AC_DEFINE result, only used in jit/Make-lang.in so far.
+AC_MSG_RESULT($gcc_cv_ld_version_script)
+AC_SUBST(ld_version_script_option)
+
+AC_MSG_CHECKING(linker soname option)
+gcc_cv_ld_soname=no
+if test $in_tree_ld = yes || test x"$gnu_ld" = xyes; then
+  gcc_cv_ld_soname=yes
+  ld_soname_option='-soname'
+elif test x$gcc_cv_ld != x; then
+  case "$target" in
+    *-*-darwin*)
+      gcc_cv_ld_soname=yes
+      ld_soname_option='-install_name'
+      ;;
+  esac
+fi
+# Don't AC_DEFINE result, only used in jit/Make-lang.in so far.
+AC_MSG_RESULT($gcc_cv_ld_soname)
+AC_SUBST(ld_soname_option)
+
 if test x"$demangler_in_ld" = xyes; then
   AC_MSG_CHECKING(linker --demangle support)
   gcc_cv_ld_demangle=no
diff --git a/gcc/jit/Make-lang.in b/gcc/jit/Make-lang.in
index d4362a9..ba78f8e 100644
--- a/gcc/jit/Make-lang.in
+++ b/gcc/jit/Make-lang.in
@@ -51,6 +51,19 @@ LIBGCCJIT_FILENAME = \
 LIBGCCJIT_LINKER_NAME_SYMLINK = $(LIBGCCJIT_LINKER_NAME)
 LIBGCCJIT_SONAME_SYMLINK = $(LIBGCCJIT_SONAME)
 
+# Conditionalize the use of the LD_VERSION_SCRIPT_OPTION and
+# LD_SONAME_OPTION depending if configure found them, using $(if)
+# We have to define a COMMA here, otherwise the commas in the "true"
+# result are treated as separators by the $(if).
+COMMA := ,
+LIBGCCJIT_VERSION_SCRIPT_OPTION = \
+	$(if $(LD_VERSION_SCRIPT_OPTION),\
+	  -Wl$(COMMA)$(LD_VERSION_SCRIPT_OPTION)$(COMMA)$(srcdir)/jit/libgccjit.map)
+
+LIBGCCJIT_SONAME_OPTION = \
+	$(if $(LD_SONAME_OPTION), \
+	     -Wl$(COMMA)$(LD_SONAME_OPTION)$(COMMA)$(LIBGCCJIT_SONAME))
+
 jit: $(LIBGCCJIT_FILENAME) \
 	$(LIBGCCJIT_SYMLINK) \
 	$(LIBGCCJIT_LINKER_NAME_SYMLINK) \
@@ -85,8 +98,8 @@ $(LIBGCCJIT_FILENAME): $(jit_OBJS) \
 	     $(jit_OBJS) libbackend.a libcommon-target.a libcommon.a \
 	     $(CPPLIB) $(LIBDECNUMBER) $(LIBS) $(BACKENDLIBS) \
 	     $(EXTRA_GCC_OBJS) \
-	     -Wl,--version-script=$(srcdir)/jit/libgccjit.map \
-	     -Wl,-soname,$(LIBGCCJIT_SONAME)
+	     $(LIBGCCJIT_VERSION_SCRIPT_OPTION) \
+	     $(LIBGCCJIT_SONAME_OPTION)
 
 $(LIBGCCJIT_SONAME_SYMLINK): $(LIBGCCJIT_FILENAME)
 	ln -sf $(LIBGCCJIT_FILENAME) $(LIBGCCJIT_SONAME_SYMLINK)
-- 
1.8.5.3

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] jit: fix link on OS X and Solaris (PR jit/64089 and PR jit/84288)
  2018-01-01  0:00 ` [PATCH] jit: fix link on OS X and Solaris (PR jit/64089 and PR jit/84288) David Malcolm
  2018-01-01  0:00   ` Rainer Orth
@ 2018-01-01  0:00   ` FX
  2018-01-01  0:00     ` FX
  1 sibling, 1 reply; 13+ messages in thread
From: FX @ 2018-01-01  0:00 UTC (permalink / raw)
  To: David Malcolm; +Cc: Rainer Orth, gcc-patches, jit

> Does this fix the jit linker issues on OS X and Solaris?

The patch fails to bootstrap on x86_64-apple-darwin17. gcc/config.log says:

gcc_cv_ld_version_script=no
ld_version_script_option='--version-script’

gcc/Makefile says:

LD_VERSION_SCRIPT_OPTION = --version-script
LD_SONAME_OPTION = -install_name

which makes it try to link with:

	      -Wl,--version-script,../../trunk/gcc/jit/libgccjit.map \
	      -Wl,-install_name,libgccjit.so.0

which fails with: ld: unknown option: --version-script

I think the patch to gcc/configure.ac should be:

+AC_MSG_CHECKING(linker --version-script option)
+gcc_cv_ld_version_script=no
+ld_version_script_option=''


FX

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Seeking Release Manager approval for: [PATCH] jit: fix link on OS X and Solaris (PR jit/64089 and PR jit/84288)
  2018-01-01  0:00           ` David Malcolm
@ 2018-01-01  0:00             ` Rainer Orth
  2018-01-01  0:00               ` David Malcolm
  0 siblings, 1 reply; 13+ messages in thread
From: Rainer Orth @ 2018-01-01  0:00 UTC (permalink / raw)
  To: David Malcolm; +Cc: jakub, Richard Biener, FX, gcc patches, jit

Hi Malcolm,

>> I've now tested the patch (together with the one from PR jit/84288
>> for
>> several remaining issues).  I've needed another snippet for
>> Solaris/SPARC which links libkstat into xgcc and needs it in
>> libgccjit.so, too.  Bootstrapped without regressions on
>> i386-pc-solaris2.11 and sparc-sun-solaris2.11.
>
> FWIW I've successfully tested this on x86_64-pc-linux-gnu (regenerating
> the gcc/configure), and, as jit maintainer, it looks good to me [1],
> though it may still need RM approval given stage 4.

thanks for trying this.

> [1] ...though I have a slight preference for listing
> $(EXTRA_GCC_LIBS) on the same line as $(EXTRA_GCC_OBJS) in jit/Make-
> lang.in, so that these two items needed to embed the driver code into
> the libgccjit shared library are visually grouped together.

I've selected the location of $(EXTRA_GCC_LIBS) in the link line to
match what gcc/Makefile.in does for xgcc etc.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] jit: fix link on OS X and Solaris (PR jit/64089 and PR jit/84288)
  2018-01-01  0:00   ` FX
@ 2018-01-01  0:00     ` FX
  2018-01-01  0:00       ` Seeking Release Manager approval for: " David Malcolm
  2018-01-01  0:00       ` FX
  0 siblings, 2 replies; 13+ messages in thread
From: FX @ 2018-01-01  0:00 UTC (permalink / raw)
  To: David Malcolm, Rainer Orth, gcc patches, jit

[-- Attachment #1: Type: text/plain, Size: 153 bytes --]

I can confirm that, with the attached revised patch, a bootstrap with --enable-languages=c,c++,jit --enable-host-shared is successful on macOS.

FX


[-- Attachment #2: patch --]
[-- Type: application/octet-stream, Size: 6365 bytes --]

Index: gcc/Makefile.in
===================================================================
--- gcc/Makefile.in	(revision 257657)
+++ gcc/Makefile.in	(working copy)
@@ -1116,6 +1116,10 @@ endif
 
 LANG_MAKEFRAGS = @all_lang_makefrags@
 
+# Used by gcc/jit/Make-lang.in
+LD_VERSION_SCRIPT_OPTION = @ld_version_script_option@
+LD_SONAME_OPTION = @ld_soname_option@
+
 # Flags to pass to recursive makes.
 # CC is set by configure.
 # ??? The choices here will need some experimenting with.
Index: gcc/configure
===================================================================
--- gcc/configure	(revision 257657)
+++ gcc/configure	(working copy)
@@ -680,6 +680,8 @@ zlibdir
 HOST_LIBS
 enable_default_ssp
 thin_archive_support
+ld_soname_option
+ld_version_script_option
 libgcc_visibility
 gcc_cv_readelf
 gcc_cv_objdump
@@ -18446,7 +18448,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18449 "configure"
+#line 18451 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -18552,7 +18554,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18555 "configure"
+#line 18557 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -24453,6 +24455,48 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_ld_static_dynamic" >&5
 $as_echo "$gcc_cv_ld_static_dynamic" >&6; }
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking linker --version-script option" >&5
+$as_echo_n "checking linker --version-script option... " >&6; }
+gcc_cv_ld_version_script=no
+ld_version_script_option=''
+if test $in_tree_ld = yes || test x"$gnu_ld" = xyes; then
+  gcc_cv_ld_version_script=yes
+  ld_version_script_option='--version-script'
+elif test x$gcc_cv_ld != x; then
+  case "$target" in
+    # Solaris 2 ld always supports -M.  It also supports a subset of
+    # --version-script since Solaris 11.4, but requires
+    # -z gnu-version-script-compat to activate.
+    *-*-solaris2*)
+      gcc_cv_ld_version_script=yes
+      ld_version_script_option='-M'
+      ;;
+  esac
+fi
+# Don't AC_DEFINE result, only used in jit/Make-lang.in so far.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_ld_version_script" >&5
+$as_echo "$gcc_cv_ld_version_script" >&6; }
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking linker soname option" >&5
+$as_echo_n "checking linker soname option... " >&6; }
+gcc_cv_ld_soname=no
+if test $in_tree_ld = yes || test x"$gnu_ld" = xyes; then
+  gcc_cv_ld_soname=yes
+  ld_soname_option='-soname'
+elif test x$gcc_cv_ld != x; then
+  case "$target" in
+    *-*-darwin*)
+      gcc_cv_ld_soname=yes
+      ld_soname_option='-install_name'
+      ;;
+  esac
+fi
+# Don't AC_DEFINE result, only used in jit/Make-lang.in so far.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_ld_soname" >&5
+$as_echo "$gcc_cv_ld_soname" >&6; }
+
+
 if test x"$demangler_in_ld" = xyes; then
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking linker --demangle support" >&5
 $as_echo_n "checking linker --demangle support... " >&6; }
@@ -27870,6 +27914,7 @@ if test $gcc_cv_as_dwarf2_debug_view = y
 $as_echo "#define HAVE_AS_DWARF2_DEBUG_VIEW 1" >>confdefs.h
 
 fi
+
     fi
  fi
 
Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac	(revision 257657)
+++ gcc/configure.ac	(working copy)
@@ -3655,6 +3655,44 @@ if test x"$gcc_cv_ld_static_dynamic" = x
 fi
 AC_MSG_RESULT($gcc_cv_ld_static_dynamic)
 
+AC_MSG_CHECKING(linker --version-script option)
+gcc_cv_ld_version_script=no
+ld_version_script_option=''
+if test $in_tree_ld = yes || test x"$gnu_ld" = xyes; then
+  gcc_cv_ld_version_script=yes
+  ld_version_script_option='--version-script'
+elif test x$gcc_cv_ld != x; then
+  case "$target" in
+    # Solaris 2 ld always supports -M.  It also supports a subset of
+    # --version-script since Solaris 11.4, but requires
+    # -z gnu-version-script-compat to activate.
+    *-*-solaris2*)
+      gcc_cv_ld_version_script=yes
+      ld_version_script_option='-M'
+      ;;
+  esac
+fi
+# Don't AC_DEFINE result, only used in jit/Make-lang.in so far.
+AC_MSG_RESULT($gcc_cv_ld_version_script)
+AC_SUBST(ld_version_script_option)
+
+AC_MSG_CHECKING(linker soname option)
+gcc_cv_ld_soname=no
+if test $in_tree_ld = yes || test x"$gnu_ld" = xyes; then
+  gcc_cv_ld_soname=yes
+  ld_soname_option='-soname'
+elif test x$gcc_cv_ld != x; then
+  case "$target" in
+    *-*-darwin*)
+      gcc_cv_ld_soname=yes
+      ld_soname_option='-install_name'
+      ;;
+  esac
+fi
+# Don't AC_DEFINE result, only used in jit/Make-lang.in so far.
+AC_MSG_RESULT($gcc_cv_ld_soname)
+AC_SUBST(ld_soname_option)
+
 if test x"$demangler_in_ld" = xyes; then
   AC_MSG_CHECKING(linker --demangle support)
   gcc_cv_ld_demangle=no
Index: gcc/jit/Make-lang.in
===================================================================
--- gcc/jit/Make-lang.in	(revision 257657)
+++ gcc/jit/Make-lang.in	(working copy)
@@ -51,6 +51,19 @@ LIBGCCJIT_FILENAME = \
 LIBGCCJIT_LINKER_NAME_SYMLINK = $(LIBGCCJIT_LINKER_NAME)
 LIBGCCJIT_SONAME_SYMLINK = $(LIBGCCJIT_SONAME)
 
+# Conditionalize the use of the LD_VERSION_SCRIPT_OPTION and
+# LD_SONAME_OPTION depending if configure found them, using $(if)
+# We have to define a COMMA here, otherwise the commas in the "true"
+# result are treated as separators by the $(if).
+COMMA := ,
+LIBGCCJIT_VERSION_SCRIPT_OPTION = \
+       $(if $(LD_VERSION_SCRIPT_OPTION),\
+         -Wl$(COMMA)$(LD_VERSION_SCRIPT_OPTION)$(COMMA)$(srcdir)/jit/libgccjit.map)
+
+LIBGCCJIT_SONAME_OPTION = \
+       $(if $(LD_SONAME_OPTION), \
+            -Wl$(COMMA)$(LD_SONAME_OPTION)$(COMMA)$(LIBGCCJIT_SONAME))
+
 jit: $(LIBGCCJIT_FILENAME) \
 	$(LIBGCCJIT_SYMLINK) \
 	$(LIBGCCJIT_LINKER_NAME_SYMLINK) \
@@ -85,8 +98,8 @@ $(LIBGCCJIT_FILENAME): $(jit_OBJS) \
 	     $(jit_OBJS) libbackend.a libcommon-target.a libcommon.a \
 	     $(CPPLIB) $(LIBDECNUMBER) $(LIBS) $(BACKENDLIBS) \
 	     $(EXTRA_GCC_OBJS) \
-	     -Wl,--version-script=$(srcdir)/jit/libgccjit.map \
-	     -Wl,-soname,$(LIBGCCJIT_SONAME)
+	     $(LIBGCCJIT_VERSION_SCRIPT_OPTION) \
+	     $(LIBGCCJIT_SONAME_OPTION)
 
 $(LIBGCCJIT_SONAME_SYMLINK): $(LIBGCCJIT_FILENAME)
 	ln -sf $(LIBGCCJIT_FILENAME) $(LIBGCCJIT_SONAME_SYMLINK)

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Seeking Release Manager approval for: [PATCH] jit: fix link on OS X and Solaris (PR jit/64089 and PR jit/84288)
  2018-01-01  0:00       ` Seeking Release Manager approval for: " David Malcolm
  2018-01-01  0:00         ` Jakub Jelinek
@ 2018-01-01  0:00         ` Rainer Orth
  2018-01-01  0:00           ` David Malcolm
  1 sibling, 1 reply; 13+ messages in thread
From: Rainer Orth @ 2018-01-01  0:00 UTC (permalink / raw)
  To: David Malcolm; +Cc: jakub, Richard Biener, FX, gcc patches, jit

[-- Attachment #1: Type: text/plain, Size: 1293 bytes --]

Hi David,

> Release managers:
>
> I'd like to apply FX's patch here:
>   https://gcc.gnu.org/ml/gcc-patches/2018-02/msg00881/patch
> to trunk, to fix the build of jit on OS X, and to make it easier to fix
> it on Solaris.
>
> This involves touching gcc/configure.ac (and configure).
>
> I've successfully bootstrapped and regression-tested it on x86_64-pc-
> linux-gnu.  FX reports above that it fixes the build on macOS, and
> Rainer has an (untested) patch on top of it that ought to fix the build
> on Solaris:
>   https://gcc.gnu.org/ml/gcc-patches/2018-02/msg00835.html

I've now tested the patch (together with the one from PR jit/84288 for
several remaining issues).  I've needed another snippet for
Solaris/SPARC which links libkstat into xgcc and needs it in
libgccjit.so, too.  Bootstrapped without regressions on
i386-pc-solaris2.11 and sparc-sun-solaris2.11.

Ok for mainline?

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


2018-03-20  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	gcc/jit:
	PR jit/84288
	* Make-lang.in ($(LIBGCCJIT_FILENAME)): Add $(EXTRA_GCC_LIBS).

	gcc:
	PR jit/84288
	* configure.ac (gcc_cv_ld_soname) <*-*-solaris2*>: Set.
	* configure: Regenerate.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: sol2-jit-no-gld.patch --]
[-- Type: text/x-patch, Size: 1170 bytes --]

# HG changeset patch
# Parent  401d306950a09a18dcff23bc4f3086cce131450b
Enable jit on Solaris without GNU ld

diff --git a/gcc/configure.ac b/gcc/configure.ac
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -3715,6 +3715,12 @@ elif test x$gcc_cv_ld != x; then
       gcc_cv_ld_soname=yes
       ld_soname_option='-install_name'
       ;;
+    # Solaris 2 ld always supports -h.  It also supports --soname for GNU
+    # ld compatiblity since some Solaris 10 update.
+    *-*-solaris2*)
+      gcc_cv_ld_soname=yes
+      ld_soname_option='-h'
+      ;;
   esac
 fi
 # Don't AC_DEFINE result, only used in jit/Make-lang.in so far.
diff --git a/gcc/jit/Make-lang.in b/gcc/jit/Make-lang.in
--- a/gcc/jit/Make-lang.in
+++ b/gcc/jit/Make-lang.in
@@ -96,7 +96,7 @@ jit-warn = $(STRICT_WARN)
 	$(EXTRA_GCC_OBJS)
 	+$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ -shared \
 	     $(jit_OBJS) libbackend.a libcommon-target.a libcommon.a \
-	     $(CPPLIB) $(LIBDECNUMBER) $(LIBS) $(BACKENDLIBS) \
+	     $(CPPLIB) $(LIBDECNUMBER) $(EXTRA_GCC_LIBS) $(LIBS) $(BACKENDLIBS) \
 	     $(EXTRA_GCC_OBJS) \
 	     $(LIBGCCJIT_VERSION_SCRIPT_OPTION) \
 	     $(LIBGCCJIT_SONAME_OPTION)

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Seeking Release Manager approval for: [PATCH] jit: fix link on OS X and Solaris (PR jit/64089 and PR jit/84288)
  2018-01-01  0:00         ` Rainer Orth
@ 2018-01-01  0:00           ` David Malcolm
  2018-01-01  0:00             ` Rainer Orth
  0 siblings, 1 reply; 13+ messages in thread
From: David Malcolm @ 2018-01-01  0:00 UTC (permalink / raw)
  To: Rainer Orth; +Cc: jakub, Richard Biener, FX, gcc patches, jit

On Tue, 2018-03-20 at 09:38 +0100, Rainer Orth wrote:
> Hi David,
> 
> > Release managers:
> > 
> > I'd like to apply FX's patch here:
> >   https://gcc.gnu.org/ml/gcc-patches/2018-02/msg00881/patch
> > to trunk, to fix the build of jit on OS X, and to make it easier to
> > fix
> > it on Solaris.
> > 
> > This involves touching gcc/configure.ac (and configure).
> > 
> > I've successfully bootstrapped and regression-tested it on x86_64-
> > pc-
> > linux-gnu.  FX reports above that it fixes the build on macOS, and
> > Rainer has an (untested) patch on top of it that ought to fix the
> > build
> > on Solaris:
> >   https://gcc.gnu.org/ml/gcc-patches/2018-02/msg00835.html
> 
> I've now tested the patch (together with the one from PR jit/84288
> for
> several remaining issues).  I've needed another snippet for
> Solaris/SPARC which links libkstat into xgcc and needs it in
> libgccjit.so, too.  Bootstrapped without regressions on
> i386-pc-solaris2.11 and sparc-sun-solaris2.11.

FWIW I've successfully tested this on x86_64-pc-linux-gnu (regenerating
the gcc/configure), and, as jit maintainer, it looks good to me [1],
though it may still need RM approval given stage 4.

Dave

[1] ...though I have a slight preference for listing
$(EXTRA_GCC_LIBS) on the same line as $(EXTRA_GCC_OBJS) in jit/Make-
lang.in, so that these two items needed to embed the driver code into
the libgccjit shared library are visually grouped together.

> Ok for mainline?
> 
> 	Rainer
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] jit: fix link on OS X and Solaris (PR jit/64089 and PR jit/84288)
  2018-01-01  0:00     ` FX
  2018-01-01  0:00       ` Seeking Release Manager approval for: " David Malcolm
@ 2018-01-01  0:00       ` FX
  1 sibling, 0 replies; 13+ messages in thread
From: FX @ 2018-01-01  0:00 UTC (permalink / raw)
  To: François-Xavier Coudert; +Cc: David Malcolm, Rainer Orth, gcc patches, jit

Hi David,

Any news on that patch?

Cheers,
FX

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Seeking Release Manager approval for: [PATCH] jit: fix link on OS X and Solaris (PR jit/64089 and PR jit/84288)
  2018-01-01  0:00     ` FX
@ 2018-01-01  0:00       ` David Malcolm
  2018-01-01  0:00         ` Jakub Jelinek
  2018-01-01  0:00         ` Rainer Orth
  2018-01-01  0:00       ` FX
  1 sibling, 2 replies; 13+ messages in thread
From: David Malcolm @ 2018-01-01  0:00 UTC (permalink / raw)
  To: jakub, Richard Biener; +Cc: FX, Rainer Orth, gcc patches, jit

On Wed, 2018-02-14 at 23:36 +0100, FX wrote:
> I can confirm that, with the attached revised patch, a bootstrap with
> --enable-languages=c,c++,jit --enable-host-shared is successful on
> macOS.
> 
> FX

Looks good to me; thanks for fixing.


Release managers:

I'd like to apply FX's patch here:
  https://gcc.gnu.org/ml/gcc-patches/2018-02/msg00881/patch
to trunk, to fix the build of jit on OS X, and to make it easier to fix
it on Solaris.

This involves touching gcc/configure.ac (and configure).

I've successfully bootstrapped and regression-tested it on x86_64-pc-
linux-gnu.  FX reports above that it fixes the build on macOS, and
Rainer has an (untested) patch on top of it that ought to fix the build
on Solaris:
  https://gcc.gnu.org/ml/gcc-patches/2018-02/msg00835.html

We're in stage 4, and the two bugs in question:
  PR jit/64089 ("libgccjit.so.0.0.1 linkage failure on darwin")
    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64089

  PR jit/84288 ("Support jit on Solaris")
    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84288
aren't regressions.

However, I believe this is a low-risk patch, and is mostly confined to
jit (and those targets).

Is it OK for trunk now, or does this need to wait until next stage 1?

Thanks
Dave

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Seeking Release Manager approval for: [PATCH] jit: fix link on OS X and Solaris (PR jit/64089 and PR jit/84288)
  2018-01-01  0:00             ` Rainer Orth
@ 2018-01-01  0:00               ` David Malcolm
  2018-01-01  0:00                 ` Richard Biener
  0 siblings, 1 reply; 13+ messages in thread
From: David Malcolm @ 2018-01-01  0:00 UTC (permalink / raw)
  To: Rainer Orth; +Cc: jakub, Richard Biener, FX, gcc patches, jit

On Wed, 2018-03-21 at 00:39 +0100, Rainer Orth wrote:
> Hi Malcolm,
> 
> > > I've now tested the patch (together with the one from PR
> > > jit/84288
> > > for
> > > several remaining issues).  I've needed another snippet for
> > > Solaris/SPARC which links libkstat into xgcc and needs it in
> > > libgccjit.so, too.  Bootstrapped without regressions on
> > > i386-pc-solaris2.11 and sparc-sun-solaris2.11.
> > 
> > FWIW I've successfully tested this on x86_64-pc-linux-gnu
> > (regenerating
> > the gcc/configure), and, as jit maintainer, it looks good to me
> > [1],
> > though it may still need RM approval given stage 4.
> 
> thanks for trying this.
> 
> > [1] ...though I have a slight preference for listing
> > $(EXTRA_GCC_LIBS) on the same line as $(EXTRA_GCC_OBJS) in
> > jit/Make-
> > lang.in, so that these two items needed to embed the driver code
> > into
> > the libgccjit shared library are visually grouped together.
> 
> I've selected the location of $(EXTRA_GCC_LIBS) in the link line to
> match what gcc/Makefile.in does for xgcc etc.

Indeed, I don't want to bikeshed it - I care much more about whether it
works ;)

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] jit: fix link on OS X and Solaris (PR jit/64089 and PR jit/84288)
  2018-01-01  0:00   ` Rainer Orth
@ 2018-01-01  0:00     ` Rainer Orth
  0 siblings, 0 replies; 13+ messages in thread
From: Rainer Orth @ 2018-01-01  0:00 UTC (permalink / raw)
  To: David Malcolm; +Cc: FX, gcc-patches, jit

[-- Attachment #1: Type: text/plain, Size: 550 bytes --]

Hi David,

>> * added LD_SONAME_OPTION, done in the same way
[...]
>> Does this fix the jit linker issues on OS X and Solaris?
>
> I'll give it a whirl tomorrow, including the jit-recording.c part of my
> patch to allow the build to complete.

actually, I've replaced the Makefile and configure parts of my patch
with yours and did a jit-only bootstrap on i386-pc-solaris2.11 with
as/ld and gas/ld.  Both went fine with a minor caveat: I noticed that
LD_SONAME_OPTION wasn't set in gcc/Makefile.  Fixed with the following
(so far untested) snippet:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: lso.patch --]
[-- Type: text/x-patch, Size: 521 bytes --]

diff --git a/gcc/configure.ac b/gcc/configure.ac
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -3715,6 +3715,12 @@ elif test x$gcc_cv_ld != x; then
       gcc_cv_ld_soname=yes
       ld_soname_option='-install_name'
       ;;
+    # Solaris 2 ld always supports -h.  It also supports --soname for GNU
+    # ld compatiblity since some Solaris 10 update.
+    *-*-solaris2*)
+      gcc_cv_ld_soname=yes
+      ld_soname_option='-h'
+      ;;
   esac
 fi
 # Don't AC_DEFINE result, only used in jit/Make-lang.in so far.

[-- Attachment #3: Type: text/plain, Size: 301 bytes --]


I've also checked that the original Solaris 10 release didn't support ld
-soname, so it's safer to always use the Solaris-native -h option
instead.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] jit: fix link on OS X and Solaris (PR jit/64089 and PR jit/84288)
  2018-01-01  0:00 ` [PATCH] jit: fix link on OS X and Solaris (PR jit/64089 and PR jit/84288) David Malcolm
@ 2018-01-01  0:00   ` Rainer Orth
  2018-01-01  0:00     ` Rainer Orth
  2018-01-01  0:00   ` FX
  1 sibling, 1 reply; 13+ messages in thread
From: Rainer Orth @ 2018-01-01  0:00 UTC (permalink / raw)
  To: David Malcolm; +Cc: FX, gcc-patches, jit

Hi David,

> libgccjit fails to link on OS X and Solaris due to jit/Make-lang.in,
> due to the assumption there that the linker is GNU ld.  Specifically,
> jit/Make-lang.in hardcodes the use of two options: --version-script
> and -soname.
>
> * on Darwin, --version-script doesn't seem to exist in the linker, and
>   it uses -install_name rather than -soname.
>
> * on Solaris, ld doesn't support --version-script.  However, the version
>   script used for libgccjit.so doesn't use any gld extensions, so one can
>   just use -M instead.
>
> This patch fixes these issues by using variables emitted by gcc's "configure"
> rather than hardcoding the options in jit/Make-lang.in.
>
> It's based on the first part of Rainer's patch for PR jit/84288, but I
> made the following changes:
> * the GNU ld case in configure.ac wasn't setting ld_version_script_option.
>   I set it to "--version-script" for that case.

That's weird: the configure.ac part starts with

ld_version_script_option='--version-script'

only overriding it in the Solaris case to keep things for other hosts
as they were.  Besides, I'm pretty sure I tested the patch on Solaris
with gas/gld to make certain that combo continues to work as is...

> * I moved the:
>     LD_VERSION_SCRIPT_OPTION = @ld_version_script_option@
>   from gcc/jit/Make-lang.in to gcc/Makefile.in, as the Make-lang.in files
>   aren't substituted, only the gcc/Makefile.in.
>   Rainer: how did this work for you?

It didn't: what I'd attached to the PR was an initial version of the
patch in the middle between manually hacking gcc/jit/Make-lang.in and
properly autoconfiguring things.

> * added LD_SONAME_OPTION, done in the same way
> * conditionalized the usage of the options in Make-lang.in to cope with
>   empty LD_VERSION_SCRIPT_OPTION (as is presumably the case on OS X).
>   I used ($if condition,then-part[,else-part]) for this.
>   I had to add a $(COMMA) since the "then-part" contains commas, which
>   need to be treated as part of the "then-part", rather than separators
>   for the "else-part".
>   Hopefully this is compatible with every "make" implementation that we
>   support.
>
> Successfully bootstrapped&regrtested on x86_64-pc-linux-gnu.
>
> I lightly tested the not-recognized case by hacking up the configure.ac
> (on x86_64-pc-linux-gnu) and verifying that it links, and that a
> smoketest of jit.dg/test-factorial works.
>
> Does this fix the jit linker issues on OS X and Solaris?

I'll give it a whirl tomorrow, including the jit-recording.c part of my
patch to allow the build to complete.

Thanks.
        Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Seeking Release Manager approval for: [PATCH] jit: fix link on OS X and Solaris (PR jit/64089 and PR jit/84288)
  2018-01-01  0:00       ` Seeking Release Manager approval for: " David Malcolm
@ 2018-01-01  0:00         ` Jakub Jelinek
  2018-01-01  0:00         ` Rainer Orth
  1 sibling, 0 replies; 13+ messages in thread
From: Jakub Jelinek @ 2018-01-01  0:00 UTC (permalink / raw)
  To: David Malcolm; +Cc: Richard Biener, FX, Rainer Orth, gcc patches, jit

On Fri, Mar 09, 2018 at 09:14:13AM -0500, David Malcolm wrote:
> On Wed, 2018-02-14 at 23:36 +0100, FX wrote:
> > I can confirm that, with the attached revised patch, a bootstrap with
> > --enable-languages=c,c++,jit --enable-host-shared is successful on
> > macOS.
> > 
> > FX
> 
> Looks good to me; thanks for fixing.
> 
> 
> Release managers:
> 
> I'd like to apply FX's patch here:
>   https://gcc.gnu.org/ml/gcc-patches/2018-02/msg00881/patch
> to trunk, to fix the build of jit on OS X, and to make it easier to fix
> it on Solaris.
> 
> Is it OK for trunk now, or does this need to wait until next stage 1?

Ok for trunk now.

	Jakub

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2018-03-21  8:22 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <78D7B2DA-5677-4211-9C4E-F7B1B5AB51B5@gmail.com>
2018-01-01  0:00 ` [PATCH] jit: fix link on OS X and Solaris (PR jit/64089 and PR jit/84288) David Malcolm
2018-01-01  0:00   ` Rainer Orth
2018-01-01  0:00     ` Rainer Orth
2018-01-01  0:00   ` FX
2018-01-01  0:00     ` FX
2018-01-01  0:00       ` Seeking Release Manager approval for: " David Malcolm
2018-01-01  0:00         ` Jakub Jelinek
2018-01-01  0:00         ` Rainer Orth
2018-01-01  0:00           ` David Malcolm
2018-01-01  0:00             ` Rainer Orth
2018-01-01  0:00               ` David Malcolm
2018-01-01  0:00                 ` Richard Biener
2018-01-01  0:00       ` FX

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