1*f4a2713aSLionel Sambuc<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 2*f4a2713aSLionel Sambuc "http://www.w3.org/TR/html4/strict.dtd"> 3*f4a2713aSLionel Sambuc<html> 4*f4a2713aSLionel Sambuc<head> 5*f4a2713aSLionel Sambuc <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> 6*f4a2713aSLionel Sambuc <title>Clang - Universal Driver</title> 7*f4a2713aSLionel Sambuc <link type="text/css" rel="stylesheet" href="menu.css"> 8*f4a2713aSLionel Sambuc <link type="text/css" rel="stylesheet" href="content.css"> 9*f4a2713aSLionel Sambuc</head> 10*f4a2713aSLionel Sambuc<body> 11*f4a2713aSLionel Sambuc 12*f4a2713aSLionel Sambuc<!--#include virtual="menu.html.incl"--> 13*f4a2713aSLionel Sambuc 14*f4a2713aSLionel Sambuc<div id="content"> 15*f4a2713aSLionel Sambuc 16*f4a2713aSLionel Sambuc<h1>The Clang Universal Driver Project</h1> 17*f4a2713aSLionel Sambuc 18*f4a2713aSLionel Sambuc<p>Clang is inherently a cross compiler, in that it is always capable of 19*f4a2713aSLionel Sambucbuilding code for targets which are a different architecture or even operating 20*f4a2713aSLionel Sambucsystem from the one running the compiler. However, actually cross compiling in 21*f4a2713aSLionel Sambucpractice involves much more than just generating the right assembly code for a 22*f4a2713aSLionel Sambuctarget, it also requires having an appropriate tool chain (assemblers, linkers), 23*f4a2713aSLionel Sambucaccess to header files and libraries for the target, and many other details (for 24*f4a2713aSLionel Sambucexample, the calling convention or whether software floating point is in 25*f4a2713aSLionel Sambucuse). Traditionally, compilers and development environments provide little 26*f4a2713aSLionel Sambucassistance with this process, so users do not have easy access to the powerful 27*f4a2713aSLionel Sambucunderlying cross-compilation abilities of clang.</p> 28*f4a2713aSLionel Sambuc 29*f4a2713aSLionel Sambuc<p>We would like to solve this problem by defining a new model for how cross 30*f4a2713aSLionel Sambuccompilation is done, based on the idea of a <i>universal driver</i>. The key 31*f4a2713aSLionel Sambucpoint of this model is that the user would always access the compiler through a 32*f4a2713aSLionel Sambucsingle entry point (e.g., <tt>/usr/bin/cc</tt>) and provide an argument 33*f4a2713aSLionel Sambucspecifying the <i>configuration</i> they would like to target. Under the hood 34*f4a2713aSLionel Sambucthis entry point (the universal driver) would have access to all the information 35*f4a2713aSLionel Sambucthat the driver, compiler, and other tools need to build applications for that 36*f4a2713aSLionel Sambuctarget.</p> 37*f4a2713aSLionel Sambuc 38*f4a2713aSLionel Sambuc<p>This is a large and open-ended project. It's eventual success depends not 39*f4a2713aSLionel Sambucjust on implementing the model, but also on getting buy-in from compiler 40*f4a2713aSLionel Sambucdevelopers, operating system distribution vendors and the development community 41*f4a2713aSLionel Sambucat large. Our plan is to begin by defining a clear list of the problems we want 42*f4a2713aSLionel Sambucto solve and a proposed implementation (from the user perspective).</p> 43*f4a2713aSLionel Sambuc 44*f4a2713aSLionel Sambuc<p>This project is in the very early (i.e., thought experiment) stages of 45*f4a2713aSLionel Sambucdevelopment. Stay tuned for more information, and of course, patches 46*f4a2713aSLionel Sambucwelcome!</p> 47*f4a2713aSLionel Sambuc 48*f4a2713aSLionel Sambuc<p>See also <a href="http://llvm.org/PR4127">PR4127</a>.</p> 49*f4a2713aSLionel Sambuc 50*f4a2713aSLionel Sambuc<h2>Existing Solutions and Related Work</h2> 51*f4a2713aSLionel Sambuc 52*f4a2713aSLionel Sambuc<ul> 53*f4a2713aSLionel Sambuc <li>gcc's command line arguments <tt>-V</tt>, <tt>-B</tt>, <tt>-b</tt> are 54*f4a2713aSLionel Sambuc generic but limited solutions to related problems. Similarly, <tt>-m32</tt> 55*f4a2713aSLionel Sambuc and <tt>-m64</tt> solve a small subset of the problem for specific 56*f4a2713aSLionel Sambuc architectures.</li> 57*f4a2713aSLionel Sambuc 58*f4a2713aSLionel Sambuc <li>gcc's <a href="http://www.airs.com/ian/configure/configure_8.html">multilibs</a> 59*f4a2713aSLionel Sambuc solve the part of the problem that relates to finding appropriate libraries 60*f4a2713aSLionel Sambuc and include files based on particular feature support (soft float, 61*f4a2713aSLionel Sambuc etc.).</li> 62*f4a2713aSLionel Sambuc 63*f4a2713aSLionel Sambuc <li>Apple's "driver driver" supported by gcc and clang solve a subset of the 64*f4a2713aSLionel Sambuc problem by supporting <tt>-arch</tt>. Apple also provides a tool chain which 65*f4a2713aSLionel Sambuc supports <a href="http://en.wikipedia.org/wiki/Universal_binary">universal 66*f4a2713aSLionel Sambuc binaries</a> and object files which may include data for multiple 67*f4a2713aSLionel Sambuc architectures. See <a href="http://developer.apple.com/mac/library/technotes/tn2005/tn2137.html">TN2137</a> 68*f4a2713aSLionel Sambuc for an example of how this is used.</li> 69*f4a2713aSLionel Sambuc 70*f4a2713aSLionel Sambuc <li>Many operating systems and environments solve the problem by installing 71*f4a2713aSLionel Sambuc complete development environments (including the IDE, tools, header files, 72*f4a2713aSLionel Sambuc and libraries) for a single tool chain. This is cumbersome for users and 73*f4a2713aSLionel Sambuc does not match well with tools which are inherently capable of cross 74*f4a2713aSLionel Sambuc compiling.</li> 75*f4a2713aSLionel Sambuc 76*f4a2713aSLionel Sambuc <li>The Debian <a href="http://wiki.debian.org/ArmEabiPort">ArmEabiPort</a> 77*f4a2713aSLionel Sambuc wiki page for their work to support the ARM EABI provide an interesting 78*f4a2713aSLionel Sambuc glimpse into how related issues impact the operating system distribution.</li> 79*f4a2713aSLionel Sambuc 80*f4a2713aSLionel Sambuc <li><a href="http://icculus.org/fatelf/">FatELF</a> is a proposal for bringing 81*f4a2713aSLionel Sambuc Mac OS X like "Universal Binary" support to ELF based platforms.</li> 82*f4a2713aSLionel Sambuc 83*f4a2713aSLionel Sambuc</ul> 84*f4a2713aSLionel Sambuc 85*f4a2713aSLionel Sambuc</div> 86*f4a2713aSLionel Sambuc</body> 87*f4a2713aSLionel Sambuc</html> 88