Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(266)

Side by Side Diff: pydir/crosstest.py

Issue 1560933002: Subzero: Enable Non-SFI vector cross tests. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code review changes Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « crosstest/test_select_main.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python2 1 #!/usr/bin/env python2
2 2
3 import argparse 3 import argparse
4 import os 4 import os
5 import subprocess 5 import subprocess
6 import sys 6 import sys
7 import tempfile 7 import tempfile
8 8
9 import targets 9 import targets
10 from szbuild import LinkNonsfi 10 from szbuild import LinkNonsfi
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 for arg in args.test: 119 for arg in args.test:
120 base, ext = os.path.splitext(arg) 120 base, ext = os.path.splitext(arg)
121 if ext == '.ll': 121 if ext == '.ll':
122 bitcode = arg 122 bitcode = arg
123 else: 123 else:
124 # Use pnacl-clang and pnacl-opt to produce PNaCl bitcode. 124 # Use pnacl-clang and pnacl-opt to produce PNaCl bitcode.
125 bitcode_nonfinal = os.path.join(args.dir, base + '.' + key + '.bc') 125 bitcode_nonfinal = os.path.join(args.dir, base + '.' + key + '.bc')
126 bitcode = os.path.join(args.dir, base + '.' + key + '.pnacl.ll') 126 bitcode = os.path.join(args.dir, base + '.' + key + '.pnacl.ll')
127 shellcmd(['{bin}/pnacl-clang'.format(bin=bindir), 127 shellcmd(['{bin}/pnacl-clang'.format(bin=bindir),
128 ('-O2' if args.clang_opt else '-O0'), 128 ('-O2' if args.clang_opt else '-O0'),
129 get_sfi_string(args, '', '-DNONSFI', ''),
130 ('-DARM32' if args.target == 'arm32' else ''), '-c', arg, 129 ('-DARM32' if args.target == 'arm32' else ''), '-c', arg,
131 '-o', bitcode_nonfinal]) 130 '-o', bitcode_nonfinal])
132 shellcmd(['{bin}/pnacl-opt'.format(bin=bindir), 131 shellcmd(['{bin}/pnacl-opt'.format(bin=bindir),
133 '-pnacl-abi-simplify-preopt', 132 '-pnacl-abi-simplify-preopt',
134 '-pnacl-abi-simplify-postopt', 133 '-pnacl-abi-simplify-postopt',
135 '-pnaclabi-allow-debug-metadata', 134 '-pnaclabi-allow-debug-metadata',
136 '-strip-metadata', 135 '-strip-metadata',
137 '-strip-module-flags', 136 '-strip-module-flags',
138 '-strip-debug', 137 '-strip-debug',
139 bitcode_nonfinal, '-S', '-o', bitcode]) 138 bitcode_nonfinal, '-S', '-o', bitcode])
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 target_params = [] 203 target_params = []
205 if needs_stack_hack: 204 if needs_stack_hack:
206 shellcmd('{bin}/clang -g -o stack_hack.x8664.{key}.o -c ' 205 shellcmd('{bin}/clang -g -o stack_hack.x8664.{key}.o -c '
207 'stack_hack.x8664.c'.format(bin=bindir, key=key)) 206 'stack_hack.x8664.c'.format(bin=bindir, key=key))
208 target_params.append('-DX8664_STACK_HACK') 207 target_params.append('-DX8664_STACK_HACK')
209 target_params.append('stack_hack.x8664.{key}.o'.format(key=key)) 208 target_params.append('stack_hack.x8664.{key}.o'.format(key=key))
210 209
211 if args.target == 'arm32': 210 if args.target == 'arm32':
212 target_params.append('-DARM32') 211 target_params.append('-DARM32')
213 target_params.append('-static') 212 target_params.append('-static')
214 if args.nonsfi:
215 target_params.append('-DNONSFI')
216 213
217 pure_c = os.path.splitext(args.driver)[1] == '.c' 214 pure_c = os.path.splitext(args.driver)[1] == '.c'
218 if not args.nonsfi: 215 if not args.nonsfi:
219 # Set compiler to clang, clang++, pnacl-clang, or pnacl-clang++. 216 # Set compiler to clang, clang++, pnacl-clang, or pnacl-clang++.
220 compiler = '{bin}/{prefix}{cc}'.format( 217 compiler = '{bin}/{prefix}{cc}'.format(
221 bin=bindir, prefix=get_sfi_string(args, 'pnacl-', '', ''), 218 bin=bindir, prefix=get_sfi_string(args, 'pnacl-', '', ''),
222 cc='clang' if pure_c else 'clang++') 219 cc='clang' if pure_c else 'clang++')
223 sb_native_args = (['-O0', '--pnacl-allow-native', 220 sb_native_args = (['-O0', '--pnacl-allow-native',
224 '-arch', target_info.compiler_arch, 221 '-arch', target_info.compiler_arch,
225 '-Wn,-defsym=__Sz_AbsoluteZero=0'] 222 '-Wn,-defsym=__Sz_AbsoluteZero=0']
226 if args.sandbox else 223 if args.sandbox else
227 ['-g', '-target=' + triple, 224 ['-g', '-target=' + triple,
228 '-lm', '-lpthread', 225 '-lm', '-lpthread',
229 '-Wl,--defsym=__Sz_AbsoluteZero=0'] + 226 '-Wl,--defsym=__Sz_AbsoluteZero=0'] +
230 target_info.cross_headers) 227 target_info.cross_headers)
231 shellcmd([compiler] + target_params + [args.driver] + objs + 228 shellcmd([compiler] + target_params + [args.driver] + objs +
232 ['-o', os.path.join(args.dir, args.output)] + sb_native_args) 229 ['-o', os.path.join(args.dir, args.output)] + sb_native_args)
233 return 0 230 return 0
234 231
235 base, ext = os.path.splitext(args.driver) 232 base, ext = os.path.splitext(args.driver)
236 bitcode_nonfinal = os.path.join(args.dir, base + '.' + key + '.bc') 233 bitcode_nonfinal = os.path.join(args.dir, base + '.' + key + '.bc')
237 bitcode = os.path.join(args.dir, base + '.' + key + '.pnacl.ll') 234 bitcode = os.path.join(args.dir, base + '.' + key + '.pnacl.ll')
238 asm_sz = os.path.join(args.dir, base + '.' + key + '.s') 235 asm_sz = os.path.join(args.dir, base + '.' + key + '.s')
239 obj_llc = os.path.join(args.dir, base + '.' + key + '.o') 236 obj_llc = os.path.join(args.dir, base + '.' + key + '.o')
240 compiler = '{bin}/{prefix}{cc}'.format( 237 compiler = '{bin}/{prefix}{cc}'.format(
241 bin=bindir, prefix='pnacl-', 238 bin=bindir, prefix='pnacl-',
242 cc='clang' if pure_c else 'clang++') 239 cc='clang' if pure_c else 'clang++')
243 shellcmd([compiler, 240 shellcmd([compiler,
244 args.driver, 241 args.driver,
245 '-DNONSFI' if args.nonsfi else '',
246 '-O2', 242 '-O2',
247 '-o', bitcode_nonfinal, 243 '-o', bitcode_nonfinal,
248 '-Wl,-r' 244 '-Wl,-r'
249 ]) 245 ])
250 shellcmd(['{bin}/pnacl-opt'.format(bin=bindir), 246 shellcmd(['{bin}/pnacl-opt'.format(bin=bindir),
251 '-pnacl-abi-simplify-preopt', 247 '-pnacl-abi-simplify-preopt',
252 '-pnacl-abi-simplify-postopt', 248 '-pnacl-abi-simplify-postopt',
253 '-pnaclabi-allow-debug-metadata', 249 '-pnaclabi-allow-debug-metadata',
254 '-strip-metadata', 250 '-strip-metadata',
255 '-strip-module-flags', 251 '-strip-module-flags',
(...skipping 16 matching lines...) Expand all
272 objs.append(obj_llc) 268 objs.append(obj_llc)
273 if args.nonsfi: 269 if args.nonsfi:
274 LinkNonsfi(objs, os.path.join(args.dir, args.output), args.target) 270 LinkNonsfi(objs, os.path.join(args.dir, args.output), args.target)
275 elif args.sandbox: 271 elif args.sandbox:
276 LinkSandbox(objs, os.path.join(args.dir, args.output), args.target) 272 LinkSandbox(objs, os.path.join(args.dir, args.output), args.target)
277 else: 273 else:
278 LinkNative(objs, os.path.join(args.dir, args.output), args.target) 274 LinkNative(objs, os.path.join(args.dir, args.output), args.target)
279 275
280 if __name__ == '__main__': 276 if __name__ == '__main__':
281 main() 277 main()
OLDNEW
« no previous file with comments | « crosstest/test_select_main.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698