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