Skip to content

Commit

Permalink
tests: handle uncommon architecture format for nm
Browse files Browse the repository at this point in the history
The zlib symbols may not be of type 'T' but rather e.g. 'D' -- instead,
tell nm to emit the POSIX format and also to only emit defined symbols,
not undefined ones. Then we just check if the symbol is listed at all,
regardless of type.

We already depend on -U elsewhere (e.g symbolextractor). There's no real
replacement for it, sadly.

Bug: https://bugs.gentoo.org/938259
  • Loading branch information
eli-schwartz committed Aug 21, 2024
1 parent df70680 commit 905c060
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@

def handle_common(path):
"""Handle the common case."""
output = subprocess.check_output(['nm', path]).decode('utf-8')
if 'T zlibVersion' in output:
output = subprocess.check_output(['nm', '-UPA', path]).decode('utf-8')
# POSIX format. Prints all *defined* symbols, looks like this:
# builddir/main_static: zlibVersion T 1190 39
# or
# builddir/main_static: zlibVersion D 1fde0 30
if ': zlibVersion ' in output:
return 0
return 1

Expand Down

0 comments on commit 905c060

Please sign in to comment.