diff --git a/chapter05/llvm-pass1.xml b/chapter05/llvm-pass1.xml index 04d33f9a9..f480cc2ae 100644 --- a/chapter05/llvm-pass1.xml +++ b/chapter05/llvm-pass1.xml @@ -97,7 +97,8 @@ cd build - <para>Details on this package are located in TODO.</para> + <para>Details on this package are located in + <xref linkend="contents-llvm" role="."/></para> </sect2> </sect1> diff --git a/chapter06/llvm-pass2.xml b/chapter06/llvm-pass2.xml index b112fffe6..b79afd2f4 100644 --- a/chapter06/llvm-pass2.xml +++ b/chapter06/llvm-pass2.xml @@ -165,7 +165,7 @@ cp -av dest/$LFS/tools/$LFS_TGT/include/* \ <title/> <para>Details on this package are located in - <xref linkend="contents-openssl" role="."/></para> + <xref linkend="contents-llvm" role="."/></para> </sect2> </sect1> diff --git a/chapter08/chapter08.xml b/chapter08/chapter08.xml index e1fe27f15..6104985cf 100644 --- a/chapter08/chapter08.xml +++ b/chapter08/chapter08.xml @@ -62,6 +62,7 @@ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="cmake.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="ninja.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="libffi.xml"/> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="llvm.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="kmod.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="libelf.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="python.xml"/> diff --git a/chapter08/llvm.xml b/chapter08/llvm.xml new file mode 100644 index 000000000..fd63127e8 --- /dev/null +++ b/chapter08/llvm.xml @@ -0,0 +1,1339 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-system-llvm" role="wrap"> + <?dbhtml filename="llvm.html"?> + + <sect1info condition="script"> + <productname>LLVM</productname> + <productnumber>&llvm-version;</productnumber> + <address>&llvm-url;</address> + </sect1info> + + <title>LLVM-&llvm-version; + + + LLVM + + + + + + <para>The LLVM package contains a collection of modular and reusable + compiler and toolchain technologies.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&llvm-final-sbu;</seg> + <seg>&llvm-final-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of LLVM + + Prepare some CMake modules needed by LLVM building system: + +tar -xf ../llvm-cmake-&llvm-version;.src.tar.xz +mv cmake-&llvm-version;.src ../cmake + + Embed clang and compiler-rt into the source tree to build them + altogether: + +tar -xf ../clang-&llvm-version;.src.tar.xz +mv clang-&llvm-version;.src tools/clang +tar -xf ../compiler-rt-&llvm-version;.src.tar.xz +mv compiler-rt-&llvm-version;.src projects/compiler-rt + + Apply a patch to enable SSP by default for clang: + +patch -Np2 -d tools/clang < ../clang-&llvm-version;-enable_default_ssp-1.patch + + The LLVM documentation recommends building LLVM in a dedicated + build directory: + +mkdir -v build +cd build + + Prepare LLVM for compilation: + +CC=gcc CXX=g++ cmake \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DLLVM_ENABLE_FFI=ON \ + -DCMAKE_BUILD_TYPE=Release \ + -DLLVM_BUILD_LLVM_DYLIB=ON \ + -DLLVM_LINK_LLVM_DYLIB=ON \ + -DLLVM_ENABLE_RTTI=ON \ + -DLLVM_TARGETS_TO_BUILD="host;AMDGPU;BPF" \ + -DLLVM_BINUTILS_INCDIR=/usr/include \ + -DLLVM_INCLUDE_BENCHMARKS=OFF \ + -DCLANG_DEFAULT_PIE_ON_LINUX=ON \ + -Wno-dev -G Ninja .. + + + The meaning of the configure options: + + + -DLLVM_ENABLE_FFI=ON + + Allows LLVM to use libffi. + + + + + -DLLVM_BUILD_LLVM_DYLIB=ON + + This switch builds the libraries as static and links all of + them into an unique shared one. This is the recommended way of + building a shared library. + + + + + -DLLVM_LINK_LLVM_DYLIB=ON + + This switch enables linking the tools against the shared + library instead of the static ones. It slightly reduces their + size. + + + + + -DLLVM_ENABLE_RTTI=ON + + This switch is used to build LLVM with run-time type + information. This is required for some packages, for example + Mesa (in BLFS). + + + + + -DLLVM_BINUTILS_INCDIR=/usr/include + + This switch is used to tell the build system the location + of binutils headers. This allows the building of + LLVMgold.so, which is + needed for building programs with clang and + Link Time Optimization (LTO). + + + + + -DLLVM_INCLUDE_BENCHMARKS=OFF + + Disables generation build targets for the LLVM benchmarks. + Benchmarking needs additional code that is not currently + available. + + + + + -DCLANG_DEFAULT_PIE_ON_LINUX=ON + + Makes the default when compiling + programs. Together with the ASLR feature enabled in the kernel, + this defeats some kind of attacks based on known memory + layouts. + + + + + Compile LLVM by running: + +ninja + + Install the package: + +ninja install + + Clean up the source directory: + +rm -rf ../../cmake + + + + + Contents + + + Installed Programs + Installed Libraries + Installed Directories + + + + bugpoint, c-index-test, clang, clang++ (symlinks to + clang-<version>), clang-<version>, clang-check, clang-cl, + clang-cpp (last two symlinks to clang), clang-extdef-mapping, clang-format, + clang-linker-wrapper, clang-nvlink-wrapper, + clang-offload-bundler, clang-offload-packager, clang-offload-wrapper, + clang-refactor, clang-rename, clang-repl, clang-scan-deps, + diagtool, dsymutil, git-clang-format, hmaptool, intercept-build, llc, lli, + llvm-addr2line (symlink to llvm-symbolizer), + llvm-ar, llvm-as, llvm-bcanalyzer, + llvm-bitcode-strip (symlink to llvm-objcopy), llvm-cat, + llvm-cfi-verify, llvm-config, llvm-cov, llvm-c-test, llvm-cvtres, + llvm-cxxdump, llvm-cxxfilt, llvm-cxxmap, + llvm-debuginfod, llvm-debuginfod-find, + llvm-diff, llvm-dis, llvm-dlltool (symlink to llvm-ar), + llvm-dwarfdump, llvm-dwarfutil, + llvm-dwp, llvm-exegesis, llvm-extract, llvm-gsymutil, llvm-ifs, + llvm-install-name-tool (symlink to llvm-objcopy), llvm-jitlink, + llvm-lib (symlink to llvm-ar), llvm-libtool-darwin, llvm-link, + llvm-lipo, llvm-lto, llvm-lto2, llvm-mc, llvm-mca, llvm-ml, + llvm-modextract, llvm-mt, llvm-nm, llvm-objcopy, llvm-objdump, + llvm-opt-report, llvm-otool (symlink to llv-objdump), + llvm-pdbutil, llvm-profdata, llvm-profgen, + llvm-ranlib (symlink to llvm-ar), llvm-rc, + llvm-readelf (symlink to llvm-readobj), llvm-readobj, llvm-reduce, + llvm-remark-size-diff, + llvm-rtdyld, llvm-sim, llvm-size, llvm-split, llvm-stress, + llvm-strings, llvm-strip (symlink to llvm-objcopy), llvm-symbolizer, + llvm-tapi-diff, llvm-tblgen, llvm-undname, llvm-windres (symlink to + llvm-rc), llvm-xray, opt, sancov, sanstats, scan-build, + scan-build-py, scan-view, split-file, and verify-uselistorder + + + libLLVM.so, + libLLVM*.a (96 libraries), + libLTO.so, + libRemarks.so, + libclang.so, + libclang-cpp.so, + libclang*.a (41 libraries), + and LLVMgold.so + + + /usr/include/{clang,clang-c,llvm,llvm-c}, + /usr/lib/{clang,cmake/{clang,llvm},libear,libscanbuild}, + /usr/share/{clang,opt-viewer,scan-build,scan-view}, and + /usr/share/doc/llvm-&llvm-version; + + + + + + Short Descriptions + + + + + bugpoint + + + is the automatic test case reduction tool + + + bugpoint + + + + + + c-index-test + + + is used to test the libclang API and demonstrate its usage + + + c-index-test + + + + + + clang + + + is the Clang C, C++, + and Objective-C compiler + + + clang + + + + + + clang-check + + + is a tool to perform static code analysis and display Abstract + Syntax Trees (AST) + + + clang-check + + + + + + clang-extdef-mapping + + + is a tool to collect the USR name and location of external + definitions in a source file + + + clang-extdef-mapping + + + + + + clang-format + + + is a tool to format C/C++/Java/JavaScript/Objective-C/Protobuf + code + + + clang-format + + + + + + clang-linker-wrapper + + + is a wrapper utility over the host linker + + + clang-linker-wrapper + + + + + + clang-nvlink-wrapper + + + is a wrapper tool over the nvlink program + + + clang-nvlink-wrapper + + + + + + clang-offload-bundler + + + is a tool to bundle/unbundle OpenMP offloaded files associated with + a common source file + + + clang-offload-bundler + + + + + + clang-offload-packager + + + is a tool to bundle several object files into a single binary, + which can then be used to create a fatbinary containing offloading + code + + + clang-offload-packager + + + + + + clang-offload-wrapper + + + is a tool to create wrapper bitcode for offload target binaries + + + clang-offload-wrapper + + + + + + clang-refactor + + + is a Clang-based refactoring tool for C, C++ and Objective-C + + + clang-refactor + + + + + + clang-rename + + + is a tool to rename symbols in C/C++ programs + + + clang-rename + + + + + + clang-scan-deps + + + is a tool to scan for dependencies in a source file + + + clang-scan-deps + + + + + + diagtool + + + is a combination of tools for dealing with diagnostics in clang + + + diagtool + + + + + + dsymutil + + + is a tool used to manipulate archived DWARF debug symbol files, + compatible with the Darwin command dsymutil + + + dsymutil + + + + + + git-clang-format + + + runs clang-format on git generated patches (requires Git) + + + git-clang-format + + + + + + hmaptool + + + is a Python tool to dump and construct header maps + + + hmaptool + + + + + + llc + + + is the LLVM static compiler + + + llc + + + + + + lli + + + is used to directly execute programs from + LLVM bitcode + + + lli + + + + + + llvm-addr2line + + + is a tool used to convert addresses into file names and line + numbers + + + llvm-addr2line + + + + + + llvm-ar + + + is the LLVM archiver + + + llvm-ar + + + + + + llvm-as + + + is the LLVM assembler + + + llvm-as + + + + + + llvm-bcanalyzer + + + is the LLVM bitcode analyzer + + + llvm-bcanalyzer + + + + + + llvm-bitcode-strip + + + strips LLVM bitcode from an object + + + llvm-bitcode-strip + + + + + + llvm-cat + + + is a tool to concatenate llvm modules + + + llvm-cat + + + + + + llvm-cfi-verify + + + identifies whether Control Flow Integrity protects all indirect + control flow instructions in the provided object file, DSO, or + binary + + + llvm-cfi-verify + + + + + + llvm-config + + + Prints LLVM compilation options + + + llvm-config + + + + + + llvm-cov + + + is used to emit coverage information + + + llvm-cov + + + + + + llvm-c-test + + + is a bytecode disassembler + + + llvm-c-test + + + + + + llvm-cvtres + + + is a tool to convert Microsoft resource files to COFF + + + llvm-cvtres + + + + + + llvm-cxxdump + + + is used as a C++ ABI Data Dumper + + + llvm-cxxdump + + + + + + llvm-cxxfilt + + + is used to demangle C++ symbols in llvm code + + + llvm-cxxfilt + + + + + + llvm-cxxmap + + + is used to remap C++ mangled symbols + + + llvm-cxxmap + + + + + + llvm-debuginfod + + + is a service providing debug information over an HTTP API for + analyzing stripped binaries + + + llvm-debuginfod + + + + + + llvm-debuginfod-find + + + is an interface to the llvm-debuginfod daemon + for finding debuginfod artifacts + + + llvm-debuginfod-find + + + + + + llvm-diff + + + is the LLVM structural + 'diff' + + + llvm-diff + + + + + + llvm-dis + + + is the LLVM disassembler + + + llvm-dis + + + + + + llvm-dwarfdump + + + prints the content of DWARF sections in object files + + + llvm-dwarfdump + + + + + + llvm-dwarfutil + + + is a tool to copy and manipulate debug info + + + llvm-dwarfutil + + + + + + llvm-dwp + + + merges split DWARF files + + + llvm-dwp + + + + + + llvm-elfabi + + + is used to read information about an ELF binary's ABI + + + llvm-elfabi + + + + + + llvm-exegesis + + + is a benchmarking tool that uses information available in LLVM to + measure host machine instruction characteristics like latency or + port decomposition + + + llvm-exegesis + + + + + + llvm-extract + + + is used to extract a function from an + LLVM module + + + llvm-extract + + + + + + llvm-gsymutil + + + is used to process GSYM Symbolication Format files which + convert memory addresses to function name and source file + line. These files are smaller than DWARF or Breakpad files + + + llvm-gsymutil + + + + + + llvm-ifs + + + is used to merge interface stubs with object files + + + llvm-ifs + + + + + + llvm-install-name-tool + + + is used to rewrite load commands into MachO binary format + + + llvm-install-name-tool + + + + + + llvm-jitlink + + + is used to parse relocatable object files to make their contents + executable in a target process + + + llvm-jitlink + + + + + + llvm-libtool-darwin + + + provides basic libtool functionality on Darwin-based systems. + This is mostly useful if you are generating binaries for macOS + systems + + + llvm-libtool-darwin + + + + + + llvm-link + + + is the LLVM linker + + + llvm-link + + + + + + llvm-lipo + + + is used to create universal binaries from MachO files + + + llvm-lipo + + + + + + llvm-lto + + + is the LLVM LTO (link time optimization) + linker + + + llvm-lto + + + + + + llvm-lto2 + + + is a test harness for the resolution based LTO interface + + + llvm-lto2 + + + + + + llvm-mc + + + is a standalone machine code assembler/disassembler + + + llvm-mc + + + + + + llvm-mca + + + is a performance analysis tool to statically measure the + performance of machine code + + + llvm-mca + + + + + + + + llvm-ml + + + is a playground for machine code provided by LLVM + + + llvm-ml + + + + + + llvm-modextract + + + is a tool to extract one module from multimodule bitcode files + + + llvm-modextract + + + + + + llvm-mt + + + is a tool to generate signed files and catalogs from a + side-by-side assembly manifest (used for Microsoft SDK) + + + llvm-mt + + + + + + llvm-nm + + + is used to list LLVM bitcode + and object file's symbol table + + + llvm-nm + + + + + + llvm-objcopy + + + is LLVM's version of an objcopy tool + + + llvm-objcopy + + + + + + llvm-objdump + + + is an LLVM object file dumper + + + llvm-objdump + + + + + + llvm-opt-report + + + is a tool to generate an optimization report from YAML optimization + record files + + + llvm-opt-report + + + + + + llvm-pdbutil + + + is a PDB (Program Database) dumper. PDB is a Microsoft format + + + llvm-pdbutil + + + + + + llvm-profdata + + + is a small tool to manipulate and print profile data files + + + llvm-profdata + + + + + + llvm-profgen + + + generates LLVM SPGO profiling information + + + llvm-profgen + + + + + + llvm-ranlib + + + is used to generate an index for a LLVM + archive + + + llvm-ranlib + + + + + + llvm-rc + + + is a platform-independent tool to compile resource scripts + into binary resource files + + + llvm-rc + + + + + + llvm-readobj + + + displays low-level format-specific information about object files + + + llvm-readobj + + + + + + llvm-reduce + + + is used to automatically reduce testcases + when running a test suite + + + llvm-reduce + + + + + + llvm-remark-size-diff + + + reports the difference in instruction count and stack size + remarks between two remark files + + + llvm-remark-size-diff + + + + + + llvm-rtdyld + + + is the LLVM MC-JIT tool + + + llvm-rtdyld + + + + + + llvm-size + + + is the LLVM object size dumper + + + llvm-size + + + + + + llvm-split + + + is the LLVM module splitter + + + llvm-split + + + + + + llvm-stress + + + is used to generate random + .ll files + + + llvm-stress + + + + + + llvm-strings + + + print strings found in a binary (object file, executable, or + archive library) + + + llvm-strings + + + + + + llvm-symbolizer + + + converts addresses into source code locations + + + llvm-symbolizer + + + + + + llvm-tblgen + + + is the LLVM Target Description + To C++ Code Generator + + + llvm-tblgen + + + + + + llvm-undname + + + is a tool to demangle names + + + llvm-undname + + + + + + llvm-xray + + + is an implementation of Google's XRay function call tracing system + + + llvm-xray + + + + + + intercept-build + + + generates a database of build commands for a project + + + intercept-build + + + + + + + opt + + + is the LLVM optimizer + + + opt + + + + + + sancov + + + is the sanitizer coverage processing tool + + + sancov + + + + + + sanstats + + + is the sanitizer statistics processing tool + + + sanstats + + + + + + scan-build + + + is a Perl script that invokes the + Clang static analyzer + + + scan-build + + + + + + scan-build-py + + + is a Python script that invokes the + Clang static analyzer + + + scan-build-py + + + + + + scan-view + + + is a viewer for Clang static analyzer + results + + + scan-view + + + + + + split-file + + + splits an input file into multiple parts separated by regex + + + split-file + + + + + + verify-uselistorder + + + is the LLVM tool to verify use-list + order + + + verify-uselistorder + + + + + + + diff --git a/packages.ent b/packages.ent index 853c230d3..9310d7dfd 100644 --- a/packages.ent +++ b/packages.ent @@ -463,6 +463,8 @@ + +