Clang,GCC和LTO之间的互操作性 [英] Interoperability between Clang, GCC and LTO

查看:350
本文介绍了Clang,GCC和LTO之间的互操作性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道Clang和GCC或多或少是兼容的C / C ++编译器,只要您负责诸如体系结构标志,预定义和链接正确的库之类的事情。实际上,使用一个编译器创建库并将它们与另一个编译器链接起来实际上很容易(至少在x86上如此)。

I know that Clang and GCC are more or less compatible C/C++ compilers as long as one takes care of things like architecture flags, predefines and linking the right libraries. Creating libraries with one compiler and linking them with objects created by the other is actually pretty easy (at least on x86).

下面是一个测试项目,正是这样:
https://gitlab.com/higaski/Interoperability

Here is a little test project doing exactly that: https://gitlab.com/higaski/Interoperability

我想知道链接时间优化(LTO)是否能以某种方式在整个编译器中工作?我知道LTO需要某种形式的中间表示形式,例如LLVM的位代码或GCC的GIMPLE,但是也许存在可以同时使用它们的工作流程?

I was wondering however if Link Time Optimization (LTO) could somehow work across compilers? I know that LTO requires some form of intermediate representation like LLVMs bitcode or GCCs GIMPLE but maybe there is a workflow in which both of them could be utilized?

推荐答案

否,不能在编译器之间共享LTO,正是因为LTO实际上是编译器内部表示的转储。即使在同一编译器的发行版中,这种表示形式也是不稳定的。

No, LTO can not be shared across compilers, precisely because it's effectively a dump of compiler's internal representation. Such representation is unstable even across releases of the same compiler.

这篇关于Clang,GCC和LTO之间的互操作性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆