[01/10] libsframe: add library versioning

Message ID 20230623044448.2617101-2-indu.bhagat@oracle.com
State Accepted
Headers
Series Patches for libsframe versioning and symbol versioning |

Checks

Context Check Description
snail/binutils-gdb-check success Github commit url

Commit Message

Indu Bhagat June 23, 2023, 4:44 a.m. UTC
  lisbframe was first released with Bintuils 2.40.  As the library
evolves, some changes will break the ABI.  Add library versioning for
users to manage these changes.

For the next release of the library (libsframe.so.1), incompatible ABI
changes are planned. These will include:
 - Deprecation of some APIs, like sframe_get_funcdesc_with_addr (),
 - Change in the contract of some APIs (e.g., return type, behavior)

In libtool-version, set the current to 1 to prepare for the upcoming
release.  Reset revision and age to 0.

Add libtool-version to EXTRA_DIST.

libsframe/
	* Makefile.am: Use libtool versioning.
	* Makefile.in: Regenerated.
	* libtool-version: New file.
---
 libsframe/Makefile.am     |  5 +++++
 libsframe/Makefile.in     |  9 ++++++++-
 libsframe/libtool-version | 30 ++++++++++++++++++++++++++++++
 3 files changed, 43 insertions(+), 1 deletion(-)
 create mode 100644 libsframe/libtool-version
  

Patch

diff --git a/libsframe/Makefile.am b/libsframe/Makefile.am
index 2d736624208..2d1d8fff063 100644
--- a/libsframe/Makefile.am
+++ b/libsframe/Makefile.am
@@ -29,6 +29,7 @@  INCDIR = $(srcdir)/../include
 # include libctf for swap.h
 AM_CPPFLAGS = -I$(srcdir) -I$(srcdir)/../include -I$(srcdir)/../libctf
 AM_CFLAGS = @ac_libsframe_warn_cflags@
+libsframe_version_info = -version-info `grep -v '^\#' $(srcdir)/libtool-version`
 
 if INSTALL_LIBBFD
 lib_LTLIBRARIES = libsframe.la
@@ -40,6 +41,10 @@  endif
 
 libsframe_la_SOURCES = sframe.c sframe-dump.c sframe-error.c
 libsframe_la_CPPFLAGS = $(AM_CPPFLAGS)
+libsframe_la_LDFLAGS = $(libsframe_version_info)
+
+EXTRA_DIST = libtool-version
+diststuff: $(EXTRA_DIST) info
 
 include doc/local.mk
 
diff --git a/libsframe/Makefile.in b/libsframe/Makefile.in
index c6a4cd56a9e..57f912caa13 100644
--- a/libsframe/Makefile.in
+++ b/libsframe/Makefile.in
@@ -180,6 +180,9 @@  AM_V_lt = $(am__v_lt_@AM_V@)
 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
 am__v_lt_0 = --silent
 am__v_lt_1 = 
+libsframe_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libsframe_la_LDFLAGS) $(LDFLAGS) -o $@
 @INSTALL_LIBBFD_FALSE@am_libsframe_la_rpath =
 @INSTALL_LIBBFD_TRUE@am_libsframe_la_rpath = -rpath $(libdir)
 @HAVE_COMPAT_DEJAGNU_TRUE@am__EXEEXT_1 = testsuite/libsframe.decode/be-flipping$(EXEEXT) \
@@ -519,12 +522,15 @@  INCDIR = $(srcdir)/../include
 # include libctf for swap.h
 AM_CPPFLAGS = -I$(srcdir) -I$(srcdir)/../include -I$(srcdir)/../libctf
 AM_CFLAGS = @ac_libsframe_warn_cflags@
+libsframe_version_info = -version-info `grep -v '^\#' $(srcdir)/libtool-version`
 @INSTALL_LIBBFD_TRUE@lib_LTLIBRARIES = libsframe.la
 @INSTALL_LIBBFD_FALSE@include_HEADERS = 
 @INSTALL_LIBBFD_TRUE@include_HEADERS = $(INCDIR)/sframe.h $(INCDIR)/sframe-api.h
 @INSTALL_LIBBFD_FALSE@noinst_LTLIBRARIES = libsframe.la
 libsframe_la_SOURCES = sframe.c sframe-dump.c sframe-error.c
 libsframe_la_CPPFLAGS = $(AM_CPPFLAGS)
+libsframe_la_LDFLAGS = $(libsframe_version_info)
+EXTRA_DIST = libtool-version
 @BUILD_INFO_TRUE@AM_MAKEINFOFLAGS = --no-split
 
 # Setup the testing framework
@@ -654,7 +660,7 @@  clean-noinstLTLIBRARIES:
 	}
 
 libsframe.la: $(libsframe_la_OBJECTS) $(libsframe_la_DEPENDENCIES) $(EXTRA_libsframe_la_DEPENDENCIES) 
-	$(AM_V_CCLD)$(LINK) $(am_libsframe_la_rpath) $(libsframe_la_OBJECTS) $(libsframe_la_LIBADD) $(LIBS)
+	$(AM_V_CCLD)$(libsframe_la_LINK) $(am_libsframe_la_rpath) $(libsframe_la_OBJECTS) $(libsframe_la_LIBADD) $(LIBS)
 
 clean-checkPROGRAMS:
 	@list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
@@ -1568,6 +1574,7 @@  uninstall-am: uninstall-dvi-am uninstall-html-am \
 
 .PRECIOUS: Makefile
 
+diststuff: $(EXTRA_DIST) info
 
 @BUILD_INFO_TRUE@html-local: doc/sframe-spec/index.html
 @BUILD_INFO_TRUE@doc/sframe-spec/index.html: doc/sframe-spec.texi doc/$(am__dirstamp)
diff --git a/libsframe/libtool-version b/libsframe/libtool-version
new file mode 100644
index 00000000000..9dcbe48e47d
--- /dev/null
+++ b/libsframe/libtool-version
@@ -0,0 +1,30 @@ 
+# This file is used to maintain libtool version info for libsframe.  See
+# the libtool manual to understand the meaning of the fields.  This is
+# a separate file so that version updates don't involve re-running
+# automake.
+#
+# Here are a set of rules to help you update your library version
+# information:
+#
+# 1. Start with version information of `0:0:0' for each libtool library.
+#
+# 2. Update the version information only immediately before a public
+#    release of your software. More frequent updates are unnecessary,
+#    and only guarantee that the current interface number gets larger
+#    faster.
+#
+# 3. If the library source code has changed at all since the last
+#    update, then increment revision (`c:r:a' becomes `c:r+1:a').
+#
+# 4. If any interfaces have been added, removed, or changed since the
+#    last update, increment current, and set revision to 0.
+#
+# 5. Increase the age value only if the changes made to the ABI are backward
+#    compatible.
+#    a. If any interfaces have been added since the last public release,
+#       then increment age.
+#    b. If any interfaces have been removed since the last public release,
+#       then set age to 0.
+#
+# CURRENT:REVISION:AGE
+1:0:0