gensolve.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:transmutagen 作者: ergs 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号