1.. _source_tree_layout: 2 3============================ 4LLVM-libc Source Tree Layout 5============================ 6 7At the top-level, LLVM-libc source tree is organized in to the following 8directories:: 9 10 + libc 11 - benchmarks 12 - cmake 13 - config 14 - docs 15 - examples 16 - fuzzing 17 - hdr 18 - include 19 - lib 20 - src 21 - startup 22 - test 23 - utils 24 25Each of these directories is explained breifly below. 26 27The ``benchmarks`` directory 28---------------------------- 29 30The ``benchmarks`` directory contains LLVM-libc's benchmarking utilities. These 31are mostly used for the memory functions. 32 33The ``config`` directory 34------------------------ 35 36The ``config`` directory contains the default configurations for the targets 37LLVM-libc supports. These are files in the ``config/<platform>/<architecture>/`` 38subdirectory called ``entrypoints.txt``, ``exclude.txt``, ``headers.txt``, and 39``config.json``. These tell cmake which entrypoints are available, which 40entrypoints to exclude, which headers to generate, and what options to set for 41the current target respectively. There are also other platform specific files in 42the ``config/<platform>/`` subdirectory. 43 44The ``cmake`` directory 45----------------------- 46 47The ``cmake`` directory contains the implementations of LLVM-libc's CMake build 48rules. 49 50The ``docs`` directory 51---------------------- 52 53The ``docs`` directory contains design docs and also informative documents like 54this document on source layout. 55 56The ``fuzzing`` directory 57------------------------- 58 59This directory contains fuzzing tests for the various components of LLVM-libc. 60The directory structure within this directory mirrors the directory structure 61of the top-level ``libc`` directory itself. For more details, see 62:doc:`fuzzing`. 63 64The ``hdr`` directory 65--------------------- 66 67This directory contains proxy headers which are included from the files in the 68src directory. These proxy headers either include our internal type or macro 69definitions, or the system's type or macro definitions, depending on if we are 70in fullbuild or overlay mode. 71 72The ``include`` directory 73------------------------- 74 75The ``include`` directory contains: 76 771. ``*.h.def`` files - These files are used to construct the generated public 78 header files. 792. Self contained public header files - These are header files which are 80 already in the form that get installed when LLVM-libc is installed on a 81 user's computer. These are mostly in the ``llvm-libc-macros`` and 82 ``llvm-libc-types`` subdirectories. 83 84The ``lib`` directory 85--------------------- 86 87This directory contains a ``CMakeLists.txt`` file listing the targets for the 88public libraries ``libc.a``, ``libm.a`` etc. 89 90The ``src`` directory 91--------------------- 92 93This directory contains the implementations of the llvm-libc entrypoints. It is 94further organized as follows: 95 961. There is a top-level CMakeLists.txt file. 972. For every public header file provided by llvm-libc, there exists a 98 corresponding directory in the ``src`` directory. The name of the directory 99 is same as the base name of the header file. For example, the directory 100 corresponding to the public ``math.h`` header file is named ``math``. The 101 implementation standard document explains more about the *header* 102 directories. 103 104The ``startup`` directory 105------------------------- 106 107This directory contains the implementations of the application startup objects 108like ``crt1.o`` etc. 109 110The ``test`` directory 111---------------------- 112 113This directory contains tests for the various components of LLVM-libc. The 114directory structure within this directory mirrors the directory structure of the 115toplevel ``libc`` directory itself. A test for, say the ``mmap`` function, lives 116in the directory ``test/src/sys/mman/`` as implementation of ``mmap`` lives in 117``src/sys/mman``. 118 119The ``utils`` directory 120----------------------- 121 122This directory contains utilities used by other parts of the LLVM-libc system. 123See the `README` files in the subdirectories within this directory to learn 124about the various utilities. 125