DragonEgg-ing Mesa & Banging It With Clang

Written by Michael Larabel in Display Drivers on 8 December 2011 at 01:18 PM EST. Page 1 of 3. 4 Comments.

What happens if you build Mesa/Gallium3D with LLVM's Clang compiler or the LLVM DragonEgg plug-in with GCC? It has been asked before, so here is an answer.

With the recent release of LLVM 3.0 and respective updates for the Clang C/C++ compiler front-end and a much-improved DragonEgg plug-in for GCC, I decided to see whether these alternatives to the GNU Compiler Collection would now play well with Mesa/Gallium3D. When attempting to build out Mesa with earlier versions of LLVM, there were show-stopping problems.

This time around when building out Mesa, namely using the "make linux-llvm" option for building the Mesa/Gallium3D with the LLVMpipe driver to test the software acceleration on the CPU, things worked out when using LLVM/Clang/DragonEgg 3.0. There were no build errors and the generated binaries worked.

The only configuration where the Mesa build failed was when using GCC 4.6.2 with the DragonEgg plug-in from LLVM 3.0 while also passing the "-fplugin-arg-dragonegg-enable-gcc-optzns" switch that is meant for delivering "ultimate performance" by combining the LLVM and GCC optimizers. However, DragonEgg on GCC 4.6 without any extra optimizations had built a working Mesa stack along with Clang.

I also tried building the mainline Linux kernel (3.2 Git) using LLVM/DragonEgg 3.0, but that failed when it came to hitting some unsupported Assembly. A year ago, LLVM's Clang compiler hit the milestone of building the Linux kernel (well, most of it) but it required out-of-tree patches and other changes. That work still has not landed in mainline to allow Clang to build a vanilla kernel nor has the Clang Linux kernel source code on the GitHub project page been updated since this past May.


Related Articles