154faf22fSSiva Chandra Reddy.. _source_tree_layout: 254faf22fSSiva Chandra Reddy 354faf22fSSiva Chandra Reddy============================ 454faf22fSSiva Chandra ReddyLLVM-libc Source Tree Layout 554faf22fSSiva Chandra Reddy============================ 654faf22fSSiva Chandra Reddy 754faf22fSSiva Chandra ReddyAt the top-level, LLVM-libc source tree is organized in to the following 854faf22fSSiva Chandra Reddydirectories:: 954faf22fSSiva Chandra Reddy 1054faf22fSSiva Chandra Reddy + libc 1143f783ffSmichaelrj-google - benchmarks 1254faf22fSSiva Chandra Reddy - cmake 1343f783ffSmichaelrj-google - config 1454faf22fSSiva Chandra Reddy - docs 1543f783ffSmichaelrj-google - examples 1654faf22fSSiva Chandra Reddy - fuzzing 17b89fef8fSMichael Jones - hdr 1854faf22fSSiva Chandra Reddy - include 1954faf22fSSiva Chandra Reddy - lib 2054faf22fSSiva Chandra Reddy - src 2143f783ffSmichaelrj-google - startup 2254faf22fSSiva Chandra Reddy - test 2354faf22fSSiva Chandra Reddy - utils 2454faf22fSSiva Chandra Reddy 2543f783ffSmichaelrj-googleEach of these directories is explained breifly below. 2643f783ffSmichaelrj-google 2743f783ffSmichaelrj-googleThe ``benchmarks`` directory 2843f783ffSmichaelrj-google---------------------------- 2943f783ffSmichaelrj-google 3043f783ffSmichaelrj-googleThe ``benchmarks`` directory contains LLVM-libc's benchmarking utilities. These 31*48739686SGuillaume Chateletare mostly used for the memory functions. 3243f783ffSmichaelrj-google 3343f783ffSmichaelrj-googleThe ``config`` directory 3443f783ffSmichaelrj-google------------------------ 3543f783ffSmichaelrj-google 3643f783ffSmichaelrj-googleThe ``config`` directory contains the default configurations for the targets 3743f783ffSmichaelrj-googleLLVM-libc supports. These are files in the ``config/<platform>/<architecture>/`` 3843f783ffSmichaelrj-googlesubdirectory called ``entrypoints.txt``, ``exclude.txt``, ``headers.txt``, and 3943f783ffSmichaelrj-google``config.json``. These tell cmake which entrypoints are available, which 4043f783ffSmichaelrj-googleentrypoints to exclude, which headers to generate, and what options to set for 4143f783ffSmichaelrj-googlethe current target respectively. There are also other platform specific files in 4243f783ffSmichaelrj-googlethe ``config/<platform>/`` subdirectory. 4354faf22fSSiva Chandra Reddy 4454faf22fSSiva Chandra ReddyThe ``cmake`` directory 4554faf22fSSiva Chandra Reddy----------------------- 4654faf22fSSiva Chandra Reddy 4754faf22fSSiva Chandra ReddyThe ``cmake`` directory contains the implementations of LLVM-libc's CMake build 4854faf22fSSiva Chandra Reddyrules. 4954faf22fSSiva Chandra Reddy 5054faf22fSSiva Chandra ReddyThe ``docs`` directory 5154faf22fSSiva Chandra Reddy---------------------- 5254faf22fSSiva Chandra Reddy 5354faf22fSSiva Chandra ReddyThe ``docs`` directory contains design docs and also informative documents like 5454faf22fSSiva Chandra Reddythis document on source layout. 5554faf22fSSiva Chandra Reddy 5654faf22fSSiva Chandra ReddyThe ``fuzzing`` directory 5754faf22fSSiva Chandra Reddy------------------------- 5854faf22fSSiva Chandra Reddy 5943f783ffSmichaelrj-googleThis directory contains fuzzing tests for the various components of LLVM-libc. 6043f783ffSmichaelrj-googleThe directory structure within this directory mirrors the directory structure 6143f783ffSmichaelrj-googleof the top-level ``libc`` directory itself. For more details, see 6243f783ffSmichaelrj-google:doc:`fuzzing`. 6354faf22fSSiva Chandra Reddy 64b89fef8fSMichael JonesThe ``hdr`` directory 65b89fef8fSMichael Jones--------------------- 66b89fef8fSMichael Jones 67b89fef8fSMichael JonesThis directory contains proxy headers which are included from the files in the 68b89fef8fSMichael Jonessrc directory. These proxy headers either include our internal type or macro 69b89fef8fSMichael Jonesdefinitions, or the system's type or macro definitions, depending on if we are 70b89fef8fSMichael Jonesin fullbuild or overlay mode. 71b89fef8fSMichael Jones 7254faf22fSSiva Chandra ReddyThe ``include`` directory 7354faf22fSSiva Chandra Reddy------------------------- 7454faf22fSSiva Chandra Reddy 7554faf22fSSiva Chandra ReddyThe ``include`` directory contains: 7654faf22fSSiva Chandra Reddy 7743f783ffSmichaelrj-google1. ``*.h.def`` files - These files are used to construct the generated public 7843f783ffSmichaelrj-google header files. 7943f783ffSmichaelrj-google2. Self contained public header files - These are header files which are 8043f783ffSmichaelrj-google already in the form that get installed when LLVM-libc is installed on a 8143f783ffSmichaelrj-google user's computer. These are mostly in the ``llvm-libc-macros`` and 8243f783ffSmichaelrj-google ``llvm-libc-types`` subdirectories. 8354faf22fSSiva Chandra Reddy 8454faf22fSSiva Chandra ReddyThe ``lib`` directory 8554faf22fSSiva Chandra Reddy--------------------- 8654faf22fSSiva Chandra Reddy 8754faf22fSSiva Chandra ReddyThis directory contains a ``CMakeLists.txt`` file listing the targets for the 8854faf22fSSiva Chandra Reddypublic libraries ``libc.a``, ``libm.a`` etc. 8954faf22fSSiva Chandra Reddy 9054faf22fSSiva Chandra ReddyThe ``src`` directory 9154faf22fSSiva Chandra Reddy--------------------- 9254faf22fSSiva Chandra Reddy 9354faf22fSSiva Chandra ReddyThis directory contains the implementations of the llvm-libc entrypoints. It is 9454faf22fSSiva Chandra Reddyfurther organized as follows: 9554faf22fSSiva Chandra Reddy 9654faf22fSSiva Chandra Reddy1. There is a top-level CMakeLists.txt file. 9754faf22fSSiva Chandra Reddy2. For every public header file provided by llvm-libc, there exists a 9854faf22fSSiva Chandra Reddy corresponding directory in the ``src`` directory. The name of the directory 9954faf22fSSiva Chandra Reddy is same as the base name of the header file. For example, the directory 10054faf22fSSiva Chandra Reddy corresponding to the public ``math.h`` header file is named ``math``. The 10154faf22fSSiva Chandra Reddy implementation standard document explains more about the *header* 10254faf22fSSiva Chandra Reddy directories. 10354faf22fSSiva Chandra Reddy 10443f783ffSmichaelrj-googleThe ``startup`` directory 10543f783ffSmichaelrj-google------------------------- 10643f783ffSmichaelrj-google 10743f783ffSmichaelrj-googleThis directory contains the implementations of the application startup objects 10843f783ffSmichaelrj-googlelike ``crt1.o`` etc. 10943f783ffSmichaelrj-google 11054faf22fSSiva Chandra ReddyThe ``test`` directory 11154faf22fSSiva Chandra Reddy---------------------- 11254faf22fSSiva Chandra Reddy 11343f783ffSmichaelrj-googleThis directory contains tests for the various components of LLVM-libc. The 11454faf22fSSiva Chandra Reddydirectory structure within this directory mirrors the directory structure of the 11554faf22fSSiva Chandra Reddytoplevel ``libc`` directory itself. A test for, say the ``mmap`` function, lives 11654faf22fSSiva Chandra Reddyin the directory ``test/src/sys/mman/`` as implementation of ``mmap`` lives in 11754faf22fSSiva Chandra Reddy``src/sys/mman``. 11854faf22fSSiva Chandra Reddy 11954faf22fSSiva Chandra ReddyThe ``utils`` directory 12054faf22fSSiva Chandra Reddy----------------------- 12154faf22fSSiva Chandra Reddy 12243f783ffSmichaelrj-googleThis directory contains utilities used by other parts of the LLVM-libc system. 12343f783ffSmichaelrj-googleSee the `README` files in the subdirectories within this directory to learn 12454faf22fSSiva Chandra Reddyabout the various utilities. 125