问题
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).
Here is a little test project doing exactly that: https://gitlab.com/higaski/Interoperability
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?
回答1:
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.
来源:https://stackoverflow.com/questions/51259340/interoperability-between-clang-gcc-and-lto