[PATCH] always hide local symbols generated by binutils

Alexander Bokovoy ab at samba.org
Thu Jul 12 07:34:09 UTC 2018


attached patch should make Samba libraries usable with upcoming binutils
2.31. See https://bugzilla.redhat.com/show_bug.cgi?id=1600035 for
details of typical failures and explanation from binutils developers.

This is not a full solution as it does not get rid of multiple _end
symbols somehow generated by a linker. However, it should help with
linking against Samba libraries because those symbols will have a local
scope and would not fail the linkage.

/ Alexander Bokovoy
-------------- next part --------------
>From d10ccbc8a07c85f73555bd842df5ecb2c8a7efa2 Mon Sep 17 00:00:00 2001
From: Alexander Bokovoy <ab at samba.org>
Date: Thu, 12 Jul 2018 10:19:41 +0300
Subject: [PATCH] wafsamba/samba_abi: always hide ABI symbols which must be

binutils 2.31 is going to change how shared libraries are linked, such
that they always provide their own local definitions of the _end, _edata
and _bss_start symbols.  This would all be fine, except for shared
libraries that export all symbols be default.  (Rather than just
exporting those symbols that form part of their API).

According to binutils developers, we should only export the symbols we
explicitly want to be used. We don't use this principle for all our
libraries and deliberately don't want to have ABI versioning control for
all of them, so the change I introduce here is to explicitly mark those
symbols that will always be added by default linker configuration with
binutils 2.31 as local. Right now these are '_end', '_edata', and
'_bss_start' symbols.

Signed-off-by: Alexander Bokovoy <ab at samba.org>
 buildtools/wafsamba/samba_abi.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/buildtools/wafsamba/samba_abi.py b/buildtools/wafsamba/samba_abi.py
index 196b468f5b3..f3f66dd1d45 100644
--- a/buildtools/wafsamba/samba_abi.py
+++ b/buildtools/wafsamba/samba_abi.py
@@ -192,10 +192,12 @@ def abi_write_vscript(f, libname, current_version, versions, symmap, abi_match):
             f.write("\t\t%s;\n" % x)
-    if abi_match != ["*"]:
-        f.write("\tlocal:\n")
-        for x in local_abi:
-            f.write("\t\t%s;\n" % x[1:])
+    # Always hide symbols that must be local if exist
+    local_abi.extend(["!_end", "!_bss_start", "!_edata"])
+    f.write("\tlocal:\n")
+    for x in local_abi:
+        f.write("\t\t%s;\n" % x[1:])
+    if global_abi != ["*"]:
         if len(global_abi) > 0:

More information about the samba-technical mailing list