diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2020-02-16 01:38:28 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2020-02-16 03:11:51 +0530 |
commit | 77d163a0e9eb9717a13a9c1a8839df9d48b9fc84 (patch) | |
tree | 91c0377f7c338df189a3a946e4b12b041d07c258 /mesonbuild/scripts | |
parent | 83960ea0508d993497cfe43188afb2884c8bc21e (diff) | |
download | meson-77d163a0e9eb9717a13a9c1a8839df9d48b9fc84.zip meson-77d163a0e9eb9717a13a9c1a8839df9d48b9fc84.tar.gz meson-77d163a0e9eb9717a13a9c1a8839df9d48b9fc84.tar.bz2 |
symbolextractor: Print one warning when no implementation found
So people know why all their binaries are getting relinked. Do this
only once per build-dir by writing a file to meson-private.
Diffstat (limited to 'mesonbuild/scripts')
-rw-r--r-- | mesonbuild/scripts/symbolextractor.py | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/mesonbuild/scripts/symbolextractor.py b/mesonbuild/scripts/symbolextractor.py index 410cb33..1bce6e4 100644 --- a/mesonbuild/scripts/symbolextractor.py +++ b/mesonbuild/scripts/symbolextractor.py @@ -22,6 +22,7 @@ import os, sys from .. import mesonlib +from .. import mlog from ..mesonlib import Popen_safe import argparse @@ -31,6 +32,9 @@ parser.add_argument('--cross-host', default=None, dest='cross_host', help='cross compilation host platform') parser.add_argument('args', nargs='+') +TOOL_WARNING_FILE = None +RELINKING_WARNING = 'Relinking will always happen on source changes.' + def dummy_syms(outfilename): """Just touch it so relinking happens always.""" with open(outfilename, 'w'): @@ -96,25 +100,33 @@ def osx_syms(libfilename, outfilename): def gen_symbols(libfilename, outfilename, cross_host): if cross_host is not None: - # In case of cross builds just always relink. - # In theory we could determine the correct - # toolset but there are more important things - # to do. + # In case of cross builds just always relink. In theory we could + # determine the correct toolset, but we would need to use the correct + # `nm`, `readelf`, etc, from the cross info which requires refactoring. dummy_syms(outfilename) elif mesonlib.is_linux(): linux_syms(libfilename, outfilename) elif mesonlib.is_osx(): osx_syms(libfilename, outfilename) else: + if not os.path.exists(TOOL_WARNING_FILE): + mlog.warning('Symbol extracting has not been implemented for this ' + 'platform. ' + RELINKING_WARNING) + # Write it out so we don't warn again + with open(TOOL_WARNING_FILE, 'w'): + pass dummy_syms(outfilename) def run(args): + global TOOL_WARNING_FILE options = parser.parse_args(args) - if len(options.args) != 2: + if len(options.args) != 3: print('symbolextractor.py <shared library file> <output file>') sys.exit(1) - libfile = options.args[0] - outfile = options.args[1] + privdir = os.path.join(options.args[0], 'meson-private') + TOOL_WARNING_FILE = os.path.join(privdir, 'symbolextractor_tool_warning_printed') + libfile = options.args[1] + outfile = options.args[2] gen_symbols(libfile, outfile, options.cross_host) return 0 |