[src/check-static-init] Ignore objdump "file format not recognized" error
Fixes https://github.com/harfbuzz/harfbuzz/issues/3019
This commit is contained in:
parent
5bc05ba155
commit
4e72d5e35d
|
@ -20,9 +20,20 @@ if not OBJS:
|
||||||
sys.exit (77)
|
sys.exit (77)
|
||||||
|
|
||||||
stat = 0
|
stat = 0
|
||||||
|
tested = 0
|
||||||
|
|
||||||
for obj in OBJS:
|
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
|
# Checking that no object file has static initializers
|
||||||
for l in re.findall (r'^.*\.[cd]tors.*$', result, re.MULTILINE):
|
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)
|
print ('Ouch, %s has lazy static C++ constructors/destructors or other such stuff' % obj)
|
||||||
stat = 1
|
stat = 1
|
||||||
|
|
||||||
sys.exit (stat)
|
tested += 1
|
||||||
|
|
||||||
|
sys.exit (stat if tested else 77)
|
||||||
|
|
Loading…
Reference in New Issue