Chromium Code Reviews| Index: src/untrusted/irt/check_tls.py |
| diff --git a/src/untrusted/irt/check_tls.py b/src/untrusted/irt/check_tls.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..de7a746e83b260239efc8bdee175b6ca65100d00 |
| --- /dev/null |
| +++ b/src/untrusted/irt/check_tls.py |
| @@ -0,0 +1,24 @@ |
| +# Copyright (c) 2011 The Native Client Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +# A simple program to run objdump on a file and assert that '%gs' |
| +# appears nowhere in it. This ensures that the direct register access |
| +# style of TLS is not being used in the IRT blob. |
| + |
| +import subprocess |
| +import sys |
| + |
| + |
| +def Main(args): |
| + objdump = args[0] |
|
Mark Seaborn
2011/04/13 20:32:30
Maybe also do "assert len(args) == 2" (or a more i
|
| + obj_file = args[1] |
| + proc = subprocess.Popen([objdump, '-d', obj_file], stdout=subprocess.PIPE) |
| + for line in proc.stdout: |
| + if '%gs' in line: |
| + print 'TLS access found: %s' % line |
|
Mark Seaborn
2011/04/13 20:32:30
Can add some more description to the error?
e.g.
|
| + exit(1) |
|
Mark Seaborn
2011/04/13 20:32:30
I think sys.exit is the more correct function to u
|
| + |
| + |
| +if __name__ == '__main__': |
| + Main(sys.argv[1:]) |