From a7dab6385c1d95547a88e22577fb56fbcd5c37eb Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 28 Jan 2022 10:27:54 +0100 Subject: tools/syz-kconf: allow to specify custom compiler This will be needed at least for kmsan config which needs a fresh clang. --- tools/syz-kconf/kconf.go | 4 +++- tools/syz-kconf/parser.go | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/syz-kconf/kconf.go b/tools/syz-kconf/kconf.go index c46c73170..316ffd3a8 100644 --- a/tools/syz-kconf/kconf.go +++ b/tools/syz-kconf/kconf.go @@ -425,7 +425,9 @@ func (ctx *Context) Make(args ...string) error { if ctx.Target.Triple != "" { args = append(args, "CROSS_COMPILE="+ctx.Target.Triple+"-") } - if ctx.Target.KernelCompiler != "" { + if ctx.Inst.Compiler != "" { + args = append(args, "CC="+ctx.Inst.Compiler) + } else if ctx.Target.KernelCompiler != "" { args = append(args, "CC="+ctx.Target.KernelCompiler) } _, err := osutil.RunCmd(10*time.Minute, ctx.SourceDir, "make", args...) diff --git a/tools/syz-kconf/parser.go b/tools/syz-kconf/parser.go index 8b8a074c7..64aad9403 100644 --- a/tools/syz-kconf/parser.go +++ b/tools/syz-kconf/parser.go @@ -19,6 +19,7 @@ import ( type Instance struct { Name string Kernel Kernel + Compiler string Verbatim []byte Shell []Shell Features Features @@ -79,6 +80,7 @@ type rawFile struct { Repo string Tag string } + Compiler string Shell []yaml.Node Verbatim string Config []yaml.Node @@ -181,6 +183,12 @@ func mergeFile(inst *Instance, raw *rawFile, file string, errs *Errors) { } inst.Kernel = raw.Kernel } + if raw.Compiler != "" { + if inst.Compiler != "" { + errs.push("%v: compiler is set twice", file) + } + inst.Compiler = raw.Compiler + } for _, node := range raw.Shell { cmd, _, constraints, err := parseNode(node) if err != nil { -- cgit mrf-deployment