OSDN Git Service

Support sun symbol versioning in libitm
authorro <ro@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 21 Nov 2011 17:03:50 +0000 (17:03 +0000)
committerro <ro@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 21 Nov 2011 17:03:50 +0000 (17:03 +0000)
libitm:
* acinclude.m4 (LIBITM_CHECK_LINKER_FEATURES): Handle gold.
(LIBITM_ENABLE_SYMVERS): Handle sun style.
* Makefile.am: Handle sun style versioning.
(libitm_la_LINK): Add $(libitm_la_LDFLAGS).
* configure: Regenerate.
* Makefile.in: Regenerate.

contrib:
* make_sunver.pl: Convert '?' in glob patterns to '.'.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@181588 138bc75d-0d04-0410-961f-82ee72b054a4

contrib/ChangeLog
contrib/make_sunver.pl
libitm/ChangeLog
libitm/Makefile.am
libitm/Makefile.in
libitm/acinclude.m4
libitm/configure

index b382897..abe317a 100644 (file)
@@ -1,3 +1,7 @@
+2011-11-21  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+       * make_sunver.pl: Convert '?' in glob patterns to '.'.
+
 2011-11-07  Richard Henderson  <rth@redhat.com>
 
        Merged from transactional-memory.
index 2928374..96ad22c 100644 (file)
@@ -276,9 +276,10 @@ while (<F>) {
     if (/^([ \t]*)([^ \t;{}#]+);?[ \t]*$/) {
        my $ws = $1;
        my $ptn = $2;
-       # Turn the glob into a regex by replacing '*' with '.*'.
+       # Turn the glob into a regex by replacing '*' with '.*', '?' with '.'.
        # Keep $ptn so we can still print the original form.
        ($pattern = $ptn) =~ s/\*/\.\*/g;
+       $pattern =~ s/\?/\./g;
 
        if ($glob eq 'ign') {
            # We're in a local: * section; just continue.
index 642c42a..9ccf619 100644 (file)
@@ -1,3 +1,12 @@
+2011-11-21  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+       * acinclude.m4 (LIBITM_CHECK_LINKER_FEATURES): Handle gold.
+       (LIBITM_ENABLE_SYMVERS): Handle sun style.
+       * Makefile.am: Handle sun style versioning.
+       (libitm_la_LINK): Add $(libitm_la_LDFLAGS).
+       * configure: Regenerate.
+       * Makefile.in: Regenerate.
+
 2011-11-18  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
        * config/generic/asmcfi.h: Fix comment.
index b4674a5..7df807e 100644 (file)
@@ -27,15 +27,33 @@ toolexeclib_LTLIBRARIES = libitm.la
 nodist_toolexeclib_HEADERS = libitm.spec
 
 if LIBITM_BUILD_VERSIONED_SHLIB
+if LIBITM_BUILD_VERSIONED_SHLIB_GNU
 libitm_version_script = -Wl,--version-script,$(top_srcdir)/libitm.map
+libitm_version_dep = $(top_srcdir)/libitm.map
+endif
+if LIBITM_BUILD_VERSIONED_SHLIB_SUN
+libitm_version_script = -Wl,-M,libitm.map-sun
+libitm_version_dep = libitm.map-sun
+libitm.map-sun : $(top_srcdir)/libitm.map \
+               $(top_srcdir)/../contrib/make_sunver.pl \
+               $(libitm_la_OBJECTS) $(libitm_la_LIBADD)
+       perl $(top_srcdir)/../contrib/make_sunver.pl \
+         $(top_srcdir)/libitm.map \
+         $(libitm_la_OBJECTS:%.lo=.libs/%.o) \
+        `echo $(libitm_la_LIBADD) | \
+           sed 's,/\([^/.]*\)\.la,/.libs/\1.a,g'` \
+        > $@ || (rm -f $@ ; exit 1)
+endif
 else
 libitm_version_script =
+libitm_version_dep =
 endif
 libitm_version_info = -version-info $(libtool_VERSION)
 
 # Force link with C, not C++.  For now, while we're using C++ we don't
 # want or need libstdc++.
-libitm_la_LINK = $(LINK)
+libitm_la_DEPENDENCIES = $(libitm_version_dep)
+libitm_la_LINK = $(LINK) $(libitm_la_LDFLAGS)
 libitm_la_LDFLAGS = $(libitm_version_info) $(libitm_version_script) \
         -no-undefined
 
index 7426146..d3872c9 100644 (file)
@@ -359,12 +359,17 @@ AM_LDFLAGS = $(XLDFLAGS) $(SECTION_LDFLAGS) $(OPT_LDFLAGS)
 toolexeclib_LTLIBRARIES = libitm.la
 nodist_toolexeclib_HEADERS = libitm.spec
 @LIBITM_BUILD_VERSIONED_SHLIB_FALSE@libitm_version_script = 
-@LIBITM_BUILD_VERSIONED_SHLIB_TRUE@libitm_version_script = -Wl,--version-script,$(top_srcdir)/libitm.map
+@LIBITM_BUILD_VERSIONED_SHLIB_GNU_TRUE@@LIBITM_BUILD_VERSIONED_SHLIB_TRUE@libitm_version_script = -Wl,--version-script,$(top_srcdir)/libitm.map
+@LIBITM_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBITM_BUILD_VERSIONED_SHLIB_TRUE@libitm_version_script = -Wl,-M,libitm.map-sun
+@LIBITM_BUILD_VERSIONED_SHLIB_FALSE@libitm_version_dep = 
+@LIBITM_BUILD_VERSIONED_SHLIB_GNU_TRUE@@LIBITM_BUILD_VERSIONED_SHLIB_TRUE@libitm_version_dep = $(top_srcdir)/libitm.map
+@LIBITM_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBITM_BUILD_VERSIONED_SHLIB_TRUE@libitm_version_dep = libitm.map-sun
 libitm_version_info = -version-info $(libtool_VERSION)
 
 # Force link with C, not C++.  For now, while we're using C++ we don't
 # want or need libstdc++.
-libitm_la_LINK = $(LINK)
+libitm_la_DEPENDENCIES = $(libitm_version_dep)
+libitm_la_LINK = $(LINK) $(libitm_la_LDFLAGS)
 libitm_la_LDFLAGS = $(libitm_version_info) $(libitm_version_script) \
         -no-undefined
 
@@ -1258,6 +1263,15 @@ uninstall-am: uninstall-dvi-am uninstall-html-am uninstall-info-am \
 
 
 vpath % $(strip $(search_path))
+@LIBITM_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBITM_BUILD_VERSIONED_SHLIB_TRUE@libitm.map-sun : $(top_srcdir)/libitm.map \
+@LIBITM_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBITM_BUILD_VERSIONED_SHLIB_TRUE@             $(top_srcdir)/../contrib/make_sunver.pl \
+@LIBITM_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBITM_BUILD_VERSIONED_SHLIB_TRUE@             $(libitm_la_OBJECTS) $(libitm_la_LIBADD)
+@LIBITM_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBITM_BUILD_VERSIONED_SHLIB_TRUE@     perl $(top_srcdir)/../contrib/make_sunver.pl \
+@LIBITM_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBITM_BUILD_VERSIONED_SHLIB_TRUE@       $(top_srcdir)/libitm.map \
+@LIBITM_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBITM_BUILD_VERSIONED_SHLIB_TRUE@       $(libitm_la_OBJECTS:%.lo=.libs/%.o) \
+@LIBITM_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBITM_BUILD_VERSIONED_SHLIB_TRUE@      `echo $(libitm_la_LIBADD) | \
+@LIBITM_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBITM_BUILD_VERSIONED_SHLIB_TRUE@         sed 's,/\([^/.]*\)\.la,/.libs/\1.a,g'` \
+@LIBITM_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBITM_BUILD_VERSIONED_SHLIB_TRUE@      > $@ || (rm -f $@ ; exit 1)
 @ARCH_X86_TRUE@x86_sse.lo : XCFLAGS += -msse
 @ARCH_X86_AVX_TRUE@x86_avx.lo : XCFLAGS += -mavx
 
index 9ff1393..069738d 100644 (file)
@@ -169,6 +169,7 @@ dnl  OPT_LDFLAGS='-Wl,-O1' if possible
 dnl  LD (as a side effect of testing)
 dnl Sets:
 dnl  with_gnu_ld
+dnl  libitm_ld_is_gold (possibly)
 dnl  libitm_gnu_ld_version (possibly)
 dnl
 dnl The last will be a single integer, e.g., version 1.23.45.0.67.89 will
@@ -200,9 +201,13 @@ AC_DEFUN([LIBITM_CHECK_LINKER_FEATURES], [
 
   # Start by getting the version number.  I think the libtool test already
   # does some of this, but throws away the result.
+  libitm_ld_is_gold=no
+  if $LD --version 2>/dev/null | grep 'GNU gold'> /dev/null 2>&1; then
+    libitm_ld_is_gold=yes
+  fi
   changequote(,)
-  ldver=`$LD --version 2>/dev/null | head -1 | \
-         sed -e 's/GNU ld \(version \)\{0,1\}\(([^)]*) \)\{0,1\}\([0-9.][0-9.]*\).*/\3/'`
+  ldver=`$LD --version 2>/dev/null |
+         sed -e 's/GNU gold /GNU ld /;s/GNU ld version /GNU ld /;s/GNU ld ([^)]*) /GNU ld /;s/GNU ld \([0-9.][0-9.]*\).*/\1/; q'`
   changequote([,])
   libitm_gnu_ld_version=`echo $ldver | \
          $AWK -F. '{ if (NF<3) [$]3=0; print ([$]1*100+[$]2)*100+[$]3 }'`
@@ -272,16 +277,46 @@ AC_DEFUN([LIBITM_ENABLE_SYMVERS], [
 
 LIBITM_ENABLE(symvers,yes,[=STYLE],
   [enables symbol versioning of the shared library],
-  [permit yes|no|gnu])
+  [permit yes|no|gnu*|sun])
 
 # If we never went through the LIBITM_CHECK_LINKER_FEATURES macro, then we
 # don't know enough about $LD to do tricks...
 AC_REQUIRE([LIBITM_CHECK_LINKER_FEATURES])
-# FIXME  The following test is too strict, in theory.
-if test $enable_shared = no ||
-        test "x$LD" = x ||
-        test x$libitm_gnu_ld_version = x; then
-  enable_symvers=no
+
+# Turn a 'yes' into a suitable default.
+if test x$enable_symvers = xyes ; then
+  # FIXME  The following test is too strict, in theory.
+  if test $enable_shared = no || test "x$LD" = x; then
+    enable_symvers=no
+  else
+    if test $with_gnu_ld = yes ; then
+      enable_symvers=gnu
+    else
+      case ${target_os} in
+        # Sun symbol versioning exists since Solaris 2.5.
+        solaris2.[[5-9]]* | solaris2.1[[0-9]]*)
+          enable_symvers=sun ;;
+        *)
+          enable_symvers=no ;;
+      esac
+    fi
+  fi
+fi
+
+# Check if 'sun' was requested on non-Solaris 2 platforms.
+if test x$enable_symvers = xsun ; then
+  case ${target_os} in
+    solaris2*)
+      # All fine.
+      ;;
+    *)
+      # Unlikely to work.
+      AC_MSG_WARN([=== You have requested Sun symbol versioning, but])
+      AC_MSG_WARN([=== you are not targetting Solaris 2.])
+      AC_MSG_WARN([=== Symbol versioning will be disabled.])
+      enable_symvers=no
+      ;;
+  esac
 fi
 
 # Check to see if libgcc_s exists, indicating that shared libgcc is possible.
@@ -318,12 +353,12 @@ libitm_min_gnu_ld_version=21400
 
 # Check to see if unspecified "yes" value can win, given results above.
 # Change "yes" into either "no" or a style name.
-if test $enable_symvers = yes; then
-  if test $with_gnu_ld = yes &&
-     test $libitm_shared_libgcc = yes;
-  then
+if test $enable_symvers != no && test $libitm_shared_libgcc = yes; then
+  if test $with_gnu_ld = yes; then
     if test $libitm_gnu_ld_version -ge $libitm_min_gnu_ld_version ; then
       enable_symvers=gnu
+    elif test $libitm_ld_is_gold = yes ; then
+      enable_symvers=gnu
     else
       # The right tools, the right setup, but too old.  Fallbacks?
       AC_MSG_WARN(=== Linker version $libitm_gnu_ld_version is too old for)
@@ -342,6 +377,8 @@ if test $enable_symvers = yes; then
         enable_symvers=no
       fi
     fi
+  elif test $enable_symvers = sun; then
+    : All interesting versions of Sun ld support sun style symbol versioning.
   else
     # just fail for now
     AC_MSG_WARN([=== You have requested some kind of symbol versioning, but])
@@ -353,5 +390,7 @@ if test $enable_symvers = yes; then
 fi
 
 AM_CONDITIONAL(LIBITM_BUILD_VERSIONED_SHLIB, test $enable_symvers != no)
+AM_CONDITIONAL(LIBITM_BUILD_VERSIONED_SHLIB_GNU, test $enable_symvers = gnu)
+AM_CONDITIONAL(LIBITM_BUILD_VERSIONED_SHLIB_SUN, test $enable_symvers = sun)
 AC_MSG_NOTICE(versioning on shared library symbols is $enable_symvers)
 ])
index 5fafca3..1512ad1 100644 (file)
@@ -611,6 +611,10 @@ link_itm
 XLDFLAGS
 XCFLAGS
 config_path
+LIBITM_BUILD_VERSIONED_SHLIB_SUN_FALSE
+LIBITM_BUILD_VERSIONED_SHLIB_SUN_TRUE
+LIBITM_BUILD_VERSIONED_SHLIB_GNU_FALSE
+LIBITM_BUILD_VERSIONED_SHLIB_GNU_TRUE
 LIBITM_BUILD_VERSIONED_SHLIB_FALSE
 LIBITM_BUILD_VERSIONED_SHLIB_TRUE
 OPT_LDFLAGS
@@ -11716,7 +11720,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11719 "configure"
+#line 11723 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11822,7 +11826,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11825 "configure"
+#line 11829 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -16688,9 +16692,13 @@ with_gnu_ld=$lt_cv_prog_gnu_ld
 
   # Start by getting the version number.  I think the libtool test already
   # does some of this, but throws away the result.
+  libitm_ld_is_gold=no
+  if $LD --version 2>/dev/null | grep 'GNU gold'> /dev/null 2>&1; then
+    libitm_ld_is_gold=yes
+  fi
 
-  ldver=`$LD --version 2>/dev/null | head -1 | \
-         sed -e 's/GNU ld \(version \)\{0,1\}\(([^)]*) \)\{0,1\}\([0-9.][0-9.]*\).*/\3/'`
+  ldver=`$LD --version 2>/dev/null |
+         sed -e 's/GNU gold /GNU ld /;s/GNU ld version /GNU ld /;s/GNU ld ([^)]*) /GNU ld /;s/GNU ld \([0-9.][0-9.]*\).*/\1/; q'`
 
   libitm_gnu_ld_version=`echo $ldver | \
          $AWK -F. '{ if (NF<3) $3=0; print ($1*100+$2)*100+$3 }'`
@@ -16764,7 +16772,7 @@ $as_echo "$ac_sectionLDflags" >&6; }
 if test "${enable_symvers+set}" = set; then :
   enableval=$enable_symvers;
       case "$enableval" in
-       yes|no|gnu) ;;
+       yes|no|gnu*|sun) ;;
        *) as_fn_error "Unknown argument to enable/disable symvers" "$LINENO" 5 ;;
                           esac
 
 # If we never went through the LIBITM_CHECK_LINKER_FEATURES macro, then we
 # don't know enough about $LD to do tricks...
 
-# FIXME  The following test is too strict, in theory.
-if test $enable_shared = no ||
-        test "x$LD" = x ||
-        test x$libitm_gnu_ld_version = x; then
-  enable_symvers=no
+
+# Turn a 'yes' into a suitable default.
+if test x$enable_symvers = xyes ; then
+  # FIXME  The following test is too strict, in theory.
+  if test $enable_shared = no || test "x$LD" = x; then
+    enable_symvers=no
+  else
+    if test $with_gnu_ld = yes ; then
+      enable_symvers=gnu
+    else
+      case ${target_os} in
+        # Sun symbol versioning exists since Solaris 2.5.
+        solaris2.[5-9]* | solaris2.1[0-9]*)
+          enable_symvers=sun ;;
+        *)
+          enable_symvers=no ;;
+      esac
+    fi
+  fi
+fi
+
+# Check if 'sun' was requested on non-Solaris 2 platforms.
+if test x$enable_symvers = xsun ; then
+  case ${target_os} in
+    solaris2*)
+      # All fine.
+      ;;
+    *)
+      # Unlikely to work.
+      { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: === You have requested Sun symbol versioning, but" >&5
+$as_echo "$as_me: WARNING: === You have requested Sun symbol versioning, but" >&2;}
+      { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: === you are not targetting Solaris 2." >&5
+$as_echo "$as_me: WARNING: === you are not targetting Solaris 2." >&2;}
+      { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: === Symbol versioning will be disabled." >&5
+$as_echo "$as_me: WARNING: === Symbol versioning will be disabled." >&2;}
+      enable_symvers=no
+      ;;
+  esac
 fi
 
 # Check to see if libgcc_s exists, indicating that shared libgcc is possible.
@@ -16850,12 +16891,12 @@ libitm_min_gnu_ld_version=21400
 
 # Check to see if unspecified "yes" value can win, given results above.
 # Change "yes" into either "no" or a style name.
-if test $enable_symvers = yes; then
-  if test $with_gnu_ld = yes &&
-     test $libitm_shared_libgcc = yes;
-  then
+if test $enable_symvers != no && test $libitm_shared_libgcc = yes; then
+  if test $with_gnu_ld = yes; then
     if test $libitm_gnu_ld_version -ge $libitm_min_gnu_ld_version ; then
       enable_symvers=gnu
+    elif test $libitm_ld_is_gold = yes ; then
+      enable_symvers=gnu
     else
       # The right tools, the right setup, but too old.  Fallbacks?
       { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: === Linker version $libitm_gnu_ld_version is too old for" >&5
@@ -16878,6 +16919,8 @@ $as_echo "$as_me: WARNING: === Symbol versioning will be disabled." >&2;}
         enable_symvers=no
       fi
     fi
+  elif test $enable_symvers = sun; then
+    : All interesting versions of Sun ld support sun style symbol versioning.
   else
     # just fail for now
     { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: === You have requested some kind of symbol versioning, but" >&5
@@ -16900,6 +16943,22 @@ else
   LIBITM_BUILD_VERSIONED_SHLIB_FALSE=
 fi
 
+ if test $enable_symvers = gnu; then
+  LIBITM_BUILD_VERSIONED_SHLIB_GNU_TRUE=
+  LIBITM_BUILD_VERSIONED_SHLIB_GNU_FALSE='#'
+else
+  LIBITM_BUILD_VERSIONED_SHLIB_GNU_TRUE='#'
+  LIBITM_BUILD_VERSIONED_SHLIB_GNU_FALSE=
+fi
+
+ if test $enable_symvers = sun; then
+  LIBITM_BUILD_VERSIONED_SHLIB_SUN_TRUE=
+  LIBITM_BUILD_VERSIONED_SHLIB_SUN_FALSE='#'
+else
+  LIBITM_BUILD_VERSIONED_SHLIB_SUN_TRUE='#'
+  LIBITM_BUILD_VERSIONED_SHLIB_SUN_FALSE=
+fi
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: versioning on shared library symbols is $enable_symvers" >&5
 $as_echo "$as_me: versioning on shared library symbols is $enable_symvers" >&6;}
 
@@ -17424,6 +17483,14 @@ if test -z "${LIBITM_BUILD_VERSIONED_SHLIB_TRUE}" && test -z "${LIBITM_BUILD_VER
   as_fn_error "conditional \"LIBITM_BUILD_VERSIONED_SHLIB\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${LIBITM_BUILD_VERSIONED_SHLIB_GNU_TRUE}" && test -z "${LIBITM_BUILD_VERSIONED_SHLIB_GNU_FALSE}"; then
+  as_fn_error "conditional \"LIBITM_BUILD_VERSIONED_SHLIB_GNU\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${LIBITM_BUILD_VERSIONED_SHLIB_SUN_TRUE}" && test -z "${LIBITM_BUILD_VERSIONED_SHLIB_SUN_FALSE}"; then
+  as_fn_error "conditional \"LIBITM_BUILD_VERSIONED_SHLIB_SUN\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${ARCH_X86_TRUE}" && test -z "${ARCH_X86_FALSE}"; then
   as_fn_error "conditional \"ARCH_X86\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5