Skip to content

Commit 0be51de

Browse files
committed
Rewrote the README a bit.
1 parent 15e1ad7 commit 0be51de

File tree

1 file changed

+44
-21
lines changed

1 file changed

+44
-21
lines changed

README.md

Lines changed: 44 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,29 @@
55
Introduction
66
============
77

8-
This is a small python-based wrapper around a GCC-compatible compiler
9-
to make it easy to build whole-program (or whole-library) LLVM bitcode
10-
files. The idea is that it first invokes the compiler as normal to
11-
build a real object file. It then invokes a bitcode compiler to
12-
generate the corresponding bitcode, recording the location of the
13-
bitcode file in an ELF section of the actual object file.
14-
15-
When object files are linked together, the contents of non-special ELF
16-
sections are just concatenated (so we don't lose the locations of any
17-
of the constituent bitcode files).
18-
19-
This package contains an extra utility, extract-bc, to read the
20-
contents of this ELF section and link all of the bitcode into a single
21-
whole-program bitcode file. This utility can also be used on built
22-
native static libraries to generate LLVM bitcode archives.
8+
This project, WLLVM, provides tools for building whole-program (or
9+
whole-library) LLVM bitcode files from an unmodified `C` or `C++`
10+
source package. It currently runs on `*nix` platforms such as Linux,
11+
FreeBSD, and Mac OS X.
12+
13+
WLLVM provides python-based compiler wrappers that first
14+
invoke the compiler as normal to build a real object file. The wrapper then
15+
invokes a bitcode compiler to generate the corresponding bitcode, and
16+
records the location of the bitcode file in a dedicated section of the actual
17+
object file.
18+
When object files are linked together, the contents of the dedicated
19+
sections are concatenated (so we don't lose the locations of any
20+
of the constituent bitcode files). After the build process is finished,
21+
an WLLVM utility reads the
22+
contents of the dedicated section and links all of the bitcode into a single
23+
whole-program bitcode file. This utility can also be used when building
24+
native libraries to generate corresponding LLVM bitcode archives.
25+
26+
Currently, WLLVM works with either `clang` or the `gcc` dragonegg plugin.
27+
28+
29+
30+
2331

2432
This two-phase build process is slower and more elaborate than normal,
2533
but in practice is necessary to be a drop-in replacement for gcc in
@@ -29,14 +37,15 @@ static libraries in builds. This approach has the distinct advantage
2937
of generating working binaries, in case some part of a build process
3038
actually requires that.
3139

32-
Currently, this package only works using clang or the dragonegg plugin
33-
with gcc 4.5 (with the required patch for dragonegg).
3440

3541
Usage
3642
=====
3743

38-
There are three environment variables that must be set to use this
39-
wrapper script:
44+
The project provides a two wrappers, `wllvm`, for `CC` and `wllvm++`, for `CXX`
45+
and an auxillary tool `extract-bc`.
46+
47+
48+
Three environment variables must be set to use these wrappers:
4049

4150
* `LLVM_COMPILER` should be set to 'dragonegg' or 'clang'.
4251
* `LLVM_GCC_PREFIX` should be set to the prefix for the version of gcc that should
@@ -45,7 +54,7 @@ wrapper script:
4554
* `LLVM_DRAGONEGG_PLUGIN` should be the full path to the dragonegg plugin. This
4655
variable is not used if `$LLVM_COMPILER == clang`.
4756

48-
Once the environment is set up, just use wllvm and wllvm++ as your C
57+
Once the environment is set up, just use `wllvm` and `wllvm++` as your C
4958
and C++ compilers, respectively.
5059

5160
In addition to the above environment variables the following can be optionally used:
@@ -63,7 +72,20 @@ In addition to the above environment variables the following can be optionally u
6372
This may prevent configuration errors being cause by the unexpected production
6473
of the hidden bitcode files.
6574

66-
Example building bitcode module
75+
Example building bitcode module with clang
76+
===============================
77+
78+
export LLVM_COMPILER=clang
79+
80+
tar xf pkg-config-0.26.tar.gz
81+
cd pkg-config-0.26
82+
CC=wllvm ./configure
83+
make
84+
85+
# Produces pkg-config.bc
86+
extract-bc pkg-config
87+
88+
Example building bitcode module with dragonegg
6789
===============================
6890

6991
export LLVM_COMPILER=dragonegg
@@ -78,6 +100,7 @@ Example building bitcode module
78100
# Produces pkg-config.bc
79101
extract-bc pkg-config
80102

103+
81104
Example building bitcode archive
82105
================================
83106

0 commit comments

Comments
 (0)