| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 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 """Wrapper script for launching application within the sel_ldr. | 6 """Wrapper script for launching application within the sel_ldr. |
| 7 """ | 7 """ |
| 8 | 8 |
| 9 import optparse | 9 import optparse |
| 10 import os | 10 import os |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 74 |
| 75 arch_suffix = arch.replace('-', '_') | 75 arch_suffix = arch.replace('-', '_') |
| 76 | 76 |
| 77 sel_ldr = os.path.join(SCRIPT_DIR, 'sel_ldr_%s' % arch_suffix) | 77 sel_ldr = os.path.join(SCRIPT_DIR, 'sel_ldr_%s' % arch_suffix) |
| 78 irt = os.path.join(SCRIPT_DIR, 'irt_core_%s.nexe' % arch_suffix) | 78 irt = os.path.join(SCRIPT_DIR, 'irt_core_%s.nexe' % arch_suffix) |
| 79 if osname == 'win': | 79 if osname == 'win': |
| 80 sel_ldr += '.exe' | 80 sel_ldr += '.exe' |
| 81 Log('ROOT = %s' % NACL_SDK_ROOT) | 81 Log('ROOT = %s' % NACL_SDK_ROOT) |
| 82 Log('SEL_LDR = %s' % sel_ldr) | 82 Log('SEL_LDR = %s' % sel_ldr) |
| 83 Log('IRT = %s' % irt) | 83 Log('IRT = %s' % irt) |
| 84 cmd = [sel_ldr, '-a', '-B', irt, '-l', os.devnull] | 84 cmd = [sel_ldr] |
| 85 |
| 86 if osname == 'linux': |
| 87 # Run sel_ldr under nacl_helper_bootstrap |
| 88 helper = os.path.join(SCRIPT_DIR, 'nacl_helper_bootstrap_%s' % arch_suffix) |
| 89 Log('HELPER = %s' % helper) |
| 90 cmd.insert(0, helper) |
| 91 cmd.append('--r_debug=0xXXXXXXXXXXXXXXXX') |
| 92 cmd.append('--reserved_at_zero=0xXXXXXXXXXXXXXXXX') |
| 93 |
| 94 cmd += ['-a', '-B', irt] |
| 85 | 95 |
| 86 if options.debug: | 96 if options.debug: |
| 87 cmd.append('-g') | 97 cmd.append('-g') |
| 88 | 98 |
| 89 if osname == 'linux': | 99 if not options.verbose: |
| 90 helper = os.path.join(SCRIPT_DIR, 'nacl_helper_bootstrap_%s' % arch_suffix) | 100 cmd += ['-l', os.devnull] |
| 91 Log('HELPER = %s' % helper) | |
| 92 cmd.insert(0, helper) | |
| 93 | 101 |
| 94 if dynamic: | 102 if dynamic: |
| 95 if options.debug_libs: | 103 if options.debug_libs: |
| 96 libpath = os.path.join(NACL_SDK_ROOT, 'lib', | 104 libpath = os.path.join(NACL_SDK_ROOT, 'lib', |
| 97 'glibc_%s' % arch_suffix, 'Debug') | 105 'glibc_%s' % arch_suffix, 'Debug') |
| 98 else: | 106 else: |
| 99 libpath = os.path.join(NACL_SDK_ROOT, 'lib', | 107 libpath = os.path.join(NACL_SDK_ROOT, 'lib', |
| 100 'glibc_%s' % arch_suffix, 'Release') | 108 'glibc_%s' % arch_suffix, 'Release') |
| 101 toolchain = '%s_x86_glibc' % osname | 109 toolchain = '%s_x86_glibc' % osname |
| 102 sdk_lib_dir = os.path.join(NACL_SDK_ROOT, 'toolchain', | 110 sdk_lib_dir = os.path.join(NACL_SDK_ROOT, 'toolchain', |
| 103 toolchain, 'x86_64-nacl') | 111 toolchain, 'x86_64-nacl') |
| 104 if arch == 'x86-64': | 112 if arch == 'x86-64': |
| 105 sdk_lib_dir = os.path.join(sdk_lib_dir, 'lib') | 113 sdk_lib_dir = os.path.join(sdk_lib_dir, 'lib') |
| 106 else: | 114 else: |
| 107 sdk_lib_dir = os.path.join(sdk_lib_dir, 'lib32') | 115 sdk_lib_dir = os.path.join(sdk_lib_dir, 'lib32') |
| 108 ldso = os.path.join(sdk_lib_dir, 'runnable-ld.so') | 116 ldso = os.path.join(sdk_lib_dir, 'runnable-ld.so') |
| 109 cmd.append(ldso) | 117 cmd.append(ldso) |
| 110 Log('LD.SO = %s' % ldso) | 118 Log('LD.SO = %s' % ldso) |
| 111 libpath += ':' + sdk_lib_dir | 119 libpath += ':' + sdk_lib_dir |
| 112 cmd.append('--library-path') | 120 cmd.append('--library-path') |
| 113 cmd.append(libpath) | 121 cmd.append(libpath) |
| 114 | 122 |
| 115 | 123 |
| 116 cmd += args | 124 if args: |
| 125 # Append arguments for the executable itself. |
| 126 cmd += args |
| 127 |
| 117 Log(cmd) | 128 Log(cmd) |
| 118 rtn = subprocess.call(cmd) | 129 rtn = subprocess.call(cmd) |
| 119 return rtn | 130 return rtn |
| 120 | 131 |
| 121 | 132 |
| 122 if __name__ == '__main__': | 133 if __name__ == '__main__': |
| 123 try: | 134 try: |
| 124 sys.exit(main(sys.argv[1:])) | 135 sys.exit(main(sys.argv[1:])) |
| 125 except Error as e: | 136 except Error as e: |
| 126 sys.stderr.write(str(e) + '\n') | 137 sys.stderr.write(str(e) + '\n') |
| 127 sys.exit(1) | 138 sys.exit(1) |
| OLD | NEW |