def assemble(outfile, compiler, toolchain, flags=()):
"""Assembles the solver. Returns the filename that was generated."""
print('Assembling ' + toolchain)
base, _ = os.path.splitext(outfile)
asmfile = base + '-' + toolchain.lower() + '.s'
prefix = os.path.dirname(os.path.dirname(shutil.which(compiler)))
include = os.path.join(prefix, 'include')
cmd = [compiler, '-I' + include, '-fPIC', '-O0']
cmd.extend(flags)
cmd.extend(['-S', '-o', asmfile, '-c', outfile])
print('Running command:\n $ ' + ' '.join(cmd))
t0 = time.time()
subprocess.check_call(cmd)
t1 = time.time()
print('{0} assembled in {1:.3} seconds'.format(toolchain, t1 - t0))
return asmfile
评论列表
文章目录