summaryrefslogtreecommitdiff
path: root/buildtools/wafsamba
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-09-08 19:07:47 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-09-08 13:37:40 +0200
commit30e11d55b526632f93fb60ff944c771f452ab5b4 (patch)
tree9409d9623f4e18c55c12a856da87580858e68253 /buildtools/wafsamba
parent3346af16752a08ea134059f75c003b01a7b7f7ec (diff)
downloadsamba-30e11d55b526632f93fb60ff944c771f452ab5b4.tar.gz
samba-30e11d55b526632f93fb60ff944c771f452ab5b4.tar.bz2
samba-30e11d55b526632f93fb60ff944c771f452ab5b4.zip
build: Add duplicate symbol checking as part of make test
This ensures we do not get duplicate symbols again, when run as ./configure.developer on non-build farm machines. Andrew Bartlett Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Thu Sep 8 13:37:40 CEST 2011 on sn-devel-104
Diffstat (limited to 'buildtools/wafsamba')
-rw-r--r--buildtools/wafsamba/symbols.py28
-rwxr-xr-xbuildtools/wafsamba/wscript4
2 files changed, 26 insertions, 6 deletions
diff --git a/buildtools/wafsamba/symbols.py b/buildtools/wafsamba/symbols.py
index dfab71c2c4..87757357af 100644
--- a/buildtools/wafsamba/symbols.py
+++ b/buildtools/wafsamba/symbols.py
@@ -567,7 +567,7 @@ def symbols_whyneeded(task):
Logs.info("target '%s' uses symbols %s from '%s'" % (target, overlap, subsystem))
-def report_duplicate(bld, binname, sym, libs):
+def report_duplicate(bld, binname, sym, libs, fail_on_error):
'''report duplicated symbols'''
if sym in ['_init', '_fini']:
return
@@ -577,10 +577,13 @@ def report_duplicate(bld, binname, sym, libs):
libnames.append(bld.env.library_dict[lib])
else:
libnames.append(lib)
- print("%s: Symbol %s linked in multiple libraries %s" % (binname, sym, libnames))
+ if fail_on_error:
+ raise Utils.WafError("%s: Symbol %s linked in multiple libraries %s" % (binname, sym, libnames))
+ else:
+ print("%s: Symbol %s linked in multiple libraries %s" % (binname, sym, libnames))
-def symbols_dupcheck_binary(bld, binname):
+def symbols_dupcheck_binary(bld, binname, fail_on_error):
'''check for duplicated symbols in one binary'''
libs = get_libs_recursive(bld, binname, set())
@@ -596,10 +599,10 @@ def symbols_dupcheck_binary(bld, binname):
if len(symmap[sym]) > 1:
for libpath in symmap[sym]:
if libpath in bld.env.library_dict:
- report_duplicate(bld, binname, sym, symmap[sym])
+ report_duplicate(bld, binname, sym, symmap[sym], fail_on_error)
break
-def symbols_dupcheck(task):
+def symbols_dupcheck(task, fail_on_error=False):
'''check for symbols defined in two different subsystems'''
bld = task.env.bld
tgt_list = get_tgt_list(bld)
@@ -610,8 +613,12 @@ def symbols_dupcheck(task):
for t in tgt_list:
if t.samba_type == 'BINARY':
binname = os_path_relpath(t.link_task.outputs[0].abspath(bld.env), os.getcwd())
- symbols_dupcheck_binary(bld, binname)
+ symbols_dupcheck_binary(bld, binname, fail_on_error)
+
+def symbols_dupcheck_fatal(task):
+ '''check for symbols defined in two different subsystems (and fail if duplicates are found)'''
+ symbols_dupcheck(task, fail_on_error=True)
def SYMBOL_CHECK(bld):
@@ -636,3 +643,12 @@ def SYMBOL_CHECK(bld):
Build.BuildContext.SYMBOL_CHECK = SYMBOL_CHECK
+
+def DUP_SYMBOL_CHECK(bld):
+ if Options.options.DUP_SYMBOLCHECK and bld.env.DEVELOPER and not bld.env.BUILD_FARM:
+ '''check for duplicate symbols'''
+ bld.SET_BUILD_GROUP('syslibcheck')
+ task = bld(rule=symbols_dupcheck_fatal, always=True, name='symbol duplicate checking')
+ task.env.bld = bld
+
+Build.BuildContext.DUP_SYMBOL_CHECK = DUP_SYMBOL_CHECK
diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript
index ecc2ae51f6..1a7f3eb699 100755
--- a/buildtools/wafsamba/wscript
+++ b/buildtools/wafsamba/wscript
@@ -121,6 +121,10 @@ def set_options(opt):
help=("check symbols in object files against project rules"),
action='store_true', dest='SYMBOLCHECK', default=False)
+ gr.add_option('--dup-symbol-check',
+ help=("check for duplicate symbols in object files and system libs (must be configured with --enable-developer)"),
+ action='store_true', dest='DUP_SYMBOLCHECK', default=False)
+
gr.add_option('--why-needed',
help=("TARGET:DEPENDENCY check why TARGET needs DEPENDENCY"),
action='store', type='str', dest='WHYNEEDED', default=None)