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__':
'from the same bitcode as the subzero object. ' +
'If 0, then compile it straight from source.' +
' Default %(default)d.')
argparser.add_argument('--elf', dest='elf',
action='store_true',
help='Directly generate ELF output')
args = argparser.parse_args()
nacl_root = FindBaseNaCl()
......@@ -105,13 +108,15 @@ if __name__ == '__main__':
'--target=' + args.target,
'--prefix=' + args.prefix,
'-allow-uninitialized-globals',
'-o=' + asm_sz,
bitcode])
shellcmd(['llvm-mc',
'-arch=' + arch_map[args.target],
'-filetype=obj',
'-o=' + obj_sz,
asm_sz])
'-o=' + (obj_sz if args.elf else asm_sz),
bitcode] +
(['-elf-writer'] if args.elf else []))
if not args.elf:
shellcmd(['llvm-mc',
'-arch=' + arch_map[args.target],
'-filetype=obj',
'-o=' + obj_sz,
asm_sz])
objs.append(obj_sz)
# Each original bitcode file needs to be translated by the
# LLVM toolchain and have its object file linked in. There
......
......@@ -80,6 +80,9 @@ def AddOptionalArgs(argparser):
help='Optimization level ' +
'(m1 and -1 are equivalent).' +
' Default %(default)s.')
argparser.add_argument('--elf', dest='elf',
action='store_true',
help='Directly generate ELF output')
argparser.add_argument('--verbose', '-v', dest='verbose',
action='store_true',
help='Display some extra debugging output')
......@@ -202,16 +205,18 @@ def ProcessPexe(args, pexe, exe):
shellcmd([llvm2ice,
'-O' + opt_level,
'-bitcode-format=pnacl',
'-o', asm_sz] +
'-o', obj_sz if args.elf else asm_sz] +
(['-externalize',
'-ffunction-sections',
'-fdata-sections'] if hybrid else []) +
(['-elf-writer'] if args.elf else []) +
args.sz_args +
[pexe],
echo=args.verbose)
shellcmd((
'llvm-mc -arch=x86 -filetype=obj -o {obj} {asm}'
).format(asm=asm_sz, obj=obj_sz), echo=args.verbose)
if not args.elf:
shellcmd((
'llvm-mc -arch=x86 -filetype=obj -o {obj} {asm}'
).format(asm=asm_sz, obj=obj_sz), echo=args.verbose)
shellcmd((
'objcopy --redefine-sym _start=_user_start {obj}'
).format(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