symbolextractor: Correctly filter undefined symbols on macOS

-g is --extern-only and -P is --format=posix. We were missing
--defined-only for some reason, which we pass to `nm` on Linux.
This avoids having to manually filter later.
pull/6637/head
Nirbheek Chauhan 5 years ago
parent 77d163a0e9
commit 431283b35d
  1. 6
      mesonbuild/scripts/symbolextractor.py

@ -92,10 +92,12 @@ def osx_syms(libfilename, outfilename):
match = i match = i
break break
result = [arr[match + 2], arr[match + 5]] # Libreoffice stores all 5 lines but the others seem irrelevant. result = [arr[match + 2], arr[match + 5]] # Libreoffice stores all 5 lines but the others seem irrelevant.
pnm, output = Popen_safe(['nm', '-g', '-P', libfilename])[0:2] pnm, output = Popen_safe(['nm', '--extern-only',
'--defined-only', '--format=posix',
libfilename])[0:2]
if pnm.returncode != 0: if pnm.returncode != 0:
raise RuntimeError('nm does not work.') raise RuntimeError('nm does not work.')
result += [' '.join(x.split()[0:2]) for x in output.split('\n') if x and not x.endswith('U')] result += [' '.join(x.split()[0:2]) for x in output.split('\n')]
write_if_changed('\n'.join(result) + '\n', outfilename) write_if_changed('\n'.join(result) + '\n', outfilename)
def gen_symbols(libfilename, outfilename, cross_host): def gen_symbols(libfilename, outfilename, cross_host):

Loading…
Cancel
Save