From 4e72d5e35d68b1772985ddafc522dcd4b0aceec2 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 13 Jun 2021 05:46:17 -0600 Subject: [PATCH] [src/check-static-init] Ignore objdump "file format not recognized" error Fixes https://github.com/harfbuzz/harfbuzz/issues/3019 --- src/check-static-inits.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/check-static-inits.py b/src/check-static-inits.py index 813295d57..37e0590fa 100755 --- a/src/check-static-inits.py +++ b/src/check-static-inits.py @@ -20,9 +20,20 @@ if not OBJS: sys.exit (77) stat = 0 +tested = 0 for obj in OBJS: - result = subprocess.check_output (objdump.split () + ['-t', obj]).decode ('utf-8') + result = subprocess.run(objdump.split () + ['-t', obj], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + if result.returncode: + if result.stderr.find (b'not recognized') != -1: + # https://github.com/harfbuzz/harfbuzz/issues/3019 + print ('objdump %s returned "not recognized", skipping' % obj) + continue + print ('objdump %s returned error:\n%s' % (obj, result.stderr.decode ('utf-8'))) + stat = 2 + + result = result.stdout.decode ('utf-8') # Checking that no object file has static initializers for l in re.findall (r'^.*\.[cd]tors.*$', result, re.MULTILINE): @@ -35,4 +46,6 @@ for obj in OBJS: print ('Ouch, %s has lazy static C++ constructors/destructors or other such stuff' % obj) stat = 1 -sys.exit (stat) + tested += 1 + +sys.exit (stat if tested else 77)