From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7850) id 99F043858414; Tue, 27 Jun 2023 19:42:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 99F043858414 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Indu Bhagat To: bfd-cvs@sourceware.org, gdb-cvs@sourceware.org Subject: [binutils-gdb] libsframe: add symbol versioning X-Act-Checkin: binutils-gdb X-Git-Author: Indu Bhagat X-Git-Refname: refs/heads/master X-Git-Oldrev: 852bb8c10de8abef79f0771dca879ddc8e4298b3 X-Git-Newrev: 99fde044fc332b97616b395393b2590c510b0e6f Message-Id: <20230627194216.99F043858414@sourceware.org> Date: Tue, 27 Jun 2023 19:42:16 +0000 (GMT) X-BeenThere: binutils-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jun 2023 19:42:16 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D99fde044fc33= 2b97616b395393b2590c510b0e6f commit 99fde044fc332b97616b395393b2590c510b0e6f Author: Indu Bhagat Date: Tue Jun 27 11:54:12 2023 -0700 libsframe: add symbol versioning =20 Define an empty base version LIBSFRAME_0.0 and add all symbols to version LIBSFRAME_1.0. =20 The previous release of libsframe (libsframe.so.0) did not have versioned symbols. Adding a libsframe.ver file so that future releases of the library (and its consumers) can manage the changes better. =20 For Solaris ld, use -M mapfile command line option. libsframe does not restrict the set of exported symbols, so at this time there is no need to fall back on the libtool's -export-symbols option for platforms where some other linker (with a different command line option for symbol versioning) may be used. =20 libsframe/ * Makefile.am: Use symbol versioning for libsframe. * Makefile.in: Regenerated. * configure: Check for Solaris ld. * configure.ac: Regenerated. * libsframe.ver: New file. Diff: --- libsframe/Makefile.am | 14 +++++++++-- libsframe/Makefile.in | 9 +++++-- libsframe/configure | 63 +++++++++++++++++++++++++++++++++++++++++++++= ++-- libsframe/configure.ac | 28 ++++++++++++++++++++++ libsframe/libsframe.ver | 36 ++++++++++++++++++++++++++++ 5 files changed, 144 insertions(+), 6 deletions(-) diff --git a/libsframe/Makefile.am b/libsframe/Makefile.am index 2d1d8fff063..a660e85c2ce 100644 --- a/libsframe/Makefile.am +++ b/libsframe/Makefile.am @@ -30,6 +30,16 @@ INCDIR =3D $(srcdir)/../include AM_CPPFLAGS =3D -I$(srcdir) -I$(srcdir)/../include -I$(srcdir)/../libctf AM_CFLAGS =3D @ac_libsframe_warn_cflags@ libsframe_version_info =3D -version-info `grep -v '^\#' $(srcdir)/libtool-= version` +# libsframe does not restrict the set of exported symbols. So, if linker = does +# not support symbol versioning, there is no need to fall back on libtool's +# -export-symbols option. +if HAVE_LD_VERSION_SCRIPT +if HAVE_SOLARIS_LD + libsframe_version_script =3D -Wl,-M -Wl,$(srcdir)/libsframe.ver +else + libsframe_version_script =3D -Wl,--version-script=3D$(srcdir)/libsframe.= ver +endif +endif =20 if INSTALL_LIBBFD lib_LTLIBRARIES =3D libsframe.la @@ -41,9 +51,9 @@ endif =20 libsframe_la_SOURCES =3D sframe.c sframe-dump.c sframe-error.c libsframe_la_CPPFLAGS =3D $(AM_CPPFLAGS) -libsframe_la_LDFLAGS =3D $(libsframe_version_info) +libsframe_la_LDFLAGS =3D $(libsframe_version_info) $(libsframe_version_scr= ipt) =20 -EXTRA_DIST =3D libtool-version +EXTRA_DIST =3D libtool-version libsframe.ver diststuff: $(EXTRA_DIST) info =20 include doc/local.mk diff --git a/libsframe/Makefile.in b/libsframe/Makefile.in index 57f912caa13..08c780caa4a 100644 --- a/libsframe/Makefile.in +++ b/libsframe/Makefile.in @@ -523,14 +523,19 @@ INCDIR =3D $(srcdir)/../include AM_CPPFLAGS =3D -I$(srcdir) -I$(srcdir)/../include -I$(srcdir)/../libctf AM_CFLAGS =3D @ac_libsframe_warn_cflags@ libsframe_version_info =3D -version-info `grep -v '^\#' $(srcdir)/libtool-= version` +@HAVE_LD_VERSION_SCRIPT_TRUE@@HAVE_SOLARIS_LD_FALSE@libsframe_version_scri= pt =3D -Wl,--version-script=3D$(srcdir)/libsframe.ver +# libsframe does not restrict the set of exported symbols. So, if linker = does +# not support symbol versioning, there is no need to fall back on libtool's +# -export-symbols option. +@HAVE_LD_VERSION_SCRIPT_TRUE@@HAVE_SOLARIS_LD_TRUE@libsframe_version_scrip= t =3D -Wl,-M -Wl,$(srcdir)/libsframe.ver @INSTALL_LIBBFD_TRUE@lib_LTLIBRARIES =3D libsframe.la @INSTALL_LIBBFD_FALSE@include_HEADERS =3D=20 @INSTALL_LIBBFD_TRUE@include_HEADERS =3D $(INCDIR)/sframe.h $(INCDIR)/sfra= me-api.h @INSTALL_LIBBFD_FALSE@noinst_LTLIBRARIES =3D libsframe.la libsframe_la_SOURCES =3D sframe.c sframe-dump.c sframe-error.c libsframe_la_CPPFLAGS =3D $(AM_CPPFLAGS) -libsframe_la_LDFLAGS =3D $(libsframe_version_info) -EXTRA_DIST =3D libtool-version +libsframe_la_LDFLAGS =3D $(libsframe_version_info) $(libsframe_version_scr= ipt) +EXTRA_DIST =3D libtool-version libsframe.ver @BUILD_INFO_TRUE@AM_MAKEINFOFLAGS =3D --no-split =20 # Setup the testing framework diff --git a/libsframe/configure b/libsframe/configure index bf4dc45b431..f7ad9c5e29a 100755 --- a/libsframe/configure +++ b/libsframe/configure @@ -643,6 +643,10 @@ INSTALL_LIBBFD_TRUE MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE +HAVE_LD_VERSION_SCRIPT_FALSE +HAVE_LD_VERSION_SCRIPT_TRUE +HAVE_SOLARIS_LD_FALSE +HAVE_SOLARIS_LD_TRUE BUILD_INFO_FALSE BUILD_INFO_TRUE COMPAT_DEJAGNU @@ -11482,7 +11486,7 @@ else lt_dlunknown=3D0; lt_dlno_uscore=3D1; lt_dlneed_uscore=3D2 lt_status=3D$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11485 "configure" +#line 11489 "configure" #include "confdefs.h" =20 #if HAVE_DLFCN_H @@ -11588,7 +11592,7 @@ else lt_dlunknown=3D0; lt_dlno_uscore=3D1; lt_dlneed_uscore=3D2 lt_status=3D$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11591 "configure" +#line 11595 "configure" #include "confdefs.h" =20 #if HAVE_DLFCN_H @@ -12335,6 +12339,53 @@ else fi =20 =20 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if using Solaris linker"= >&5 +$as_echo_n "checking if using Solaris linker... " >&6; } +SLD=3D`$LD --version 2>&1 | grep Solaris` +if test "$SLD"; then + have_solaris_ld=3Dyes + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + have_solaris_ld=3Dno + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + if test "$have_solaris_ld" =3D "yes"; then + HAVE_SOLARIS_LD_TRUE=3D + HAVE_SOLARIS_LD_FALSE=3D'#' +else + HAVE_SOLARIS_LD_TRUE=3D'#' + HAVE_SOLARIS_LD_FALSE=3D +fi + + +if test "$have_solaris_ld" =3D "yes"; then + GLD=3D`$LD --help < /dev/null 2>&1 | grep 'M mapfile'` +else + GLD=3D`$LD --help < /dev/null 2>/dev/null | grep version-script` +fi + +if test "$GLD"; then + have_ld_version_script=3Dyes + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + have_ld_version_script=3Dno + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** Versioned symbols = not enabled." >&5 +$as_echo "$as_me: WARNING: *** Versioned symbols not enabled." >&2;} +fi + if test "$have_ld_version_script" =3D "yes"; then + HAVE_LD_VERSION_SCRIPT_TRUE=3D + HAVE_LD_VERSION_SCRIPT_FALSE=3D'#' +else + HAVE_LD_VERSION_SCRIPT_TRUE=3D'#' + HAVE_LD_VERSION_SCRIPT_FALSE=3D +fi + + =20 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable mainta= iner-specific portions of Makefiles" >&5 $as_echo_n "checking whether to enable maintainer-specific portions of Mak= efiles... " >&6; } @@ -12810,6 +12861,14 @@ if test -z "${BUILD_INFO_TRUE}" && test -z "${BUIL= D_INFO_FALSE}"; then as_fn_error $? "conditional \"BUILD_INFO\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${HAVE_SOLARIS_LD_TRUE}" && test -z "${HAVE_SOLARIS_LD_FALSE}"= ; then + as_fn_error $? "conditional \"HAVE_SOLARIS_LD\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_LD_VERSION_SCRIPT_TRUE}" && test -z "${HAVE_LD_VERSION_= SCRIPT_FALSE}"; then + as_fn_error $? "conditional \"HAVE_LD_VERSION_SCRIPT\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"= ; then as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 diff --git a/libsframe/configure.ac b/libsframe/configure.ac index b9ea363d00d..8189e966e1c 100644 --- a/libsframe/configure.ac +++ b/libsframe/configure.ac @@ -81,6 +81,34 @@ else fi AM_CONDITIONAL(BUILD_INFO, test "${build_info}" =3D yes) =20 +dnl Determine if using Solaris linker +AC_MSG_CHECKING([if using Solaris linker]) +SLD=3D`$LD --version 2>&1 | grep Solaris` +if test "$SLD"; then + have_solaris_ld=3Dyes + AC_MSG_RESULT(yes) +else + have_solaris_ld=3Dno + AC_MSG_RESULT(no) +fi +AM_CONDITIONAL(HAVE_SOLARIS_LD, test "$have_solaris_ld" =3D "yes") + +if test "$have_solaris_ld" =3D "yes"; then + GLD=3D`$LD --help < /dev/null 2>&1 | grep 'M mapfile'` +else + GLD=3D`$LD --help < /dev/null 2>/dev/null | grep version-script` +fi + +if test "$GLD"; then + have_ld_version_script=3Dyes + AC_MSG_RESULT(yes) +else + have_ld_version_script=3Dno + AC_MSG_RESULT(no) + AC_MSG_WARN(*** Versioned symbols not enabled.) +fi +AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" =3D = "yes") + AM_MAINTAINER_MODE AM_INSTALL_LIBBFD =20 diff --git a/libsframe/libsframe.ver b/libsframe/libsframe.ver new file mode 100644 index 00000000000..2c2081f311a --- /dev/null +++ b/libsframe/libsframe.ver @@ -0,0 +1,36 @@ +LIBSFRAME_0.0 { }; + +LIBSFRAME_1.0 { + global: + sframe_decoder_free; + sframe_fde_create_func_info; + sframe_calc_fre_type; + sframe_fre_get_base_reg_id; + sframe_fre_get_cfa_offset; + sframe_fre_get_fp_offset; + sframe_fre_get_ra_offset; + sframe_fre_get_ra_mangled_p; + sframe_decode; + sframe_decoder_get_hdr_size; + sframe_decoder_get_abi_arch; + sframe_decoder_get_fixed_fp_offset; + sframe_decoder_get_fixed_ra_offset; + sframe_get_funcdesc_with_addr; + sframe_find_fre; + sframe_decoder_get_num_fidx; + sframe_decoder_get_funcdesc; + sframe_decoder_get_fre; + sframe_encode; + sframe_encoder_free; + sframe_encoder_get_hdr_size; + sframe_encoder_get_abi_arch; + sframe_encoder_get_num_fidx; + sframe_encoder_add_fre; + sframe_encoder_add_funcdesc; + sframe_encoder_write; + dump_sframe; + sframe_errmsg; + + local: + *; +} LIBSFRAME_0.0;