This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[v3] more sophisticated versioning checks, enable by default
- From: Benjamin Kosnik <bkoz at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org, libstdc++ at gcc dot gnu dot org, pme at gcc dot gnu dot org, ljrittle at acm dot org
- Date: Thu, 21 Feb 2002 15:39:50 -0800
- Subject: [v3] more sophisticated versioning checks, enable by default
This patch adds a check for shared libgcc, courtesy of Phil.
Current behavior is:
default:
--enable-symvers
--disable-symvers
--enable-symvers=no
--enable-symvers=yes
(attempt to use symbol versioning if GNU ld, ld version is ok)
--enable-symvers=gnu
(use GNU symbol versioning, bypass checks.)
I'm proposing a change to:
default:
--enable-symvers
--enable-symvers=yes
(attempt to use symbol versioning if GNU ld, ld version is ok, libgcc_s)
--disable-symvers
--enable-symvers=no
(disable unconditionally)
--enable-symvers=gnu
(use GNU symbol versioning, bypass checks.)
I think this makes this --enable flag consistent with other
libstdc++-v3 configure flags, allows some systems to immediately start
using symbol versioning without disrupting other systems, and at the
same time allows a configuration option so that Loren can purposefully
build a broken libstdc++ configuration on BSD to work through
configuration issues. Does this seem fair, and a good way to proceed?
Also, this enable flag should probably be documented on configopts.html.
tested x86/linux
2002-02-21 Benjamin Kosnik <bkoz@redhat.com>
* configure.in (target_alias): Default to yes.
* acinclude.m4 (GLIBCPP_ENABLE_SYMVERS): Add check for shared
libgcc to default case.
Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/configure.in,v
retrieving revision 1.82
diff -c -p -r1.82 configure.in
*** configure.in 2002/02/20 22:10:23 1.82
--- configure.in 2002/02/21 23:21:19
*************** else
*** 250,256 ****
fi
# This depends on the possibly-skipped linker test above.
! GLIBCPP_ENABLE_SYMVERS([no])
# Propagate the target-specific source directories through the build chain.
OS_INC_SRCDIR=$os_include_dir/bits
--- 250,256 ----
fi
# This depends on the possibly-skipped linker test above.
! GLIBCPP_ENABLE_SYMVERS([yes])
# Propagate the target-specific source directories through the build chain.
OS_INC_SRCDIR=$os_include_dir/bits
Index: acinclude.m4
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/acinclude.m4,v
retrieving revision 1.192
diff -c -p -r1.192 acinclude.m4
*** acinclude.m4 2002/02/20 22:10:23 1.192
--- acinclude.m4 2002/02/21 23:21:25
*************** dnl controlled by 'style'.
*** 2042,2049 ****
dnl --disable-symvers does not.
dnl + Usage: GLIBCPP_ENABLE_SYMVERS[(DEFAULT)]
dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
! dnl defaults to `no'. Passing `yes' tries to choose a default style
! dnl based on linker characteristics.
AC_DEFUN(GLIBCPP_ENABLE_SYMVERS, [dnl
define([GLIBCPP_ENABLE_SYMVERS_DEFAULT], ifelse($1, yes, yes, no))dnl
AC_ARG_ENABLE(symvers,
--- 2042,2049 ----
dnl --disable-symvers does not.
dnl + Usage: GLIBCPP_ENABLE_SYMVERS[(DEFAULT)]
dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
! dnl defaults to `yes'. Passing `yes' tries to choose a default style
! dnl based on linker characteristics. Passing 'no' disables versioning.
AC_DEFUN(GLIBCPP_ENABLE_SYMVERS, [dnl
define([GLIBCPP_ENABLE_SYMVERS_DEFAULT], ifelse($1, yes, yes, no))dnl
AC_ARG_ENABLE(symvers,
*************** changequote(<<, >>)dnl
*** 2051,2057 ****
<< --enable-symvers=style enables symbol versioning of the shared library [default=>>GLIBCPP_ENABLE_SYMVERS_DEFAULT],
changequote([, ])dnl
[case "$enableval" in
! yes) enable_symvers=default ;;
no) enable_symvers=no ;;
# other names here, just as sanity checks
#gnu|sun|etcetera) enable_symvers=$enableval ;;
--- 2051,2057 ----
<< --enable-symvers=style enables symbol versioning of the shared library [default=>>GLIBCPP_ENABLE_SYMVERS_DEFAULT],
changequote([, ])dnl
[case "$enableval" in
! yes) enable_symvers=yes ;;
no) enable_symvers=no ;;
# other names here, just as sanity checks
#gnu|sun|etcetera) enable_symvers=$enableval ;;
*************** changequote([, ])dnl
*** 2061,2102 ****
enable_symvers=GLIBCPP_ENABLE_SYMVERS_DEFAULT)dnl
# If we never went through the GLIBCPP_CHECK_LINKER_FEATURES macro, then we
! # don't know enough about $LD... I think.
! AC_MSG_CHECKING([whether to version shared lib symbols])
if test $enable_shared = no || test x$LD = x ; then
! enable_symvers=irrelevant
fi
# For GNU ld, we need at least this version. It's 2.12 in the same format
# as the tested-for version. See GLIBCPP_CHECK_LINKER_FEATURES for more.
glibcpp_min_gnu_ld_version=21200
! dnl Everything parsed; figure out the actions.
! LINKER_MAP=config/linker-map.dummy
case $enable_symvers in
! no | irrelevant)
;;
gnu)
LINKER_MAP=config/linker-map.gnu
;;
- dnl sun)
- dnl LINKER_MAP=config/linker-map....?
- dnl ;;
- default) # not specified by user, try to figure it out
- if test $with_gnu_ld = yes &&
- test $glibcpp_gnu_ld_version -ge $glibcpp_min_gnu_ld_version ;
- then
- LINKER_MAP=config/linker-map.gnu
- else
- # just fail for now
- enable_symvers=no
- fi
- ;;
esac
AC_LINK_FILES($LINKER_MAP, src/linker.map)
! AM_CONDITIONAL(GLIBCPP_BUILD_VERSIONED_SHLIB,
! test $enable_symvers != no && test $enable_symvers != irrelevant)
AC_MSG_RESULT($enable_symvers)
])
--- 2061,2110 ----
enable_symvers=GLIBCPP_ENABLE_SYMVERS_DEFAULT)dnl
# If we never went through the GLIBCPP_CHECK_LINKER_FEATURES macro, then we
! # don't know enough about $LD to do tricks...
if test $enable_shared = no || test x$LD = x ; then
! enable_symvers=no
fi
+ # Check to see if libgcc_s exists, indicating that shared libgcc is possible.
+ AC_MSG_CHECKING([for shared libgcc])
+ ac_save_CFLAGS="$CFLAGS"
+ CFLAGS=' -lgcc_s'
+ AC_TRY_LINK( , [return 0], glibcpp_shared_libgcc=yes, glibcpp_shared_libgcc=no)
+ CFLAGS="$ac_save_CFLAGS"
+ AC_MSG_RESULT($glibcpp_shared_libgcc)
+
# For GNU ld, we need at least this version. It's 2.12 in the same format
# as the tested-for version. See GLIBCPP_CHECK_LINKER_FEATURES for more.
glibcpp_min_gnu_ld_version=21200
+
+ # Check to see if unspecified "yes" value can win, given
+ # results above.
+ if test $enable_symvers = yes ; then
+ if test $with_gnu_ld = yes &&
+ test $glibcpp_gnu_ld_version -ge $glibcpp_min_gnu_ld_version &&
+ test $glibcpp_shared_libgcc = yes ;
+ then
+ enable_symvers=gnu
+ else
+ # just fail for now
+ enable_symvers=no
+ fi
+ fi
! dnl Everything parsed; figure out what file to use.
case $enable_symvers in
! no)
! LINKER_MAP=config/linker-map.dummy
;;
gnu)
LINKER_MAP=config/linker-map.gnu
;;
esac
AC_LINK_FILES($LINKER_MAP, src/linker.map)
! AM_CONDITIONAL(GLIBCPP_BUILD_VERSIONED_SHLIB, test $enable_symvers != no)
! AC_MSG_CHECKING([versioning on shared lib symbols])
AC_MSG_RESULT($enable_symvers)
])