summaryrefslogtreecommitdiff
blob: 3c08be67cb5b301503d5e3d699ee57408dfb9302 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
From 3a489acb4547c320ba43858ead3586fed34c92b4 Mon Sep 17 00:00:00 2001
From: Sergei Trofimovich <slyfox@gentoo.org>
Date: Tue, 20 Jul 2021 21:12:38 +0200
Subject: [PATCH 3/7] Gentoo: add --with-extra-soversion-suffix= option
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

--with-extra-soversion-suffix= will allow Gentoo to
distinct libbfd.so and libopcodes.so to have more precise
SONAME.

Today --enable-targets=all and --enable-64-bit-bfd change
libbfd.so ABI:
--enable-targets=all adds new symbols to the library
--enable-64-bit-bfd modifies BFD_ARCH_SIZE default and
changes sizes of integer parameters and fields to most
APIs.

--with-extra-soversion-suffix= will allow Gentoo to inject
additional keys into SONAME to indicate ABI change and avoid
hard to diagnose crashes when user reinstalls libbfd.so
built with different flags (see https://bugs.gentoo.org/663690).

Bug: https://bugs.gentoo.org/666100
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

Ported to binutils 2.37 by Andreas K. Hüttel <dilfridge@gentoo.org>
---
 bfd/Makefile.am  |  5 +++++
 bfd/Makefile.in  |  4 ++++
 bfd/configure    | 13 +++++++++++++
 bfd/configure.ac |  7 +++++++
 4 files changed, 29 insertions(+)

diff --git a/bfd/Makefile.am b/bfd/Makefile.am
index 5c5fdefd3b8..fe26bbf4f0f 100644
--- a/bfd/Makefile.am
+++ b/bfd/Makefile.am
@@ -64,6 +64,8 @@ bfdinclude_HEADERS += $(INCDIR)/plugin-api.h
 LIBDL = @lt_cv_dlopen_libs@
 endif
 
+EXTRA_SOVERSION_SUFFIX = @EXTRA_SOVERSION_SUFFIX@
+
 # bfd.h goes here, for now
 BFD_H = bfd.h
 
@@ -976,6 +978,9 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
 	  bfd_version_string="\"$(VERSION).$${bfd_version_date}\"" ;\
 	  bfd_soversion="$(VERSION).$${bfd_version_date}" ;\
 	fi ;\
+	if test x"$(EXTRA_SOVERSION_SUFFIX)" != x ; then \
+	  bfd_soversion="$${bfd_soversion}.$(EXTRA_SOVERSION_SUFFIX)" ;\
+	fi ;\
 	$(SED) -e "s,@bfd_version@,$$bfd_version," \
 	    -e "s,@bfd_version_string@,$$bfd_version_string," \
 	    -e "s,@bfd_version_package@,$$bfd_version_package," \
diff --git a/bfd/Makefile.in b/bfd/Makefile.in
index 4edfedee924..70a2442957e 100644
--- a/bfd/Makefile.in
+++ b/bfd/Makefile.in
@@ -342,6 +342,7 @@ ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
+EXTRA_SOVERSION_SUFFIX = @EXTRA_SOVERSION_SUFFIX@
 FGREP = @FGREP@
 GENCAT = @GENCAT@
 GMSGFMT = @GMSGFMT@
@@ -2435,6 +2436,9 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
 	  bfd_version_string="\"$(VERSION).$${bfd_version_date}\"" ;\
 	  bfd_soversion="$(VERSION).$${bfd_version_date}" ;\
 	fi ;\
+	if test x"$(EXTRA_SOVERSION_SUFFIX)" != x ; then \
+	  bfd_soversion="$${bfd_soversion}.$(EXTRA_SOVERSION_SUFFIX)" ;\
+	fi ;\
 	$(SED) -e "s,@bfd_version@,$$bfd_version," \
 	    -e "s,@bfd_version_string@,$$bfd_version_string," \
 	    -e "s,@bfd_version_package@,$$bfd_version_package," \
diff --git a/bfd/configure b/bfd/configure
index dcb10317390..94a4e39d691 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -695,6 +695,7 @@ WARN_CFLAGS
 REPORT_BUGS_TEXI
 REPORT_BUGS_TO
 PKGVERSION
+EXTRA_SOVERSION_SUFFIX
 DEBUGDIR
 ENABLE_BFD_64_BIT_FALSE
 ENABLE_BFD_64_BIT_TRUE
@@ -836,6 +837,7 @@ enable_secureplt
 enable_separate_code
 enable_leading_mingw64_underscores
 with_separate_debug_dir
+with_extra_soversion_suffix
 with_pkgversion
 with_bugurl
 enable_werror
@@ -1518,6 +1520,8 @@ Optional Packages:
   --with-separate-debug-dir=DIR
                           Look for global separate debug info in DIR
                           [[default=LIBDIR/debug]]
+  --with-extra-soversion-suffix=SUFFIX
+                          Append '.SUFFIX' to SONAME [default=]
   --with-pkgversion=PKG   Use PKG in the version string in place of "GNU
                           Binutils"
   --with-bugurl=URL       Direct users to URL to report a bug
@@ -12033,6 +12037,15 @@ fi
 
 
 
+EXTRA_SOVERSION_SUFFIX=
+
+# Check whether --with-extra-soversion-suffix was given.
+if test "${with_extra_soversion_suffix+set}" = set; then :
+  withval=$with_extra_soversion_suffix; EXTRA_SOVERSION_SUFFIX="${withval}"
+fi
+
+
+
 
 
 # Check whether --with-pkgversion was given.
diff --git a/bfd/configure.ac b/bfd/configure.ac
index f044616f4d9..f22a87f8f54 100644
--- a/bfd/configure.ac
+++ b/bfd/configure.ac
@@ -168,6 +168,13 @@ AC_ARG_WITH(separate-debug-dir,
 [DEBUGDIR="${withval}"])
 AC_SUBST(DEBUGDIR)
 
+EXTRA_SOVERSION_SUFFIX=
+AC_ARG_WITH(extra-soversion-suffix,
+  AS_HELP_STRING([--with-extra-soversion-suffix=SUFFIX],
+                 [Append '.SUFFIX' to SONAME [[default=]]]),
+[EXTRA_SOVERSION_SUFFIX="${withval}"])
+AC_SUBST(EXTRA_SOVERSION_SUFFIX)
+
 ACX_PKGVERSION([GNU Binutils])
 ACX_BUGURL([https://sourceware.org/bugzilla/])
 
-- 
2.41.0