LLVM-3.7.1

Introduction to LLVM

The LLVM package contains a collection of modular and reusable compiler and toolchain technologies. The Low Level Virtual Machine (LLVM) Core libraries provide a modern source and target-independent optimizer, along with code generation support for many popular CPUs (as well as some less common ones!). These libraries are built around a well specified code representation known as the LLVM intermediate representation ("LLVM IR").

The optional Clang and Compiler RT packages provide a new C, C++, Objective C and Objective C++ front-ends and runtime libraries for the LLVM.

[Note]

Note

This package hits a bug in GCC-4.9.0 or an unpatched GCC-4.9.1. To build this package, GCC needs to be updated if you have one of these versions. See GCC-5.3.0 for gcc installation instructions.

This package is known to build and work properly using an LFS-7.9 platform.

Package Information

  • Download (HTTP): http://llvm.org/releases/3.7.1/llvm-3.7.1.src.tar.xz

  • Download MD5 sum: bf8b3a2c79e61212c5409041dfdbd319

  • Download size: 14 MB

  • Estimated disk space required: 1.6 GB (with Clang and tests)

  • Estimated build time: 13 SBU (with Clang, tests and parallelism = 4)

Optional Downloads

Clang

Compiler RT

LLVM Dependencies

Recommended

Optional

CMake-3.4.3, Doxygen-1.8.11, Graphviz-2.38.0, libxml2-2.9.3, texlive-20150521 (or install-tl-unx), Valgrind-3.11.0, Zip-3.0, OCaml, and Sphinx

User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/llvm

Installation of LLVM

If you have downloaded the optional packages, install them into the source tree by running the following commands:

tar -xf ../cfe-3.7.1.src.tar.xz -C tools &&
tar -xf ../compiler-rt-3.7.1.src.tar.xz -C projects &&

mv tools/cfe-3.7.1.src tools/clang &&
mv projects/compiler-rt-3.7.1.src projects/compiler-rt

The run-time library needs to be fixed for 32 bit installations:

sed -r "/ifeq.*CompilerTargetArch/s#i386#i686#g" \
    -i projects/compiler-rt/make/platform/clang_linux.mk

Install LLVM by running the following commands:

sed -e "s:/docs/llvm:/share/doc/llvm-3.7.1:" \
    -i Makefile.config.in &&

mkdir -v build &&
cd       build &&

CC=gcc CXX=g++                          \
../configure --prefix=/usr              \
             --datarootdir=/usr/share   \
             --sysconfdir=/etc          \
             --enable-libffi            \
             --enable-optimized         \
             --enable-shared            \
             --enable-targets=host,r600 \
             --disable-assertions       \
             --docdir=/usr/share/doc/llvm-3.7.1 &&
make

If you have installed Sphinx and wish to generate manual pages, issue the following command:

make -C ../docs -f Makefile.sphinx man

To test the results, issue: make -k check-all. Some tests may fail for unknown reasons.

Now, as the root user:

make install &&

for file in /usr/lib/lib{clang,LLVM,LTO}*.a
do
  test -f $file && chmod -v 644 $file
done
unset file

If you had Python-2.7.11 installed and you have built Clang, install the Clang Analyzer by running the following command as the root user:

install -v -dm755 /usr/lib/clang-analyzer &&

for prog in scan-build scan-view
do
  cp -rfv ../tools/clang/tools/$prog /usr/lib/clang-analyzer/ &&
  ln -sfv ../lib/clang-analyzer/$prog/$prog /usr/bin/
done
unset prog &&

ln -sfv /usr/bin/clang \
        /usr/lib/clang-analyzer/scan-build/ &&
mv -v   /usr/lib/clang-analyzer/scan-build/scan-build.1 \
        /usr/share/man/man1/

If you have built manual pages, install them by running the following command as the root user:

install -v -m644 ../docs/_build/man/* /usr/share/man/man1/

Command Explanations

sed -e ... Makefile.config.in: This sed fixes location of the installed documentation.

--enable-libffi: This switch enables LLVM to use libffi. Remove if you did not install libffi.

--enable-optimized: This switch enables compiler optimizations in order to speed up the code and reduce its size.

--enable-shared: This switch enables building of the LLVM shared library which contains all of the static libraries linked into a single library.

--enable-targets=host,r600: This switch enables building for the same target as the host, and also for the r600 AMD GPU used by the Mesa r600 and radeonsi drivers. Default is all. You can use a comma separated list. Valid targets are: host, x86, x86_64, sparc, powerpc, arm64, arm, aarch64, mips, hexagon, xcore, msp430, nvptx, systemz, r600, amdgpu (equivalent to r600), bpf, wasm, and cpp.

--disable-assertions: Disable some compile checks, not necessary on a production system.

Contents

Installed Programs: bugpoint, c-index-test, clang, clang++ (symlink), count, FileCheck, clang-check, clang-format, clang-tblgen, llc, lli, lli-child-target, llvm-ar, llvm-as, llvm-bcanalyzer, llvm-config, llvm-cov, llvm-cxxdump, llvm-diff, llvm-dis, llvm-dsymutil, llvm-dwarfdump, llvm-extract, llvm-link, llvm-mc, llvm-mcmarkup, llvm-nm, llvm-objdump, llvm-pdbdump, llvm-profdata, llvm-ranlib (symlink), llvm-readobj, llvm-rtdyld, llvm-size, llvm-stress, llvm-symbolizer, llvm-tblgen, macho-dump, not, obj2yaml, opt, scan-build (symlink), scan-view (symlink), verify-uselistorder, and yaml2obj
Installed Libraries: BugpointPasses.so, libclang.so, libLLVM-3.7.1.so, libLTO.so, LLVMHello.so and numerous static libraries in /usr/lib
Installed Directories: /usr/include/{clang,clang-c,llvm,llvm-c}, /usr/lib/{clang,clang-analyzer}, and /usr/share/{doc/llvm-3.7.1,llvm}

Short Descriptions

bugpoint

is the automatic test case reduction tool.

clang

is the Clang C, C++, and Objective-C compiler.

llc

is the LLVM static compiler.

lli

is used to directly execute programs from LLVM bitcode.

llvm-ar

is the LLVM archiver.

llvm-as

is the LLVM assembler.

llvm-bcanalyzer

is the LLVM bitcode analyzer.

llvm-config

Prints LLVM compilation options.

llvm-cov

is used to emit coverage information.

llvm-cxxdump

is used for C++ ABI Data Dumper.

llvm-diff

is the LLVM structural 'diff'.

llvm-dis

is the LLVM disassembler.

llvm-dsymutil

tool used to manipulate archived DWARF debug symbol files, compatible with the Darwin command dsymutil.

llvm-extract

is used to extract a function from an LLVM module.

llvm-link

is the LLVM linker.

llvm-nm

is used to list LLVM bitcode and object file's symbol table.

llvm-pdbdump

is used as PDB Dumper.

llvm-ranlib

is used to generate index for LLVM archive.

llvm-stress

is used to generate random .ll files.

llvm-tblgen

is the LLVM Target Description To C++ Code Generator.

obj2yaml

takes an object file,and produces a YAML representation of the file.

opt

is the LLVM optimizer.

scan-build

is a Perl script that invokes the Clang static analyzer.

yaml2obj

takes a YAML representation of an object file and converts it to an binary file.

libLLVM-3.7.1.so

contains the LLVM API functions.

Last updated on 2016-02-22 14:52:02 -0800