mirror of
https://github.com/samba-team/samba.git
synced 2025-02-02 09:47:23 +03:00
waf: use -Wl,--version-script if available
This enables symbol version on our libraries, if the system supports it If the library is a public library, then set the symbol version based on the major number. If it is a private library then set it based on the full version number (which will include the git hash if available). This ensures that applications using our libraries don't use symbols from other libraries that they may be linked to. It also ensures we only use the right version of any private libraries. Note that the linker ends up generating both a version and unversioned symbol for all symbols. This means existing users of our public libraries will continue to work, with symbols resolved to the unversioned symbol. When applications are re-linked they will bind to the specific symbol version. Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org> Pair-Programmed-With: Jelmer Vernooij <jelmer@samba.org>
This commit is contained in:
parent
d0c93ba115
commit
35134214ae
@ -952,7 +952,8 @@ def show_object_duplicates(bld, tgt_list):
|
||||
######################################################################
|
||||
# this provides a way to save our dependency calculations between runs
|
||||
savedeps_version = 3
|
||||
savedeps_inputs = ['samba_deps', 'samba_includes', 'local_include', 'local_include_first', 'samba_cflags', 'source', 'grouping_library']
|
||||
savedeps_inputs = ['samba_deps', 'samba_includes', 'local_include', 'local_include_first', 'samba_cflags',
|
||||
'source', 'grouping_library', 'ldflags']
|
||||
savedeps_outputs = ['uselib', 'uselib_local', 'add_objects', 'includes', 'ccflags', 'ldflags', 'samba_deps_extended']
|
||||
savedeps_outenv = ['INC_PATHS']
|
||||
savedeps_envvars = ['NONSHARED_BINARIES', 'GLOBAL_DEPENDENCIES', 'EXTRA_CFLAGS', 'EXTRA_LDFLAGS' ]
|
||||
|
@ -103,6 +103,7 @@ def SAMBA_LIBRARY(bld, libname, source,
|
||||
vnum=None,
|
||||
soname=None,
|
||||
cflags='',
|
||||
ldflags='',
|
||||
external_library=False,
|
||||
realname=None,
|
||||
autoproto=None,
|
||||
@ -188,11 +189,24 @@ def SAMBA_LIBRARY(bld, libname, source,
|
||||
else:
|
||||
bundled_name = PRIVATE_NAME(bld, libname, bundled_extension, private_library)
|
||||
|
||||
ldflags = TO_LIST(ldflags)
|
||||
|
||||
if private_library:
|
||||
if vnum:
|
||||
Logs.error("vnum is invalid for private libraries")
|
||||
sys.exit(1)
|
||||
vnum = Utils.g_module.VERSION[0]
|
||||
vnum = Utils.g_module.VERSION.split(".")[0]
|
||||
version = "%s_%s" % (Utils.g_module.APPNAME, Utils.g_module.VERSION)
|
||||
else:
|
||||
version = "%s_%s" % (Utils.g_module.APPNAME, Utils.g_module.VERSION.split(".")[0])
|
||||
|
||||
if bld.env.HAVE_LD_VERSION_SCRIPT:
|
||||
vscript = "%s.vscript" % libname
|
||||
bld.SAMBA_GENERATOR(vscript,
|
||||
rule="echo %s \{ global: \*\; \}\; > ${TGT}" % version.replace("-","_").upper(),
|
||||
group='vscripts',
|
||||
target=vscript)
|
||||
ldflags.append("-Wl,--version-script=%s/%s" % (bld.path.abspath(bld.env), vscript))
|
||||
|
||||
features = 'cc cshlib symlink_lib install_lib'
|
||||
if target_type == 'PYTHON':
|
||||
@ -213,6 +227,7 @@ def SAMBA_LIBRARY(bld, libname, source,
|
||||
source = [],
|
||||
target = bundled_name,
|
||||
depends_on = depends_on,
|
||||
ldflags = ldflags,
|
||||
samba_deps = deps,
|
||||
samba_includes = includes,
|
||||
local_include = local_include,
|
||||
@ -525,6 +540,7 @@ def SETUP_BUILD_GROUPS(bld):
|
||||
bld.env['USING_BUILD_GROUPS'] = True
|
||||
bld.add_group('setup')
|
||||
bld.add_group('build_compiler_source')
|
||||
bld.add_group('vscripts')
|
||||
bld.add_group('base_libraries')
|
||||
bld.add_group('generators')
|
||||
bld.add_group('compiler_prototypes')
|
||||
|
Loading…
x
Reference in New Issue
Block a user