|
7 | 7 | import re
|
8 | 8 | import sys
|
9 | 9 | import tempfile
|
10 |
| -from driver.popenwrapper import Popen |
11 | 10 |
|
12 | 11 | fullSelfPath = os.path.realpath(__file__)
|
13 | 12 | prefix = os.path.dirname(fullSelfPath)
|
14 | 13 | driverDir = prefix
|
15 | 14 |
|
| 15 | +# This is a bit hacky. |
| 16 | +# We cannot do |
| 17 | +# from .popenwrapper import Popen |
| 18 | +# OR |
| 19 | +# from driver.popenwrapper import Popen |
| 20 | +# because then 'as' will not succesfully import us (wllvm/wllvm++ can |
| 21 | +# successfully import however). |
| 22 | +# |
| 23 | +# Using |
| 24 | +# from popenwrapper import Popen |
| 25 | +# will allow 'as' to import us but then wllvm/wllvm++ will not be able to. |
| 26 | +# |
| 27 | +# The work around is to put this directory in the search path for modules. |
| 28 | +sys.path.insert(0,driverDir) |
| 29 | +from popenwrapper import Popen |
| 30 | + |
16 | 31 | # Environmental variable for path to compiler tools (clang/llvm-link etc..)
|
17 | 32 | llvmCompilerPathEnv = 'LLVM_COMPILER_PATH'
|
18 | 33 |
|
@@ -229,6 +244,7 @@ def attachBitcodePathToObject(bcPath, outFileName):
|
229 | 244 | # that won't work.
|
230 | 245 | (root, ext) = os.path.splitext(outFileName)
|
231 | 246 | if ext not in ('.o', '.lo', '.os'):
|
| 247 | + _logger.warning('Cannot attach bitcode path to "{0}"'.format(outFileName)) |
232 | 248 | return
|
233 | 249 |
|
234 | 250 | # Now just build a temporary text file with the full path to the
|
@@ -327,6 +343,9 @@ def __init__(self, cmd, isCxx, prefixPath=None):
|
327 | 343 | def getBitcodeCompiler(self):
|
328 | 344 | pth = os.getenv('LLVM_DRAGONEGG_PLUGIN')
|
329 | 345 | cc = self.getCompiler()
|
| 346 | + # We use '-B' to tell gcc where to look for an assembler. |
| 347 | + # When we build LLVM bitcode we do not want to use the GNU assembler, |
| 348 | + # instead we want gcc to use our own assembler (see driver/as). |
330 | 349 | return cc + ['-B', driverDir, '-fplugin={0}'.format(pth),
|
331 | 350 | '-fplugin-arg-dragonegg-emit-ir']
|
332 | 351 |
|
|
0 commit comments