aboutsummaryrefslogtreecommitdiffstats
path: root/tools/syz-kconf
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2022-04-23 11:49:48 +0200
committerDmitry Vyukov <dvyukov@google.com>2022-04-25 11:30:19 +0200
commit0fb86198533c24d40cbb1ae081d0ba3652cf10f6 (patch)
treec3dd4a3915da4f8d15a95924d1ae6bd97f5d34a9 /tools/syz-kconf
parent0ede5bfc57b8910f6436a23955422fae109636c2 (diff)
tools/syz-kconf: apply replacement vars to Compiler as well
This allows to use compiler dependent on arch and/or from kernel build/source dir.
Diffstat (limited to 'tools/syz-kconf')
-rw-r--r--tools/syz-kconf/kconf.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/tools/syz-kconf/kconf.go b/tools/syz-kconf/kconf.go
index 316ffd3a8..a32b0a61d 100644
--- a/tools/syz-kconf/kconf.go
+++ b/tools/syz-kconf/kconf.go
@@ -241,8 +241,7 @@ func (ctx *Context) executeShell() error {
}
args := strings.Split(shell.Cmd, " ")
for i := 1; i < len(args); i++ {
- args[i] = strings.ReplaceAll(args[i], "${BUILDDIR}", ctx.BuildDir)
- args[i] = strings.ReplaceAll(args[i], "${ARCH}", ctx.Target.KernelArch)
+ args[i] = ctx.replaceVars(args[i])
}
if args[0] == "make" {
if err := ctx.Make(args[1:]...); err != nil {
@@ -426,7 +425,7 @@ func (ctx *Context) Make(args ...string) error {
args = append(args, "CROSS_COMPILE="+ctx.Target.Triple+"-")
}
if ctx.Inst.Compiler != "" {
- args = append(args, "CC="+ctx.Inst.Compiler)
+ args = append(args, "CC="+ctx.replaceVars(ctx.Inst.Compiler))
} else if ctx.Target.KernelCompiler != "" {
args = append(args, "CC="+ctx.Target.KernelCompiler)
}
@@ -434,6 +433,12 @@ func (ctx *Context) Make(args ...string) error {
return err
}
+func (ctx *Context) replaceVars(str string) string {
+ str = strings.ReplaceAll(str, "${BUILDDIR}", ctx.BuildDir)
+ str = strings.ReplaceAll(str, "${ARCH}", ctx.Target.KernelArch)
+ return str
+}
+
func releaseTag(dir string) (string, error) {
data, err := ioutil.ReadFile(filepath.Join(dir, "Makefile"))
if err != nil {