Skip to content

Commit 0325d74

Browse files
committed
Testing tomorrow.
1 parent 0715fa3 commit 0325d74

File tree

3 files changed

+166
-0
lines changed

3 files changed

+166
-0
lines changed

Makefile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
2+
all:
3+
@echo 'To ...'
4+
5+
6+
#local editable install for developing
7+
develop:
8+
pip install -e .
9+
10+
11+
dist: clean
12+
python setup.py bdist_wheel
13+
14+
# If you need to push this project again,
15+
# INCREASE the version number in wllvm/util.py,
16+
# otherwise the server will give you an error.
17+
18+
testpublish: dist
19+
python setup.py register -r https://testpypi.python.org/pypi
20+
python setup.py sdist upload -r https://testpypi.python.org/pypi
21+
22+
testinstall:
23+
pip install -i https://testpypi.python.org/pypi wllvm
24+
25+
publish: dist
26+
python setup.py register -r https://pypi.python.org/pypi
27+
python setup.py sdist upload -r https://pypi.python.org/pypi
28+
29+
install:
30+
pip install
31+
32+
clean:
33+
rm -f wllvm/*.pyc wllvm/*~
34+
35+

README.rst

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
Introduction
2+
============
3+
4+
This project, WLLVM, provides tools for building whole-program (or
5+
whole-library) LLVM bitcode files from an unmodified C or C++
6+
source package. It currently runs on `*nix` platforms such as Linux,
7+
FreeBSD, and Mac OS X.
8+
9+
WLLVM provides python-based compiler wrappers that work in two
10+
steps. The wrappers first invoke the compiler as normal. Then, for
11+
each object file, they call a bitcode compiler to produce LLVM
12+
bitcode. The wrappers also store the location of the generated bitcode
13+
file in a dedicated section of the object file. When object files are
14+
linked together, the contents of the dedicated sections are
15+
concatenated (so we don't lose the locations of any of the constituent
16+
bitcode files). After the build completes, one can use an WLLVM
17+
utility to read the contents of the dedicated section and link all of
18+
the bitcode into a single whole-program bitcode file. This utility
19+
works for both executable and native libraries.
20+
21+
This two-phase build process is necessary to be a drop-in replacement
22+
for gcc or g++ in any build system. Using the LTO framework in gcc
23+
and the gold linker plugin works in many cases, but fails in the
24+
presence of static libraries in builds. WLLVM's approach has the
25+
distinct advantage of generating working binaries, in case some part
26+
of a build process requires that.
27+
28+
WLLVM works with either clang or the gcc dragonegg plugin.
29+
30+
Tutorial
31+
====
32+
33+
See the tutorial markdown files for detailed instructions on how to compile apache with wllvm on Ubuntu.
34+
35+
Usage
36+
=====
37+
38+
WLLVM includes two python executables: `wllvm` for compiling C code
39+
and `wllvm++` for C++, and an auxiliary tool `extract-bc`.
40+
41+
Three environment variables must be set to use these wrappers:
42+
43+
* `LLVM_COMPILER` should be set to either `dragonegg` or `clang`.
44+
* `LLVM_GCC_PREFIX` should be set to the prefix for the version of gcc that should
45+
be used with dragonegg. This can be empty if there is no prefix. This variable is
46+
not used if `$LLVM_COMPILER == clang`.
47+
* `LLVM_DRAGONEGG_PLUGIN` should be the full path to the dragonegg plugin. This
48+
variable is not used if `$LLVM_COMPILER == clang`.
49+
50+
Once the environment is set up, just use `wllvm` and `wllvm++` as your C
51+
and C++ compilers, respectively.
52+
53+
54+
In addition to the above environment variables the following can be optionally used:
55+
56+
* `LLVM_CC_NAME` can be set if your clang compiler is not called `clang` but
57+
something like `clang-3.7`. Similarly `LLVM_CXX_NAME` can be used to describe
58+
what the C++ compiler is called. Note that in these sorts of cases, the environment
59+
variable `LLVM_COMPILER` should still be set to `clang` not `clang-3.7` etc.
60+
We also pay attention to the environment variables `LLVM_LINK_NAME` and `LLVM_AR_NAME` in an
61+
analagous way, since they too get adorned with suffixes in various Linux distributions.
62+
63+
* `LLVM_COMPILER_PATH` can be set to the absolute path to the folder that
64+
contains the compiler and other LLVM tools such as `llvm-link` to be used.
65+
This prevents searching for the compiler in your PATH environment variable.
66+
This can be useful if you have different versions of clang on your system
67+
and you want to easily switch compilers without tinkering with your PATH
68+
variable.
69+
Example `LLVM_COMPILER_PATH=/home/user/llvm_and_clang/Debug+Asserts/bin`.
70+
71+
* `WLLVM_CONFIGURE_ONLY` can be set to anything. If it is set, `wllvm`
72+
and `wllvm++` behave like a normal C or C++ compiler. They do not
73+
produce bitcode. Setting `WLLVM_CONFIGURE_ONLY` may prevent
74+
configuration errors caused by the unexpected production of hidden
75+
bitcode files.
76+
77+

setup.py

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# from distutils.core import setup
2+
from setuptools import setup, find_packages
3+
import os
4+
import glob
5+
6+
from codecs import open
7+
from os import path
8+
9+
here = path.abspath(path.dirname(__file__))
10+
11+
# Get the long description from the README file
12+
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
13+
long_description = f.read()
14+
15+
# use the in house version number so we stay in synch with ourselves.
16+
from wllvm.util import wllvm_version
17+
18+
setup(
19+
name='wllvm',
20+
version=wllvm_version,
21+
description='Whole Program LLVM',
22+
long_description=long_description,
23+
url='https://github.com/SRI-CSL/whole-program-llvm',
24+
author='Ian A. Mason, ...',
25+
author_email='iam@csl.sri.com',
26+
27+
28+
packages=find_packages(exclude=['test']),
29+
30+
entry_points = {
31+
'console_scripts': [
32+
'wllvm = wllvm.wllvm:main',
33+
'wllvm++ = wllvm.wllvm++:main',
34+
'wllvm-sanity-checker = wllvm.wllvm-sanity-checker:main',
35+
'extract-bc = wllvm.extract-bc:main',
36+
],
37+
},
38+
39+
40+
41+
license='MIT',
42+
43+
classifiers=[
44+
'Development Status :: 3 - Alpha',
45+
'Natural Language :: English',
46+
'Intended Audience :: Developers',
47+
'Topic :: System :: Distributed Computing',
48+
'License :: OSI Approved :: MIT License',
49+
'Operating System :: OS Independent',
50+
'Programming Language :: Python',
51+
'Programming Language :: Python :: 2',
52+
'Programming Language :: Python :: 2.7',
53+
],
54+
)

0 commit comments

Comments
 (0)