Skip to content

Commit 501c70b

Browse files
committed
see if travis likes this?
1 parent b974bc7 commit 501c70b

File tree

7 files changed

+93
-84
lines changed

7 files changed

+93
-84
lines changed

.travis.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@ python:
1313
install:
1414
- sudo apt-get update
1515
- sudo apt-get install -y python-pip
16-
- export LLVM_VERSION=3.4
17-
- sudo apt-get install -y llvm-${LLVM_VERSION} clang-${LLVM_VERSION} libapr1-dev libaprutil1-dev
18-
- sudo apt-get install -y dragonegg llvm-${LLVM_VERSION} llvm-gcc-4.7
16+
- sudo apt-get install -y llvm-3.5 clang-3.5 libapr1-dev libaprutil1-dev
17+
# dragonegg uses 3.3
18+
- sudo apt-get install -y llvm-3.3 llvm-gcc-4.7
1919
- sudo pip install -e .
2020
- export WLLVM_HOME=`pwd`
2121
- export APACHE_VER=2.4.18
2222

2323

2424
# command to run tests
2525
script:
26-
# build apache with clang (i.e. httpd-2.4.12)
26+
# build apache with clang
2727
- ${WLLVM_HOME}/.travis/apache_clang.sh
28-
# build apache with gcc and dragonegg (i.e. httpd-2.4.12)
28+
# build apache with gcc and dragonegg
2929
- ${WLLVM_HOME}/.travis/apache_dragonegg.sh
3030

3131

.travis/apache_dragonegg.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -e
44

55
export dragonegg_disable_version_check=true
66

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

setup.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,21 @@
2424
author='Ian A. Mason, Tristan Ravitch, Dan Liew, Bruno Dutertre, ...',
2525
author_email='iam@csl.sri.com',
2626

27+
28+
include_package_data=True,
29+
2730
packages=find_packages(exclude=['test', 'doc' ]),
2831

2932
entry_points = {
3033
'console_scripts': [
34+
'wllvm-as = wllvm.as:main',
3135
'wllvm = wllvm.wllvm:main',
3236
'wllvm++ = wllvm.wllvmpp:main',
3337
'wllvm-sanity-checker = wllvm.sanity:main',
3438
'extract-bc = wllvm.extractor:main',
3539
],
3640
},
3741

38-
39-
4042
license='MIT',
4143

4244
classifiers=[

wllvm/as

Lines changed: 0 additions & 72 deletions
This file was deleted.

wllvm/as.py

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#!/usr/bin/env python
2+
"""
3+
This is the assembler phase.
4+
5+
This variant is only invoked during
6+
the second compilation where we are building bitcode. The compiler
7+
has already been instructed to generate LLVM IR; the compiler then
8+
tries to assemble it into an object file. The standard assembler
9+
doesn't understand LLVM bitcode, so we interpose and use the llvm-as
10+
command to build a bitcode file. We leave the bitcode in place, but
11+
record its full absolute path in the corresponding object file
12+
(which was created in the first compilation phase by the real
13+
compiler). We'll link this together at a later stage.
14+
"""
15+
16+
from __future__ import absolute_import
17+
import sys
18+
import os
19+
20+
from subprocess import *
21+
22+
from wllvm.utils import *
23+
24+
from wllvm.popenwrapper import Popen
25+
26+
import logging
27+
logging.basicConfig()
28+
29+
class BCFilter(ArgumentListFilter):
30+
def __init__(self, arglist):
31+
self.bcName = None
32+
self.outFileName = None
33+
localCallbacks = { '-o' : (1, BCFilter.outFileCallback) }
34+
super(BCFilter, self).__init__(arglist, exactMatches=localCallbacks)
35+
36+
def outFileCallback(self, flag, name):
37+
self.outFileName = name
38+
39+
def main():
40+
41+
argFilter = BCFilter(sys.argv[1:])
42+
# Since this is just the assembler, there should only ever be one file
43+
try:
44+
[infile] = argFilter.inputFiles
45+
except ValueError:
46+
logging.debug('Input file argument not detected, assuming stdin.')
47+
infile = "-"
48+
49+
# set llvm-as
50+
llvmAssembler='llvm-as'
51+
if os.getenv(llvmCompilerPathEnv):
52+
llvmAssembler = os.path.join(os.getenv(llvmCompilerPathEnv), llvmAssembler)
53+
54+
# Now compile this llvm assembly file into a bitcode file. The output
55+
# filename is the same as the object with a .bc appended
56+
try:
57+
(dirs, filename) = os.path.split(argFilter.outFileName)
58+
except AttributeError as e:
59+
logging.error('Output file argument not found.\nException message: ' + str(e))
60+
sys.exit(1)
61+
62+
fakeAssembler = [llvmAssembler, infile, '-o', argFilter.outFileName]
63+
64+
asmProc = Popen(fakeAssembler)
65+
realRet = asmProc.wait()
66+
67+
if realRet != 0:
68+
logging.error('llvm-as failed')
69+
sys.exit(realRet)
70+
71+
sys.exit(realRet)
72+
73+
74+
if __name__ == '__main__':
75+
sys.exit(main())

wllvm/utils.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,14 @@
1010
import re
1111
import sys
1212
import tempfile
13+
14+
1315
from .popenwrapper import Popen
1416

1517
fullSelfPath = os.path.realpath(__file__)
1618
prefix = os.path.dirname(fullSelfPath)
1719
driverDir = prefix
20+
asDir = os.path.abspath(os.path.join(driverDir, '..', 'dragonegg_as')
1821

1922

2023
# Environmental variable for path to compiler tools (clang/llvm-link etc..)
@@ -600,8 +603,8 @@ def getBitcodeCompiler(self):
600603
cc = self.getCompiler()
601604
# We use '-B' to tell gcc where to look for an assembler.
602605
# When we build LLVM bitcode we do not want to use the GNU assembler,
603-
# instead we want gcc to use our own assembler (see driver/as).
604-
cmd = cc + ['-B', driverDir, '-fplugin={0}'.format(pth), '-fplugin-arg-dragonegg-emit-ir']
606+
# instead we want gcc to use our own assembler (see as.py).
607+
cmd = cc + ['-B', asDir, '-fplugin={0}'.format(pth), '-fplugin-arg-dragonegg-emit-ir']
605608
_logger.debug(cmd)
606609
return cmd
607610

wllvm/version.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
99
1.0.0 - 8/2/2016 initial birth as a pip package.
1010
1.0.1 - 8/2/2016 the rst gets a make over, and doc strings
1111
became more pervasive.
12-
12+
1.0.2 - 8/2/2016 dragonegg issues. trying to include a polite 'as' wrapper
13+
(i.e. not a console_script called as).
1314
1415
1516
1617
1718
"""
18-
wllvm_version='1.0.1'
19+
wllvm_version='1.0.2'
1920

0 commit comments

Comments
 (0)