25
25
elfSectionName = '.llvm_bc'
26
26
27
27
# These are the MACH_O segment and section name
28
- darwinSegmentName = '__LLVM'
28
+ # The SegmentName was __LLVM. Changed to __WLLVM to avoid clashing
29
+ # with a segment that ld now uses (since MacOS X 10.11.3?)
30
+ darwinSegmentName = '__WLLVM'
29
31
darwinSectionName = '__llvm_bc'
30
32
31
33
@@ -167,7 +169,7 @@ def __init__(self, inputList, exactMatches={}, patternMatches={}):
167
169
'-Ofast' : (0 , ArgumentListFilter .compileUnaryCallback ),
168
170
'-Og' : (0 , ArgumentListFilter .compileUnaryCallback ),
169
171
# Component-specifiers
170
- '-Xclang' : (1 , ArgumentListFilter .defaultBinaryCallback ),
172
+ '-Xclang' : (1 , ArgumentListFilter .compileBinaryCallback ),
171
173
'-Xpreprocessor' : (1 , ArgumentListFilter .defaultBinaryCallback ),
172
174
'-Xassembler' : (1 , ArgumentListFilter .defaultBinaryCallback ),
173
175
'-Xlinker' : (1 , ArgumentListFilter .defaultBinaryCallback ),
@@ -194,6 +196,12 @@ def __init__(self, inputList, exactMatches={}, patternMatches={}):
194
196
# dragonegg mystery argument
195
197
'--64' : (0 , ArgumentListFilter .compileUnaryCallback ),
196
198
199
+ # binutils nonsense
200
+ '-print-multi-directory' : (0 , ArgumentListFilter .compileUnaryCallback ),
201
+ '-print-multi-lib' : (0 , ArgumentListFilter .compileUnaryCallback ),
202
+ '-print-libgcc-file-name' : (0 , ArgumentListFilter .compileUnaryCallback ),
203
+
204
+
197
205
#
198
206
# BD: need to warn the darwin user that these flags will rain on their parade
199
207
# (the Darwin ld is a bit single minded)
@@ -215,7 +223,7 @@ def __init__(self, inputList, exactMatches={}, patternMatches={}):
215
223
#
216
224
# Patterns for other command-line arguments:
217
225
# - inputFiles
218
- # - objecFiles (suffix .o)
226
+ # - objectFiles (suffix .o)
219
227
# - libraries + linker options as in -lxxx -Lpath or -Wl,xxxx
220
228
# - preprocessor options as in -DXXX -Ipath
221
229
# - compiler warning options: -W....
@@ -225,7 +233,7 @@ def __init__(self, inputList, exactMatches={}, patternMatches={}):
225
233
r'^.+\.(c|cc|cpp|C|cxx|i|s|S)$' : (0 , ArgumentListFilter .inputFileCallback ),
226
234
#iam: the object file recogition is not really very robust, object files
227
235
# should be determined by their existance and contents...
228
- r'^.+\.(o|lo|So|so|po|a)$' : (0 , ArgumentListFilter .objectFileCallback ),
236
+ r'^.+\.(o|lo|So|so|po|a|dylib )$' : (0 , ArgumentListFilter .objectFileCallback ),
229
237
#iam: library.so.4.5.6 probably need a similar pattern for .dylib too.
230
238
r'^.+\.dylib(\.\d)+$' : (0 , ArgumentListFilter .objectFileCallback ),
231
239
r'^.+\.(So|so)(\.\d)+$' : (0 , ArgumentListFilter .objectFileCallback ),
@@ -237,15 +245,17 @@ def __init__(self, inputList, exactMatches={}, patternMatches={}):
237
245
r'^-W(?!l,).*$' : (0 , ArgumentListFilter .compileUnaryCallback ),
238
246
r'^-f.+$' : (0 , ArgumentListFilter .compileUnaryCallback ),
239
247
r'^-std=.+$' : (0 , ArgumentListFilter .compileUnaryCallback ),
248
+ r'^-print-prog-name=.*$' : (0 , ArgumentListFilter .compileUnaryCallback ),
249
+ r'^-print-file-name=.*$' : (0 , ArgumentListFilter .compileUnaryCallback ),
250
+
240
251
}
241
252
242
- self .inputList = inputList
243
-
244
253
#iam: try and keep track of the files, input object, and output
254
+ self .inputList = inputList
245
255
self .inputFiles = []
246
256
self .objectFiles = []
247
257
self .outputFilename = None
248
-
258
+
249
259
#iam: try and split the args into linker and compiler switches
250
260
self .compileArgs = []
251
261
self .linkArgs = []
@@ -546,16 +556,24 @@ def getBitcodeFileName(self, argFilter):
546
556
class ClangBuilder (BuilderBase ):
547
557
def __init__ (self , cmd , isCxx , prefixPath = None ):
548
558
super (ClangBuilder , self ).__init__ (cmd , isCxx , prefixPath )
549
-
559
+
550
560
def getBitcodeCompiler (self ):
551
561
cc = self .getCompiler ()
552
562
return cc + ['-emit-llvm' ]
553
563
554
564
def getCompiler (self ):
555
565
if self .isCxx :
556
- return ['{0}clang++' .format (self .prefixPath )]
566
+ cxx = os .getenv ('LLVM_CXX_NAME' )
567
+ if cxx :
568
+ return ['{0}{1}' .format (self .prefixPath , cxx )]
569
+ else :
570
+ return ['{0}clang++' .format (self .prefixPath )]
557
571
else :
558
- return ['{0}clang' .format (self .prefixPath )]
572
+ cc = os .getenv ('LLVM_CC_NAME' )
573
+ if cc :
574
+ return ['{0}{1}' .format (self .prefixPath , cc )]
575
+ else :
576
+ return ['{0}clang' .format (self .prefixPath )]
559
577
560
578
def getBitcodeArglistFilter (self ):
561
579
return ClangBitcodeArgumentListFilter (self .cmd )
@@ -569,7 +587,6 @@ def attachBitcode(self, argFilter):
569
587
outFile = argFilter .getOutputFilename ()
570
588
attachBitcodePathToObject (bcname , outFile )
571
589
572
- #iam: this should join the dodo soon, yes?
573
590
class DragoneggBuilder (BuilderBase ):
574
591
def __init__ (self , cmd , isCxx , prefixPath = None ):
575
592
super (DragoneggBuilder , self ).__init__ (cmd , isCxx , prefixPath )
0 commit comments