Commit 046ec2e0 by Jim Stichnoth

Subzero: Add a --elf arg to szbuild.py and crosstest.py.

This also implicitly applies to szbuild_spec2k.py. BUG= none R=jvoung@chromium.org Review URL: https://codereview.chromium.org/892803002
parent a1dd3cc8
...@@ -65,6 +65,9 @@ if __name__ == '__main__': ...@@ -65,6 +65,9 @@ if __name__ == '__main__':
'from the same bitcode as the subzero object. ' + 'from the same bitcode as the subzero object. ' +
'If 0, then compile it straight from source.' + 'If 0, then compile it straight from source.' +
' Default %(default)d.') ' Default %(default)d.')
argparser.add_argument('--elf', dest='elf',
action='store_true',
help='Directly generate ELF output')
args = argparser.parse_args() args = argparser.parse_args()
nacl_root = FindBaseNaCl() nacl_root = FindBaseNaCl()
...@@ -105,8 +108,10 @@ if __name__ == '__main__': ...@@ -105,8 +108,10 @@ if __name__ == '__main__':
'--target=' + args.target, '--target=' + args.target,
'--prefix=' + args.prefix, '--prefix=' + args.prefix,
'-allow-uninitialized-globals', '-allow-uninitialized-globals',
'-o=' + asm_sz, '-o=' + (obj_sz if args.elf else asm_sz),
bitcode]) bitcode] +
(['-elf-writer'] if args.elf else []))
if not args.elf:
shellcmd(['llvm-mc', shellcmd(['llvm-mc',
'-arch=' + arch_map[args.target], '-arch=' + arch_map[args.target],
'-filetype=obj', '-filetype=obj',
......
...@@ -80,6 +80,9 @@ def AddOptionalArgs(argparser): ...@@ -80,6 +80,9 @@ def AddOptionalArgs(argparser):
help='Optimization level ' + help='Optimization level ' +
'(m1 and -1 are equivalent).' + '(m1 and -1 are equivalent).' +
' Default %(default)s.') ' Default %(default)s.')
argparser.add_argument('--elf', dest='elf',
action='store_true',
help='Directly generate ELF output')
argparser.add_argument('--verbose', '-v', dest='verbose', argparser.add_argument('--verbose', '-v', dest='verbose',
action='store_true', action='store_true',
help='Display some extra debugging output') help='Display some extra debugging output')
...@@ -202,13 +205,15 @@ def ProcessPexe(args, pexe, exe): ...@@ -202,13 +205,15 @@ def ProcessPexe(args, pexe, exe):
shellcmd([llvm2ice, shellcmd([llvm2ice,
'-O' + opt_level, '-O' + opt_level,
'-bitcode-format=pnacl', '-bitcode-format=pnacl',
'-o', asm_sz] + '-o', obj_sz if args.elf else asm_sz] +
(['-externalize', (['-externalize',
'-ffunction-sections', '-ffunction-sections',
'-fdata-sections'] if hybrid else []) + '-fdata-sections'] if hybrid else []) +
(['-elf-writer'] if args.elf else []) +
args.sz_args + args.sz_args +
[pexe], [pexe],
echo=args.verbose) echo=args.verbose)
if not args.elf:
shellcmd(( shellcmd((
'llvm-mc -arch=x86 -filetype=obj -o {obj} {asm}' 'llvm-mc -arch=x86 -filetype=obj -o {obj} {asm}'
).format(asm=asm_sz, obj=obj_sz), echo=args.verbose) ).format(asm=asm_sz, obj=obj_sz), echo=args.verbose)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment