From 6dc47718fdbb634024bcfe47cbc4d7cc781b4cc4 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 3 Apr 2025 10:27:09 +0200 Subject: tools/syz-declextract: allow to run on subset of arches This may be useful for downstream kernels that only build and are supposed to be used with a subset of arches. Some esoteric arches may be broken on such kernels. Allow to ignore them. --- sys/syz-extract/extract.go | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'sys') diff --git a/sys/syz-extract/extract.go b/sys/syz-extract/extract.go index deaeb3f09..aa020b029 100644 --- a/sys/syz-extract/extract.go +++ b/sys/syz-extract/extract.go @@ -11,7 +11,6 @@ import ( "path/filepath" "runtime" "sort" - "strings" "github.com/google/syzkaller/pkg/ast" "github.com/google/syzkaller/pkg/compiler" @@ -80,7 +79,11 @@ func main() { if extractor == nil { tool.Failf("unknown os: %v", OS) } - arches, nfiles, err := createArches(OS, archList(OS, *flagArch), flag.Args()) + archList, err := tool.ParseArchList(OS, *flagArch) + if err != nil { + tool.Failf("failed to parse arch flag: %v", err) + } + arches, nfiles, err := createArches(OS, archList, flag.Args()) if err != nil { tool.Fail(err) } @@ -242,18 +245,6 @@ func createArches(OS string, archArray, files []string) ([]*Arch, int, error) { return arches, nfiles, nil } -func archList(OS, arches string) []string { - if arches != "" { - return strings.Split(arches, ",") - } - var archArray []string - for arch := range targets.List[OS] { - archArray = append(archArray, arch) - } - sort.Strings(archArray) - return archArray -} - func checkUnsupportedCalls(arches []*Arch) bool { supported := make(map[string]bool) unsupported := make(map[string]string) -- cgit mrf-deployment