jit: use 'configure' to replace hard-coded linker options (PR jit/64089 and PR jit...
authorDavid Malcolm <dmalcolm@redhat.com>
Fri, 9 Mar 2018 15:24:44 +0000 (15:24 +0000)
committerDavid Malcolm <dmalcolm@gcc.gnu.org>
Fri, 9 Mar 2018 15:24:44 +0000 (15:24 +0000)
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.

Co-Authored-By: Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
From-SVN: r258388

gcc/ChangeLog
gcc/Makefile.in
gcc/configure
gcc/configure.ac
gcc/jit/ChangeLog
gcc/jit/Make-lang.in

index 5b2f59bfd780c7916c5b92c160ff4068457cdf3e..6bc488ce5f101af9086d71f737a289f44c4e7af5 100644 (file)
@@ -1,3 +1,13 @@
+2018-03-09  David Malcolm  <dmalcolm@redhat.com>
+           Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
+
+       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.
+
 2018-03-09  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/84775
index c91499d46c96610d994db3d89f6e4d3b0b1a9d04..20bee0494b1bad4e3ec34e2eae291cf6eadc3aa1 100644 (file)
@@ -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 b12628725b675a898e28e8bfd394a8069ab264e1..c2d3f752347fc5ae747e46b515838615f8495fc0 100755 (executable)
@@ -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
 { $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 = yes; then
 $as_echo "#define HAVE_AS_DWARF2_DEBUG_VIEW 1" >>confdefs.h
 
 fi
+
     fi
  fi
 
index 140c804412a7a9ab0d4bc397484823206e6c448f..c3c76acd0814b9c06924016b0d28f989f2134291 100644 (file)
@@ -3655,6 +3655,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=''
+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 8bb0002fc47ad3f4be0ee2336f4d36b53771140b..8ae54f93f84cdb21a8573fa607eb96b5fd6edb84 100644 (file)
@@ -1,3 +1,14 @@
+2018-03-09  David Malcolm  <dmalcolm@redhat.com>
+           Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
+
+       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.
+
 2018-01-25  David Malcolm  <dmalcolm@redhat.com>
 
        PR jit/81672
index d4362a9560e74781832f1f6460f28d91698d2076..ba78f8ecaf3027a3be4bbd8d0767c454d5d12e04 100644 (file)
@@ -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)