linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] src/Makefile: re-add major version number to soname
@ 2022-03-21 11:41 Stefan Hajnoczi
  0 siblings, 0 replies; only message in thread
From: Stefan Hajnoczi @ 2022-03-21 11:41 UTC (permalink / raw)
  To: linux-block
  Cc: Jens Axboe, Stefan Hajnoczi, Daniel P . Berrangé, Bikal Lem

Commit c0b43df28a982747e081343f23289357ab4615db ("src/Makefile: use
VERSION variable consistently") changed the library soname from
liburing.so.2 to liburing.so.

The idea of soname is that executables linked against liburing.so.2
continue to work with liburing.so.2.1, liburing.so.2.2, etc because the
soname matches. They must not work against liburing.so.1 or
liburing.so.3 though since those major versions are incompatible.

Dropping the major version makes the soname unversioned and executables
will link against future liburing releases that are not compatible.

Fix the soname compatibility problem by re-adding the major version
number. Compute it from the VERSION value instead of hardcoding it in
the Makefile.

liburing 2.1:
  $ readelf -a src/liburing.so.2.1 | grep SON
   0x000000000000000e (SONAME)             Library soname: [liburing.so.2]

commit c0b43df28a98:
  $ readelf -a src/liburing.so.2.2 | grep SON
   0x000000000000000e (SONAME)             Library soname: [liburing.so]

With this fix:
  $ readelf -a src/liburing.so.2.2 | grep SON
   0x000000000000000e (SONAME)             Library soname: [liburing.so.2]

Fixes: c0b43df28a982747e081343f23289357ab4615db ("src/Makefile: use VERSION variable consistently")
Reported-by: Daniel P. Berrangé <berrange@redhat.com>
Cc: Bikal Lem <gbikal+git@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 Makefile.common | 1 +
 src/Makefile    | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/Makefile.common b/Makefile.common
index e7c9412..27fc233 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -2,4 +2,5 @@ TOP := $(dir $(CURDIR)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))
 NAME=liburing
 SPECFILE=$(TOP)/$(NAME).spec
 VERSION=$(shell awk '/Version:/ { print $$2 }' $(SPECFILE))
+VERSION_MAJOR=$(shell echo $(VERSION) | cut -d. -f1)
 TAG = $(NAME)-$(VERSION)
diff --git a/src/Makefile b/src/Makefile
index 0e04986..12cf49f 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -16,8 +16,8 @@ LINK_FLAGS=
 LINK_FLAGS+=$(LDFLAGS)
 ENABLE_SHARED ?= 1
 
-soname=liburing.so
-libname=$(soname).$(VERSION)
+soname=liburing.so.$(VERSION_MAJOR)
+libname=liburing.so.$(VERSION)
 all_targets += liburing.a
 
 ifeq ($(ENABLE_SHARED),1)
-- 
2.35.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-03-21 11:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-21 11:41 [PATCH] src/Makefile: re-add major version number to soname Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).