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