Skip to content

Commit 156753c

Browse files
committed
gdwarf-4 from @lzto over at travich's.
2 parents e4fc341 + 25fb835 commit 156753c

File tree

6 files changed

+33
-7
lines changed

6 files changed

+33
-7
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ dist: clean
3535
#publish: dist
3636
# python setup.py sdist upload
3737

38-
publish:
38+
publish: dist
3939
python3 -m twine upload dist/*
4040

4141

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
![WLLVM](img/dragon128x128.png?raw_true)Whole Program LLVM
22

3-
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
3+
[![License: MIT](https://img.shields.io/badge/License-MIT-blueviolet.svg)](https://opensource.org/licenses/MIT)
44
[![PyPI version](https://badge.fury.io/py/wllvm.svg)](https://badge.fury.io/py/wllvm)
55
[![Build Status](https://travis-ci.org/SRI-CSL/whole-program-llvm.svg?branch=master)](https://travis-ci.org/SRI-CSL/whole-program-llvm)
66
[![PyPI Statistics](https://img.shields.io/pypi/dm/wllvm.svg)](https://pypistats.org/packages/wllvm)
@@ -251,6 +251,14 @@ cross-compiling you must ensure to use the appropriate `objcopy` for the target
251251
architecture. The `BINUTILS_TARGET_PREFIX` environment variable can be used to
252252
set the objcopy of choice, for example, `arm-linux-gnueabihf`.
253253

254+
LTO Support
255+
-----------
256+
257+
In some situations it is desirable to pass certain flags to clang in the step that
258+
produces the bitcode. This can be fulfilled by setting the
259+
`LLVM_BITCODE_GENERATION_FLAGS` environment variable to the desired
260+
flags, for example `"-flto -fwhole-program-vtables"`.
261+
254262
Debugging
255263
---------
256264

doc/tutorial-ubuntu-16.04.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,14 @@ Extract the bitcode.
7474
>ls -la httpd.bc
7575
-rw-r--r-- 1 vagrant vagrant 1119584 Aug 4 20:02 httpd.bc
7676
```
77+
> Note that in httpd-2.4.41, the binary of `httpd` is under directory ".libs",
78+
> in that case, please cd into ".libs" then execute the command.
7779
80+
```
81+
cd .libs
82+
ls -la httpd
83+
extract-bc httpd
84+
```
7885
## Step 6.
7986

8087
Turn the bitcode into a second executable binary. (optional -- just for fun and sanity checking)

wllvm/arglistfilter.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ def __init__(self, inputList, exactMatches={}, patternMatches={}):
153153
'-ggdb3' : (0, ArgumentListFilter.compileUnaryCallback),
154154
'-gdwarf-2' : (0, ArgumentListFilter.compileUnaryCallback),
155155
'-gdwarf-3' : (0, ArgumentListFilter.compileUnaryCallback),
156+
'-gdwarf-4' : (0, ArgumentListFilter.compileUnaryCallback),
156157
'-gline-tables-only' : (0, ArgumentListFilter.compileUnaryCallback),
157158
'-grecord-gcc-switches': (0, ArgumentListFilter.compileUnaryCallback),
158159

wllvm/compilers.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,18 @@ def getCommand(self):
200200

201201

202202
class ClangBuilder(BuilderBase):
203+
204+
def getBitcodeGenerationFlags(self):
205+
# iam: If the environment variable LLVM_BITCODE_GENERATION_FLAGS is set we will add them to the
206+
# bitcode generation step
207+
bitcodeFLAGS = os.getenv('LLVM_BITCODE_GENERATION_FLAGS')
208+
if bitcodeFLAGS:
209+
return bitcodeFLAGS.split()
210+
return []
211+
203212
def getBitcodeCompiler(self):
204213
cc = self.getCompiler()
205-
return cc + ['-emit-llvm']
214+
return cc + ['-emit-llvm'] + self.getBitcodeGenerationFlags()
206215

207216
def getCompiler(self):
208217
if self.mode == "wllvm++":

wllvm/version.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,12 @@
7474
7575
1.2.5 - 4/17/2019 Fixing the pip package, hopefully.
7676
77-
1.2.6 - 6/18/2019 Various compiler cmd line options parsing tweaks."
77+
1.2.6 - 6/18/2019 Various compiler cmd line options parsing tweaks.
7878
79-
1.2.7 - 6/18/2019 The File type fix."
79+
1.2.7 - 3/23/2020 Added the LLVM_BITCODE_GENERATION_FLAGS to allow LTO support.
8080
81+
1.2.8 - 3/23/2020 Added the LLVM_BITCODE_GENERATION_FLAGS to allow LTO support. (pip uploading issues)
8182
"""
8283

83-
wllvm_version = '1.2.7'
84-
wllvm_date = 'June 18 2019'
84+
wllvm_version = '1.2.8'
85+
wllvm_date = 'March 23 2020'

0 commit comments

Comments
 (0)