Skip to content

Commit cd362e1

Browse files
committed
Minor tweaks to improve the linux kernel build.
1 parent a59888a commit cd362e1

File tree

2 files changed

+42
-9
lines changed

2 files changed

+42
-9
lines changed

wllvm/arglistfilter.py

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,15 @@ def __init__(self, inputList, exactMatches={}, patternMatches={}):
8888
'-msoft-float' : (0, ArgumentListFilter.compileUnaryCallback),
8989
'-m3dnow' : (0, ArgumentListFilter.compileUnaryCallback),
9090
'-mno-3dnow' : (0, ArgumentListFilter.compileUnaryCallback),
91+
'-m16': (0, ArgumentListFilter.compileUnaryCallback),
9192
'-m32': (0, ArgumentListFilter.compileUnaryCallback),
93+
'-mx32': (0, ArgumentListFilter.compileUnaryCallback),
9294
'-m64': (0, ArgumentListFilter.compileUnaryCallback),
95+
'-miamcu': (0, ArgumentListFilter.compileUnaryCallback),
9396
'-mstackrealign': (0, ArgumentListFilter.compileUnaryCallback),
97+
'-mretpoline-external-thunk': (0, ArgumentListFilter.compileUnaryCallback), #iam: linux kernel stuff
98+
'-mno-fp-ret-in-387': (0, ArgumentListFilter.compileUnaryCallback), #iam: linux kernel stuff
99+
'-mskip-rax-setup': (0, ArgumentListFilter.compileUnaryCallback), #iam: linux kernel stuff
94100

95101
# Preprocessor assertion
96102
'-A' : (1, ArgumentListFilter.compileBinaryCallback),
@@ -194,6 +200,14 @@ def __init__(self, inputList, exactMatches={}, patternMatches={}):
194200
'-coverage' : (0, ArgumentListFilter.compileLinkUnaryCallback),
195201
'--coverage' : (0, ArgumentListFilter.compileLinkUnaryCallback),
196202

203+
# ian's additions while building the linux kernel
204+
205+
'/dev/null' : (0, ArgumentListFilter.inputFileCallback),
206+
'-mno-80387': (0, ArgumentListFilter.compileUnaryCallback), #gcc Don't generate output containing 80387 instructions for floating point.
207+
"-mregparm=3"
208+
"-march=i386"
209+
210+
197211
#
198212
# BD: need to warn the darwin user that these flags will rain on their parade
199213
# (the Darwin ld is a bit single minded)
@@ -209,6 +223,8 @@ def __init__(self, inputList, exactMatches={}, patternMatches={}):
209223
# calling ld -r.
210224
#
211225
'-Wl,-dead_strip' : (0, ArgumentListFilter.darwinWarningLinkUnaryCallback),
226+
'-Oz' : (0, ArgumentListFilter.compileUnaryCallback), #did not find this in the GCC options.
227+
'-mno-global-merge' : (0, ArgumentListFilter.compileUnaryCallback), #clang (do not merge globals)
212228

213229
}
214230

@@ -242,6 +258,14 @@ def __init__(self, inputList, exactMatches={}, patternMatches={}):
242258
r'^-std=.+$' : (0, ArgumentListFilter.compileUnaryCallback),
243259
r'^-stdlib=.+$' : (0, ArgumentListFilter.compileLinkUnaryCallback),
244260
r'^-mtune=.+$' : (0, ArgumentListFilter.compileUnaryCallback),
261+
r'^-mstack-alignment=.+$': (0, ArgumentListFilter.compileUnaryCallback), #iam: linux kernel stuff
262+
r'^-march=.+$': (0, ArgumentListFilter.compileUnaryCallback), #iam: linux kernel stuff
263+
r'^-mregparm=.+$': (0, ArgumentListFilter.compileUnaryCallback), #iam: linux kernel stuff
264+
r'^-mcmodel=.+$': (0, ArgumentListFilter.compileUnaryCallback), #iam: linux kernel stuff
265+
r'^-mpreferred-stack-boundary=.+$': (0, ArgumentListFilter.compileUnaryCallback), #iam: linux kernel stuff
266+
r'^-mindirect-branch=.+$': (0, ArgumentListFilter.compileUnaryCallback), #iam: linux kernel stuff
267+
268+
245269
#iam: mac stuff...
246270
r'-mmacosx-version-min=.+$' : (0, ArgumentListFilter.compileUnaryCallback),
247271

@@ -315,13 +339,21 @@ def __init__(self, inputList, exactMatches={}, patternMatches={}):
315339

316340
def skipBitcodeGeneration(self):
317341
if os.environ.get('WLLVM_CONFIGURE_ONLY', False):
318-
return True
319-
if not self.inputFiles or self.isEmitLLVM or self.isAssembly or self.isAssembleOnly:
320-
return True
321-
if self.isPreprocessOnly or self.isStandardIn or (self.isDependencyOnly and not self.isCompileOnly):
322-
return True
323-
return False
324-
342+
return (True, "CFG Only")
343+
if not self.inputFiles:
344+
return (True, "No input files")
345+
if self.isEmitLLVM:
346+
return (True, "Emit LLVM")
347+
if self.isAssembly or self.isAssembleOnly:
348+
return (True, "Assembly")
349+
if self.isPreprocessOnly:
350+
return (True, "Preprocess Only")
351+
if self.isStandardIn:
352+
return (True, "Standard In")
353+
if (self.isDependencyOnly and not self.isCompileOnly):
354+
return (True, "Dependency Only")
355+
return (False, "")
356+
325357
def _shiftArgs(self, nargs):
326358
ret = []
327359
while nargs > 0:

wllvm/compilers.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ def wcompile(mode):
3838
return rc
3939

4040
# no need to generate bitcode (e.g. configure only, assembly, ....)
41-
if af.skipBitcodeGeneration():
42-
_logger.info('No work to do')
41+
(skipit, reason) = af.skipBitcodeGeneration()
42+
if skipit:
43+
_logger.info('No work to do: %s', reason)
4344
_logger.debug(af.__dict__)
4445
return rc
4546

0 commit comments

Comments
 (0)