1*7c3d14c8STreehugger Robot<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 2*7c3d14c8STreehugger Robot "http://www.w3.org/TR/html4/strict.dtd"> 3*7c3d14c8STreehugger Robot<!-- Material used from: HTML 4.01 specs: http://www.w3.org/TR/html401/ --> 4*7c3d14c8STreehugger Robot<html> 5*7c3d14c8STreehugger Robot<head> 6*7c3d14c8STreehugger Robot <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> 7*7c3d14c8STreehugger Robot <title>"compiler-rt" Runtime Library</title> 8*7c3d14c8STreehugger Robot <link type="text/css" rel="stylesheet" href="menu.css"> 9*7c3d14c8STreehugger Robot <link type="text/css" rel="stylesheet" href="content.css"> 10*7c3d14c8STreehugger Robot</head> 11*7c3d14c8STreehugger Robot 12*7c3d14c8STreehugger Robot<body> 13*7c3d14c8STreehugger Robot<!--#include virtual="menu.html.incl"--> 14*7c3d14c8STreehugger Robot<div id="content"> 15*7c3d14c8STreehugger Robot <!--*********************************************************************--> 16*7c3d14c8STreehugger Robot <h1>"compiler-rt" runtime libraries</h1> 17*7c3d14c8STreehugger Robot <!--*********************************************************************--> 18*7c3d14c8STreehugger Robot 19*7c3d14c8STreehugger Robot <p>The compiler-rt project consists of: 20*7c3d14c8STreehugger Robot <ul> 21*7c3d14c8STreehugger Robot <li> 22*7c3d14c8STreehugger Robot <p><b>builtins</b> - a simple library that provides an implementation 23*7c3d14c8STreehugger Robot of the low-level target-specific hooks required by code generation and 24*7c3d14c8STreehugger Robot other runtime components. For example, when compiling for a 32-bit target, 25*7c3d14c8STreehugger Robot converting a double to a 64-bit unsigned integer is compiling into a runtime 26*7c3d14c8STreehugger Robot call to the "__fixunsdfdi" function. The builtins library provides 27*7c3d14c8STreehugger Robot optimized implementations of this and other low-level routines, either in 28*7c3d14c8STreehugger Robot target-independent C form, or as a heavily-optimized assembly.</p> 29*7c3d14c8STreehugger Robot <p>builtins provides full support for the libgcc interfaces on supported 30*7c3d14c8STreehugger Robot targets and high performance hand tuned implementations of commonly used 31*7c3d14c8STreehugger Robot functions like __floatundidf in assembly that are dramatically faster than 32*7c3d14c8STreehugger Robot the libgcc implementations. It should be very easy to bring builtins to 33*7c3d14c8STreehugger Robot support a new target by adding the new routines needed by that target.</p> 34*7c3d14c8STreehugger Robot </li> 35*7c3d14c8STreehugger Robot <li> 36*7c3d14c8STreehugger Robot <b>sanitizer runtimes</b> - runtime libraries that are required to run 37*7c3d14c8STreehugger Robot the code with sanitizer instrumentation. This includes runtimes for: 38*7c3d14c8STreehugger Robot <ul> 39*7c3d14c8STreehugger Robot <li><a href="http://clang.llvm.org/docs/AddressSanitizer.html">AddressSanitizer</a></li> 40*7c3d14c8STreehugger Robot <li><a href="http://clang.llvm.org/docs/ThreadSanitizer.html">ThreadSanitizer</a></li> 41*7c3d14c8STreehugger Robot <li><a href="http://clang.llvm.org/docs/UsersManual.html#opt-fsanitize-undefined">UndefinedBehaviorSanitizer</a></li> 42*7c3d14c8STreehugger Robot <li><a href="http://clang.llvm.org/docs/MemorySanitizer.html">MemorySanitizer</a></li> 43*7c3d14c8STreehugger Robot <li><a href="http://clang.llvm.org/docs/LeakSanitizer.html">LeakSanitizer</a></li> 44*7c3d14c8STreehugger Robot <li><a href="http://clang.llvm.org/docs/DataFlowSanitizer.html">DataFlowSanitizer</a></li> 45*7c3d14c8STreehugger Robot </ul> 46*7c3d14c8STreehugger Robot </li> 47*7c3d14c8STreehugger Robot <li> 48*7c3d14c8STreehugger Robot <b>profile</b> - library which is used to collect coverage information. 49*7c3d14c8STreehugger Robot </li> 50*7c3d14c8STreehugger Robot <li> 51*7c3d14c8STreehugger Robot <b>BlocksRuntime</b> - a target-independent implementation of Apple "Blocks" 52*7c3d14c8STreehugger Robot runtime interfaces. 53*7c3d14c8STreehugger Robot </li> 54*7c3d14c8STreehugger Robot </ul> 55*7c3d14c8STreehugger Robot </p> 56*7c3d14c8STreehugger Robot 57*7c3d14c8STreehugger Robot <p>All of the code in the compiler-rt project is <a 58*7c3d14c8STreehugger Robot href="http://llvm.org/docs/DeveloperPolicy.html#license">dual licensed</a> 59*7c3d14c8STreehugger Robot under the MIT license and the UIUC License (a BSD-like license).</p> 60*7c3d14c8STreehugger Robot 61*7c3d14c8STreehugger Robot <!--=====================================================================--> 62*7c3d14c8STreehugger Robot <h2 id="users">Clients</h2> 63*7c3d14c8STreehugger Robot <!--=====================================================================--> 64*7c3d14c8STreehugger Robot 65*7c3d14c8STreehugger Robot <p>Currently compiler-rt is primarily used by 66*7c3d14c8STreehugger Robot the <a href="http://clang.llvm.org">Clang</a> 67*7c3d14c8STreehugger Robot and <a href="http://llvm.org">LLVM</a> projects as the implementation for 68*7c3d14c8STreehugger Robot the runtime compiler support libraries. For more information on using 69*7c3d14c8STreehugger Robot compiler-rt with Clang, please see the Clang 70*7c3d14c8STreehugger Robot <a href="http://clang.llvm.org/get_started.html">Getting Started</a> 71*7c3d14c8STreehugger Robot page.</p> 72*7c3d14c8STreehugger Robot 73*7c3d14c8STreehugger Robot <!--=====================================================================--> 74*7c3d14c8STreehugger Robot <h2 id="requirements">Platform Support</h2> 75*7c3d14c8STreehugger Robot <!--=====================================================================--> 76*7c3d14c8STreehugger Robot 77*7c3d14c8STreehugger Robot <p><b>builtins</b> is known to work on the following platforms:</p> 78*7c3d14c8STreehugger Robot <ul> 79*7c3d14c8STreehugger Robot <li>Machine Architectures: i386, X86-64, SPARC64, ARM, PowerPC, PowerPC 64.</li> 80*7c3d14c8STreehugger Robot <li>OS: AuroraUX, DragonFlyBSD, FreeBSD, NetBSD, Linux, Darwin.</li> 81*7c3d14c8STreehugger Robot </ul> 82*7c3d14c8STreehugger Robot 83*7c3d14c8STreehugger Robot <p>Most sanitizer runtimes are supported only on Linux x86-64. See tool-specific 84*7c3d14c8STreehugger Robot pages in <a href="http://clang.llvm.org/docs/index.html">Clang docs</a> for more 85*7c3d14c8STreehugger Robot details.</p> 86*7c3d14c8STreehugger Robot 87*7c3d14c8STreehugger Robot <!--=====================================================================--> 88*7c3d14c8STreehugger Robot <h2 id="dir-structure">Source Structure</h2> 89*7c3d14c8STreehugger Robot <!--=====================================================================--> 90*7c3d14c8STreehugger Robot 91*7c3d14c8STreehugger Robot <p>A short explanation of the directory structure of compiler-rt:</p> 92*7c3d14c8STreehugger Robot 93*7c3d14c8STreehugger Robot <p>For testing it is possible to build a generic library and an optimized library. 94*7c3d14c8STreehugger Robot The optimized library is formed by overlaying the optimized versions onto the generic library. 95*7c3d14c8STreehugger Robot Of course, some architectures have additional functions, 96*7c3d14c8STreehugger Robot so the optimized library may have functions not found in the generic version.</p> 97*7c3d14c8STreehugger Robot 98*7c3d14c8STreehugger Robot <ul> 99*7c3d14c8STreehugger Robot <li> include/ contains headers that can be included in user programs (for example, 100*7c3d14c8STreehugger Robot users may directly call certain function from sanitizer runtimes).</li> 101*7c3d14c8STreehugger Robot <li> lib/ contains libraries implementations. </li> 102*7c3d14c8STreehugger Robot <li> lib/builtins is a generic portable implementation of <b>builtins</b> routines.</li> 103*7c3d14c8STreehugger Robot <li> lib/builtins/(arch) has optimized versions of some routines 104*7c3d14c8STreehugger Robot for the supported architectures.</li> 105*7c3d14c8STreehugger Robot <li> test/ contains test suites for compiler-rt runtimes.</li> 106*7c3d14c8STreehugger Robot </ul> 107*7c3d14c8STreehugger Robot 108*7c3d14c8STreehugger Robot <!--=====================================================================--> 109*7c3d14c8STreehugger Robot <h2>Get it and get involved!</h2> 110*7c3d14c8STreehugger Robot <!--=====================================================================--> 111*7c3d14c8STreehugger Robot 112*7c3d14c8STreehugger Robot <p>Generally, you need to build LLVM/Clang in order to build compiler-rt. You can 113*7c3d14c8STreehugger Robot either follow the Clang's 114*7c3d14c8STreehugger Robot <a href="http://clang.llvm.org/get_started.html">Getting Started</a> page, or 115*7c3d14c8STreehugger Robot <a href="http://llvm.org/docs/CMake.html#quick-start">build LLVM</a> 116*7c3d14c8STreehugger Robot separately to get llvm-config binary, and then run: 117*7c3d14c8STreehugger Robot 118*7c3d14c8STreehugger Robot <ul> 119*7c3d14c8STreehugger Robot <li>svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt</li> 120*7c3d14c8STreehugger Robot <li>mkdir build</li> 121*7c3d14c8STreehugger Robot <li>cd build</li> 122*7c3d14c8STreehugger Robot <li>cmake ../compiler-rt -DLLVM_CONFIG_PATH=/path/to/llvm-config</li> 123*7c3d14c8STreehugger Robot <li>make</li> 124*7c3d14c8STreehugger Robot </ul> 125*7c3d14c8STreehugger Robot 126*7c3d14c8STreehugger Robot <p>Tests for sanitizer runtimes are ported to 127*7c3d14c8STreehugger Robot <a href="http://llvm.org/docs/CommandGuide/lit.html">llvm-lit</a> and are 128*7c3d14c8STreehugger Robot run by <b>make check-all</b> command in LLVM/Clang/compiler-rt build tree.</p> 129*7c3d14c8STreehugger Robot 130*7c3d14c8STreehugger Robot <p>compiler-rt libraries are installed to the system with <b>make install</b> 131*7c3d14c8STreehugger Robot command in either LLVM/Clang/compiler-rt or standalone 132*7c3d14c8STreehugger Robot compiler-rt build tree.</p> 133*7c3d14c8STreehugger Robot 134*7c3d14c8STreehugger Robot <p>compiler-rt doesn't have its own mailing list, if you have questions please 135*7c3d14c8STreehugger Robot email the <a 136*7c3d14c8STreehugger Robot href="http://lists.llvm.org/mailman/listinfo/llvm-dev">llvm-dev</a> mailing 137*7c3d14c8STreehugger Robot list. Commits to the compiler-rt SVN module are automatically sent to the 138*7c3d14c8STreehugger Robot <a 139*7c3d14c8STreehugger Robot href="http://lists.llvm.org/mailman/listinfo/llvm-commits">llvm-commits</a> 140*7c3d14c8STreehugger Robot mailing list.</p> 141*7c3d14c8STreehugger Robot</div> 142*7c3d14c8STreehugger Robot</body> 143*7c3d14c8STreehugger Robot</html> 144