Force everything to use python3 for consistency.
Rather than "whatever people have installed as 'python' on their machine". I've removed check-symbols.py because that's been broken for years and we never even noticed, and I'm not sure it's worth fixing. Test: treehugger, manual Change-Id: Ieb996bbdf790a18d4b1fb46a409cc240ba2a2a49
This commit is contained in:
parent
9cf8871dd9
commit
6b586e7709
15 changed files with 33 additions and 115 deletions
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Description of the header clean process
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
"""A glorified C pre-processor parser."""
|
||||
|
||||
import ctypes
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
import sys, cpp, kernel, glob, os, re, getopt, clean_header, subprocess, shutil
|
||||
from defaults import *
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Copyright (C) 2015 The Android Open Source Project
|
||||
#
|
||||
|
@ -231,33 +231,33 @@ posix = posix - in_posix_and_glibc_but_dead_or_useless
|
|||
glibc = glibc - in_posix_and_glibc_but_dead_or_useless
|
||||
|
||||
if not only_unwanted:
|
||||
#print 'glibc:'
|
||||
#print('glibc:')
|
||||
#for symbol in sorted(glibc):
|
||||
# print symbol
|
||||
#print
|
||||
# print(symbol)
|
||||
#print()
|
||||
|
||||
#print 'bionic:'
|
||||
#print('bionic:')
|
||||
#for symbol in sorted(bionic):
|
||||
# print symbol
|
||||
#print
|
||||
# print(symbol)
|
||||
#print()
|
||||
|
||||
print 'in glibc (but not posix) but not bionic:'
|
||||
print('in glibc (but not posix) but not bionic:')
|
||||
for symbol in sorted((glibc - posix).difference(bionic)):
|
||||
print symbol
|
||||
print
|
||||
print(symbol)
|
||||
print()
|
||||
|
||||
print 'in posix (and implemented in glibc) but not bionic:'
|
||||
print('in posix (and implemented in glibc) but not bionic:')
|
||||
for symbol in sorted((posix.intersection(glibc)).difference(bionic)):
|
||||
print symbol
|
||||
print
|
||||
print(symbol)
|
||||
print()
|
||||
|
||||
print 'in bionic but not glibc:'
|
||||
print('in bionic but not glibc:')
|
||||
|
||||
allowed_stuff = (bsd_stuff | FORTIFY_stuff | linux_stuff | macro_stuff |
|
||||
std_stuff | weird_stuff | libresolv_stuff | known)
|
||||
for symbol in sorted((bionic - allowed_stuff).difference(glibc)):
|
||||
if symbol in ndk_ignored:
|
||||
symbol += '*'
|
||||
print symbol
|
||||
print(symbol)
|
||||
|
||||
sys.exit(0)
|
||||
|
|
|
@ -1,87 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import glob
|
||||
import os
|
||||
import re
|
||||
import string
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
toolchain = os.environ['ANDROID_TOOLCHAIN']
|
||||
arch = re.sub(r'.*/linux-x86/([^/]+)/.*', r'\1', toolchain)
|
||||
|
||||
sys.stderr.write('Checking symbols for arch "%s"...\n' % arch)
|
||||
|
||||
def GetSymbols(library, functions_or_variables):
|
||||
global api
|
||||
global arch
|
||||
|
||||
api = '9'
|
||||
if library == 'libm' and arch == 'arm':
|
||||
api = '3'
|
||||
|
||||
# There were no 64-bit ABIs before API level 21.
|
||||
if '64' in arch:
|
||||
api = '21'
|
||||
|
||||
# What GCC calls aarch64, Android calls arm64.
|
||||
if arch == 'aarch64':
|
||||
arch = 'arm64'
|
||||
|
||||
path = '%s/development/ndk/platforms/android-%s/arch-%s/symbols/%s.so.%s.txt' % (os.environ['ANDROID_BUILD_TOP'], api, arch, library, functions_or_variables)
|
||||
symbols = set()
|
||||
for line in open(path, 'r'):
|
||||
symbols.add(line.rstrip())
|
||||
#sys.stdout.write('%d %s in %s for %s\n' % (len(symbols), functions_or_variables, library, arch))
|
||||
return symbols
|
||||
|
||||
def CheckSymbols(library, functions_or_variables):
|
||||
expected_symbols = GetSymbols(library, functions_or_variables)
|
||||
|
||||
lib_dir = 'lib'
|
||||
if '64' in arch:
|
||||
lib_dir = 'lib64'
|
||||
|
||||
so_file = '%s/system/%s/%s.so' % (os.environ['ANDROID_PRODUCT_OUT'], lib_dir, library)
|
||||
|
||||
# Example readelf output:
|
||||
# 264: 0001623c 4 FUNC GLOBAL DEFAULT 8 cabsf
|
||||
# 266: 00016244 4 FUNC GLOBAL DEFAULT 8 dremf
|
||||
# 267: 00019018 4 OBJECT GLOBAL DEFAULT 11 __fe_dfl_env
|
||||
# 268: 00000000 0 FUNC GLOBAL DEFAULT UND __aeabi_dcmplt
|
||||
|
||||
|
||||
r = re.compile(r' +\d+: [0-9a-f]+ +\d+ (FUNC|OBJECT) +\S+ +\S+ +\d+ (\S+)')
|
||||
|
||||
actual_symbols = set()
|
||||
for line in subprocess.check_output(['readelf', '-W', '--dyn-syms', so_file]).split('\n'):
|
||||
m = r.match(line)
|
||||
if m:
|
||||
symbol = string.split(m.group(2), '@')[0]
|
||||
if m.group(1) == 'FUNC' and functions_or_variables == 'functions':
|
||||
actual_symbols.add(symbol)
|
||||
elif m.group(1) == 'OBJECT' and functions_or_variables == 'variables':
|
||||
actual_symbols.add(symbol)
|
||||
#else:
|
||||
#print 'ignoring: ' % line
|
||||
|
||||
missing = expected_symbols - actual_symbols
|
||||
if len(missing) > 0:
|
||||
sys.stderr.write('%d missing %s in %s for %s:\n' % (len(missing), functions_or_variables, library, arch))
|
||||
for miss in sorted(missing):
|
||||
sys.stderr.write(' %s\n' % miss)
|
||||
|
||||
extra = actual_symbols - expected_symbols
|
||||
if len(extra) > 0:
|
||||
sys.stderr.write('%d extra %s in %s for %s:\n' % (len(extra), functions_or_variables, library, arch))
|
||||
for s in sorted(extra):
|
||||
sys.stderr.write(' %s\n' % s)
|
||||
|
||||
return len(missing) == 0
|
||||
|
||||
CheckSymbols("libc", "functions")
|
||||
CheckSymbols("libc", "variables")
|
||||
CheckSymbols("libm", "functions")
|
||||
CheckSymbols("libm", "variables")
|
||||
|
||||
sys.exit(0)
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
# Run with directory arguments from any directory, with no special setup
|
||||
# required.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
import logging
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
import logging
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
|
||||
import sys, os, string, re
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# This tool is used to generate the assembler system call stubs,
|
||||
# the header files listing all available system calls, and the
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Copyright (C) 2015 The Android Open Source Project
|
||||
#
|
||||
|
|
|
@ -41,7 +41,8 @@ def GetFromElf(elf_file, sym_type='--dyn-syms'):
|
|||
|
||||
symbols = set()
|
||||
|
||||
output = subprocess.check_output(['readelf', sym_type, '-W', elf_file])
|
||||
output = subprocess.check_output(['readelf', sym_type, '-W', elf_file],
|
||||
text=True)
|
||||
for line in output.split('\n'):
|
||||
if ' HIDDEN ' in line or ' UND ' in line:
|
||||
continue
|
||||
|
@ -76,6 +77,10 @@ def GetFromAndroidSo(files):
|
|||
if not os.path.isdir(lib_dir):
|
||||
lib_dir = os.path.join(out_dir, 'system/lib')
|
||||
|
||||
lib_dir = os.path.join(out_dir, 'apex/com.android.runtime/lib64/bionic/')
|
||||
if not os.path.isdir(lib_dir):
|
||||
lib_dir = os.path.join(out_dir, 'apex/com.android.runtime/lib/bionic/')
|
||||
|
||||
results = set()
|
||||
for f in files:
|
||||
results |= GetFromElf(os.path.join(lib_dir, f))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
# Unit tests for genseccomp.py
|
||||
|
||||
import textwrap
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# This tool is used to generate the version scripts for libc, libm, libdl,
|
||||
# and libstdc++ for every architecture.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
|
|
Loading…
Reference in a new issue