OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright 2016 The Chromium Authors. All rights reserved. | 2 # Copyright 2016 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """check_no_neon.py - Check modules do not contain ARM Neon instructions.""" | 6 """check_no_neon.py - Check modules do not contain ARM Neon instructions.""" |
7 | 7 |
8 import argparse | 8 import argparse |
9 import os | 9 import os |
10 import sys | 10 import sys |
11 | 11 |
| 12 REPOSITORY_ROOT = os.path.abspath(os.path.join( |
| 13 os.path.dirname(__file__), '..', '..', '..')) |
| 14 |
| 15 sys.path.append(os.path.join(REPOSITORY_ROOT, 'build/android/gyp/util')) |
| 16 import build_utils |
| 17 |
12 | 18 |
13 def main(args): | 19 def main(args): |
14 parser = argparse.ArgumentParser( | 20 parser = argparse.ArgumentParser( |
15 description='Check modules do not contain ARM Neon instructions.') | 21 description='Check modules do not contain ARM Neon instructions.') |
16 parser.add_argument('objdump', metavar='path/to/ARM/objdump') | 22 parser.add_argument('objdump', metavar='path/to/ARM/objdump') |
17 parser.add_argument('objects', metavar='files/to/check/*.o') | 23 parser.add_argument('objects', metavar='files/to/check/*.o') |
| 24 parser.add_argument('--stamp', help='Path to touch on success.') |
18 opts = parser.parse_args(args) | 25 opts = parser.parse_args(args) |
19 return os.system(opts.objdump + ' -d --no-show-raw-insn ' + | 26 ret = os.system(opts.objdump + ' -d --no-show-raw-insn ' + |
20 opts.objects + ' | grep -q "vld[1-9]\\|vst[1-9]"') | 27 opts.objects + ' | grep -q "vld[1-9]\\|vst[1-9]"') |
21 | 28 |
| 29 # Non-zero exit code means no neon. |
| 30 if ret and opts.stamp: |
| 31 build_utils.Touch(opts.stamp) |
| 32 return ret |
| 33 |
22 | 34 |
23 if __name__ == '__main__': | 35 if __name__ == '__main__': |
24 sys.exit(0 if main(sys.argv[1:]) != 0 else -1) | 36 sys.exit(0 if main(sys.argv[1:]) != 0 else -1) |
OLD | NEW |