[LLVMdev] link native code compiled by llvm and gcc?

Karen Shaeffer shaeffer at neuralscape.com
Fri May 3 10:54:22 PDT 2013


On Fri, May 03, 2013 at 11:11:30PM +0800, Jovi Zhang wrote:
> Hi,
> 
> Is it possible to link native codes generated by different compiler?
> 
> the usecase could be:
> Linux kernel compiled by gcc want to load kernel module compiled by Clang
> (I know there have some problem to compile kernel by Clang currently,
> but ignore those problem in here)
> 
> I just concern about the call conversion problem, and compatibility
> between gcc and clang.

Hi Jovi,
It can be complicated. Many distributions patch gcc, the kernel, and the
entire tool chain. A good example is RedHat, which applies many many patches
to the kernel and the tool chain, including gcc. I believe embedded releases
are similar. The canonical kernel releases are only tested on specific canonical
versions of gcc. While I am certain you can realize this goal, you might run into
some subtle problems. I would start by auditing the tool chains and kernels you are
using, to understand any changes they have made downstream from the canonical kernel
and gcc releases. In the case of RedHat, I believe they require you to build the
kernel with their tool chain. They will not support any modifications to the build
process or the kernel. So, in a situation such as you describe, you are likely on
your own.

enjoy,
Karen
-- 
Karen Shaeffer
Neuralscape, Mountain View, CA 94040



More information about the llvm-dev mailing list