Skip to content

Commit b17cc61

Browse files
author
Ian A.Mason
committed
Merge branch 'master' of github.com:SRI-CSL/whole-program-llvm
2 parents b26c1b8 + f4ddd45 commit b17cc61

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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/compilers.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,13 @@ def getCommand(self):
202202
class ClangBuilder(BuilderBase):
203203
def getBitcodeCompiler(self):
204204
cc = self.getCompiler()
205-
return cc + ['-emit-llvm']
205+
retval = cc + ['-emit-llvm']
206+
# iam: If the environment variable LLVM_BITCODE_GENERATION_FLAGS is set we will add them to the
207+
# bitcode generation step
208+
bitcodeFLAGS = os.getenv('LLVM_BITCODE_GENERATION_FLAGS')
209+
if bitcodeFLAGS:
210+
retval = retval + bitcodeFLAGS.split()
211+
return retval
206212

207213
def getCompiler(self):
208214
if self.mode == "wllvm++":

0 commit comments

Comments
 (0)