OLD | NEW |
(Empty) | |
| 1 # Copyright (c) 2011 The Native Client Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. |
| 4 |
| 5 # A simple program to run objdump on a file and assert that '%gs' |
| 6 # appears nowhere in it. This ensures that the direct register access |
| 7 # style of TLS is not being used in the IRT blob. |
| 8 |
| 9 import subprocess |
| 10 import sys |
| 11 |
| 12 |
| 13 def Main(args): |
| 14 objdump = args[0] |
| 15 obj_file = args[1] |
| 16 assert(len(args) == 2) |
| 17 proc = subprocess.Popen([objdump, '-d', obj_file], stdout=subprocess.PIPE) |
| 18 for line in proc.stdout: |
| 19 if '%gs' in line: |
| 20 print '%gs use found: %s' % line |
| 21 print 'This looks like an x86-32 direct TLS use.' |
| 22 print 'Such uses are disallowed by the IRT execution context constraints.' |
| 23 print 'These never happen if -mtls-use-call is used in the compilation.' |
| 24 print 'Check that all libraries used in the IRT were compiled that way.' |
| 25 sys.exit(1) |
| 26 |
| 27 |
| 28 if __name__ == '__main__': |
| 29 Main(sys.argv[1:]) |
OLD | NEW |