libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Better soname linking


From: Jan Engelhardt
Subject: Better soname linking
Date: Sun, 25 Oct 2009 15:00:27 +0100 (CET)
User-agent: Alpine 2.00 (LSU 1167 2008-08-23)

Hello all,


just today I stumbled over an issue where I think that the way 
-version-info is encoded into the library and/or filename is not that 
perfect after all.

---8<---
parent 741a9867eb71eb258ca1ed5b85bc7f03ce864195 (v2.2.6-150-g741a986)
commit 34a9ed656c08625f975913b74bdc995ff2d18610
Author: Jan Engelhardt <address@hidden>
Date:   Sun Oct 25 13:26:58 2009 +0100

Create symlinks to all API versions and set soname to highest

-version-info 23:0:1 will create a libfoo.so.22.1.0 and there is a
symlink libfoo.so.22 to it, so that programs originally linked for
v22 continue to work with a v23 that implements APIs 22–23.

However, a program that uses functions from API 23 is still linked
against libfoo.so.22. In other words, you could deploy this program
on a system which only has libfoo.so.22.0.0 — and package managers
will happily do that without upgrading libfoo to so.22.1.0 —, thus
potentially rendering essential system services unusable without a
warning until it is too late:

 program: unknown symbol api23_function in libfoo.so.22
 (or similar wording)

This proposed solution includes changing the encode the highest
version as the soname, so that new programs always link against the
latest one. Appropriate symlinks for all API verisons will then be
provided so that programs previously linked continue to work.

Signed-off-by: Jan Engelhardt <address@hidden>
---
 libltdl/config/ltmain.m4sh |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh
index f1bf43f..69b1091 100644
--- a/libltdl/config/ltmain.m4sh
+++ b/libltdl/config/ltmain.m4sh
@@ -5915,6 +5915,16 @@ func_mode_link ()
          func_arith $current - $age
          major=.$func_arith_result
          versuffix="$major.$age.$revision"
+         major=.$current
+
+         # Add symlinks for all interfaces that we are compatible with.
+         loop=$age
+         while test "$loop" -ne 0; do
+           func_arith $current - $loop
+           library_names_spec="$library_names_spec 
\${libname}\${release}\${shared_ext}.$func_arith_result"
+           func_arith $loop - 1
+           loop=$func_arith_result
+         done
          ;;
 
        osf)
-- 
# Created with git-export-patch




reply via email to

[Prev in Thread] Current Thread [Next in Thread]