Skip to content

Commit 1345784

Browse files
committed
Merge branch 'sri'
2 parents 0ca5a1e + 099b9d3 commit 1345784

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1386
-864
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
*.pyc
2-
.idea
2+
.idea
3+
key.cfg
4+
wllvm.egg-info

.travis.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,35 @@
11
language: python
2+
3+
sudo: required
4+
dist: trusty
5+
26
python:
37
- "3.3"
48
- "2.7"
59
- "2.6"
610

11+
712
# command to install dependencies
813
install:
914
- sudo apt-get update
10-
- sudo apt-get install llvm-3.4 clang-3.4 libapr1-dev libaprutil1-dev
11-
- sudo apt-get install dragonegg llvm-3.0 llvm-gcc
15+
# to install wllvm
16+
- sudo apt-get install -y python-pip
17+
# apache prerequisites
18+
- sudo apt-get install -y libapr1-dev libaprutil1-dev
19+
# for the clang build
20+
- sudo apt-get install -y llvm-3.5 clang-3.5
21+
# dragonegg prereqs. dragonegg and llvm-gcc use llvm 3.3
22+
- sudo apt-get install -y llvm-3.3 llvm-gcc-4.7
23+
- sudo pip install -e .
1224
- export WLLVM_HOME=`pwd`
25+
- export APACHE_VER=2.4.18
26+
1327

1428
# command to run tests
1529
script:
16-
# build apache with clang (i.e. httpd-2.4.12)
30+
# build apache with clang
1731
- ${WLLVM_HOME}/.travis/apache_clang.sh
18-
# build apache with gcc and dragonegg (i.e. httpd-2.4.12)
32+
# build apache with gcc and dragonegg
1933
- ${WLLVM_HOME}/.travis/apache_dragonegg.sh
2034

2135

.travis/apache_clang.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33
set -e
44

55

6-
export PATH=/usr/lib/llvm-3.4/bin:${WLLVM_HOME}:${PATH}
6+
export PATH=/usr/lib/llvm-3.5/bin:${PATH}
77
export LLVM_COMPILER=clang
88
export WLLVM_OUTPUT=WARNING
99

10-
APACHE_VER=2.4.18
1110
wget https://archive.apache.org/dist/httpd/httpd-${APACHE_VER}.tar.gz
1211

1312
tar xfz httpd-${APACHE_VER}.tar.gz

.travis/apache_dragonegg.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@ set -e
44

55
export dragonegg_disable_version_check=true
66

7-
export PATH=/usr/lib/llvm-3.0/bin:${WLLVM_HOME}:${PATH}
7+
export PATH=/usr/lib/llvm-3.3/bin:${PATH}
88
export LLVM_COMPILER=dragonegg
99
export LLVM_GCC_PREFIX=llvm-
10-
export LLVM_DRAGONEGG_PLUGIN=/usr/lib/gcc/x86_64-linux-gnu/4.6/plugin/dragonegg.so
10+
export LLVM_DRAGONEGG_PLUGIN=/usr/lib/gcc/x86_64-linux-gnu/4.7/plugin/dragonegg.so
1111

1212
export WLLVM_OUTPUT=WARNING
1313

14-
APACHE_VER=2.4.18
1514
wget https://archive.apache.org/dist/httpd/httpd-${APACHE_VER}.tar.gz
1615

1716

LICENSE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
Copyright (c) 2013-2016 Ian A. Mason, Tristan Ravitch, Bruno Dutertre
12
Copyright (c) 2011-2013 Tristan Ravitch
23
Copyright (c) 2013 Ben Liblit, Daniel Liew
34

MANIFEST.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
include wllvm/dragonegg_as/as
2+
3+
recursive-exclude test *
4+
exclude doc

Makefile

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
2+
all:
3+
@echo ''
4+
@echo 'Here are the targets:'
5+
@echo ''
6+
@echo 'To develop : "make develop"'
7+
@echo 'To test install : "make testinstall"'
8+
@echo 'To install : "make install"'
9+
@echo 'To test publish : "make testpublish"'
10+
@echo 'To publish : "make publish"'
11+
12+
@echo 'To check clang : "make check_clang"'
13+
@echo ''
14+
@echo 'e.g. on linux: LLVM_COMPILER_PATH=/usr/lib/llvm-3.5/bin/ make check_clang'
15+
@echo ''
16+
@echo 'To check dragonegg : "make check_dragonegg"'
17+
@echo ''
18+
@echo 'e.g. on linux: PATH=/usr/lib/llvm-3.3/bin:... make check_dragonegg'
19+
@echo ''
20+
@echo 'To turn md 2 html : "make zippity"'
21+
@echo ''
22+
@echo 'then upload the zip file to https://pypi.python.org/pypi'
23+
@echo ''
24+
@echo 'To pylint : "make lint"'
25+
@echo ''
26+
27+
28+
29+
#local editable install for developing
30+
develop:
31+
pip install -e .
32+
33+
34+
dist: clean
35+
python setup.py bdist_wheel
36+
37+
# If you need to push this project again,
38+
# INCREASE the version number in wllvm/version.py,
39+
# otherwise the server will give you an error.
40+
41+
testpublish: dist
42+
python setup.py register -r https://testpypi.python.org/pypi
43+
python setup.py sdist upload -r https://testpypi.python.org/pypi
44+
45+
testinstall:
46+
pip install -i https://testpypi.python.org/pypi wllvm
47+
48+
publish: dist
49+
python setup.py register -r https://pypi.python.org/pypi
50+
python setup.py sdist upload -r https://pypi.python.org/pypi
51+
52+
install:
53+
pip install
54+
55+
check_clang:
56+
cd test; python -m unittest -v test_base_driver test_clang_driver
57+
58+
check_dragonegg:
59+
cd test; python -m unittest -v test_base_driver test_dragonegg_driver
60+
61+
62+
zippity:
63+
rm -rf doczip*; mkdir doczip;
64+
cat README.md | pandoc -f markdown_github > doczip/index.html
65+
zip -r -j doczip.zip doczip
66+
67+
clean:
68+
rm -f wllvm/*.pyc wllvm/*~
69+
70+
71+
PYLINT = $(shell which pylint)
72+
73+
lint:
74+
ifeq ($(PYLINT),)
75+
$(error lint target requires pylint)
76+
endif
77+
@ $(PYLINT) -E wllvm/*.py

README.md

Lines changed: 63 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
1+
![WLLVM](https://github.com/SRI-CSL/whole-program-llvm/blob/master/img/dragon128x128.png?raw_true)Whole Program LLVM
2+
==================
3+
[![PyPI version](https://badge.fury.io/py/wllvm.svg)](https://badge.fury.io/py/wllvm)
24
[![Build Status](https://travis-ci.org/SRI-CSL/whole-program-llvm.svg?branch=master)](https://travis-ci.org/SRI-CSL/whole-program-llvm)
35

46

57
Introduction
6-
============
8+
------------
79

810
This project, WLLVM, provides tools for building whole-program (or
911
whole-library) LLVM bitcode files from an unmodified C or C++
@@ -17,7 +19,7 @@ bitcode. The wrappers also store the location of the generated bitcode
1719
file in a dedicated section of the object file. When object files are
1820
linked together, the contents of the dedicated sections are
1921
concatenated (so we don't lose the locations of any of the constituent
20-
bitcode files). After the build completes, one can use an WLLVM
22+
bitcode files). After the build completes, one can use a WLLVM
2123
utility to read the contents of the dedicated section and link all of
2224
the bitcode into a single whole-program bitcode file. This utility
2325
works for both executable and native libraries.
@@ -46,15 +48,22 @@ depending on your machine's permissions.
4648

4749

4850
Tutorial
49-
====
51+
=======
52+
If you want to develop or use the development version:
53+
54+
git clone https://github.com/SRI-CSL/whole-program-llvm
55+
cd whole-program-llvm
56+
pip install -e .
5057

51-
See the tutorial markdown files for detailed instructions on how to compile apache with wllvm on Ubuntu.
5258

5359
Usage
54-
=====
60+
-----
5561

56-
WLLVM includes two python executables: `wllvm` for compiling C code
57-
and `wllvm++` for C++, and an auxiliary tool `extract-bc`.
62+
WLLVM includes four python executables: `wllvm` for compiling C code
63+
and `wllvm++` for compiling C++, an auxiliary tool `extract-bc` for
64+
extracting the bitcode from a build product (object file, executable, library
65+
or archive), and a sanity checker, `wllvm-sanity-checker` for detecting
66+
configuration oversights.
5867

5968
Three environment variables must be set to use these wrappers:
6069

@@ -90,11 +99,14 @@ In addition to the above environment variables the following can be optionally u
9099
and `wllvm++` behave like a normal C or C++ compiler. They do not
91100
produce bitcode. Setting `WLLVM_CONFIGURE_ONLY` may prevent
92101
configuration errors caused by the unexpected production of hidden
93-
bitcode files.
102+
bitcode files. It is sometimes required when configuring a build.
103+
104+
105+
94106

95107

96108
Building a bitcode module with clang
97-
====================================
109+
------------------------------------
98110

99111
export LLVM_COMPILER=clang
100112

@@ -103,14 +115,21 @@ Building a bitcode module with clang
103115
CC=wllvm ./configure
104116
make
105117

106-
# Produces pkg-config.bc
118+
This should produce the executable `pkg-config`. To extract the bitcode:
119+
107120
extract-bc pkg-config
108121

109-
A gentler set of instructions on building apache can be found
110-
[here.](https://github.com/SRI-CSL/whole-program-llvm/blob/master/tutorial.md)
122+
which will produce the bitcode module `pkg-config.bc`.
123+
124+
125+
Tutorials
126+
---------
127+
128+
A gentler set of instructions on building apache in a vagrant Ubuntu 14.04 can be found
129+
[here,](https://github.com/SRI-CSL/whole-program-llvm/blob/master/doc/tutorial.md) and for Ubuntu 16.04 [here.](https://github.com/SRI-CSL/whole-program-llvm/blob/master/doc/tutorial-ubuntu-16.04.md)
111130

112131
Building a bitcode module with dragonegg
113-
========================================
132+
----------------------------------------
114133

115134
export LLVM_COMPILER=dragonegg
116135
export LLVM_GCC_PREFIX=llvm-
@@ -121,12 +140,15 @@ Building a bitcode module with dragonegg
121140
CC=wllvm ./configure
122141
make
123142

124-
# Produces pkg-config.bc
143+
Again, this should produce the executable `pkg-config`. To extract the bitcode:
144+
125145
extract-bc pkg-config
126146

147+
which will produce the bitcode module `pkg-config.bc`.
148+
127149

128150
Building bitcode archive
129-
========================
151+
------------------------
130152

131153
export LLVM_COMPILER=clang
132154
tar -xvf bullet-2.81-rev2613.tgz
@@ -138,24 +160,37 @@ Building bitcode archive
138160
# Produces src/LinearMath/libLinearMath.bca
139161
extract-bc src/LinearMath/libLinearMath.a
140162

163+
Note that by default extracting bitcode from an archive produces
164+
an archive of bitcode. You can also extract the bitcode directly into a module.
165+
166+
extract-bc -b src/LinearMath/libLinearMath.a
167+
168+
produces `src/LinearMath/libLinearMath.a.bc`.
169+
170+
141171

142172
Building an Operating System
143-
============================
173+
----------------------------
144174

145-
To see how to build freeBSD 10.0 from scratch check out this
146-
[guide.](../master/README-freeBSD.md)
175+
To see how to build freeBSD 10.0 from scratch check out this
176+
[guide.](https://github.com/SRI-CSL/whole-program-llvm/blob/master/doc/tutorial-freeBSD.md)
147177

148178

149179
Configuring without building bitcode
150-
================================
180+
------------------------------------
151181

182+
Sometimes it is necessary to disable the production of bitcode.
183+
Typically this is during configuration, where the production
184+
of unexpected files can confuse the configure script. For this
185+
we have a flag `WLLVM_CONFIGURE_ONLY` which can be used as
186+
follows:
152187

153188
WLLVM_CONFIGURE_ONLY=1 CC=wllvm ./configure
154189
CC=wllvm make
155190

156191

157192
Building a bitcode archive then extracting the bitcode
158-
========================
193+
------------------------------------------------------
159194

160195
export LLVM_COMPILER=clang
161196
tar xvfz jansson-2.7.tar.gz
@@ -168,11 +203,13 @@ Building a bitcode archive then extracting the bitcode
168203
extract-bc libjansson.a
169204
llvm-ar x libjansson.bca
170205
ls -la
171-
206+
172207

173208

209+
210+
174211
Debugging
175-
=========
212+
---------
176213

177214
The WLLVM tools can show various levels of output to aid with debugging.
178215
To show this output set WLLVM_OUTPUT to one of the following levels:
@@ -189,7 +226,7 @@ For example
189226

190227

191228
Sanity Checking
192-
=========
229+
---------------
193230

194231
Too many environment variables? Try doing a sanity check:
195232

@@ -200,6 +237,6 @@ it might point out what is wrong.
200237

201238

202239
License
203-
=======
240+
-------
204241

205-
WLLVM is released under the MIT license. See the file `LICENSE` for details.
242+
WLLVM is released under the MIT license. See the file `LICENSE` for [details.](https://github.com/SRI-CSL/whole-program-llvm/blob/master/LICENSE)

0 commit comments

Comments
 (0)