diff options
author | Antoine Jacoutot <ajacoutot@openbsd.org> | 2020-05-16 19:01:00 +0200 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2020-05-18 11:00:42 -0700 |
commit | bf34b971121d46d54f8870cd1faf420d6c0bafe5 (patch) | |
tree | 70666510da59c23806806b0706125099bc5adede /mesonbuild/scripts/symbolextractor.py | |
parent | 6fe68edbf889ac824a9f6d54009739577c047501 (diff) | |
download | meson-bf34b971121d46d54f8870cd1faf420d6c0bafe5.zip meson-bf34b971121d46d54f8870cd1faf420d6c0bafe5.tar.gz meson-bf34b971121d46d54f8870cd1faf420d6c0bafe5.tar.bz2 |
symbolextractor: add OpenBSD support
Diffstat (limited to 'mesonbuild/scripts/symbolextractor.py')
-rw-r--r-- | mesonbuild/scripts/symbolextractor.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/mesonbuild/scripts/symbolextractor.py b/mesonbuild/scripts/symbolextractor.py index 66161e2..41cca26 100644 --- a/mesonbuild/scripts/symbolextractor.py +++ b/mesonbuild/scripts/symbolextractor.py @@ -142,6 +142,23 @@ def osx_syms(libfilename: str, outfilename: str): result += [' '.join(x.split()[0:2]) for x in output.split('\n')] write_if_changed('\n'.join(result) + '\n', outfilename) +def openbsd_syms(libfilename: str, outfilename: str): + # Get the name of the library + output = call_tool('readelf', ['-d', libfilename]) + if not output: + dummy_syms(outfilename) + return + result = [x for x in output.split('\n') if 'SONAME' in x] + assert(len(result) <= 1) + # Get a list of all symbols exported + output = call_tool('nm', ['-D', '-P', '-g', libfilename]) + if not output: + dummy_syms(outfilename) + return + # U = undefined (cope with the lack of --defined-only option) + result += [' '.join(x.split()[0:2]) for x in output.split('\n') if x and not x.endswith('U ')] + write_if_changed('\n'.join(result) + '\n', outfilename) + def cygwin_syms(impfilename: str, outfilename: str): # Get the name of the library output = call_tool('dlltool', ['-I', impfilename]) @@ -237,6 +254,8 @@ def gen_symbols(libfilename: str, impfilename: str, outfilename: str, cross_host gnu_syms(libfilename, outfilename) elif mesonlib.is_osx(): osx_syms(libfilename, outfilename) + elif mesonlib.is_openbsd(): + openbsd_syms(libfilename, outfilename) elif mesonlib.is_windows(): if os.path.isfile(impfilename): windows_syms(impfilename, outfilename) |