Index: pydir/szbuild.py |
diff --git a/pydir/szbuild.py b/pydir/szbuild.py |
index b9e648567472713b326dd1044f009d36043e4f6f..7fcb924514616e59c0b7e64e57d3b9fba0013691 100755 |
--- a/pydir/szbuild.py |
+++ b/pydir/szbuild.py |
@@ -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) |