diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2023-09-19 16:46:40 +0200 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2023-10-04 09:27:33 +0000 |
| commit | 8144982a26c6b8e5f0f5401c2a2de99e4ced04cd (patch) | |
| tree | e17e1e9cfd27739da3f002744506d22e73ff2c0d /sys/syz-sysgen/sysgen.go | |
| parent | c4dc646bee41c7e983a13750652f1035ae27b737 (diff) | |
sys: refactor const extraction
1) Make FabricateSyscallConsts() operate on ConstFile.
2) Expose Pos inside ConstInfo.
Diffstat (limited to 'sys/syz-sysgen/sysgen.go')
| -rw-r--r-- | sys/syz-sysgen/sysgen.go | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/sys/syz-sysgen/sysgen.go b/sys/syz-sysgen/sysgen.go index 0459d544f..70b38fee5 100644 --- a/sys/syz-sysgen/sysgen.go +++ b/sys/syz-sysgen/sysgen.go @@ -98,9 +98,17 @@ func main() { var jobs []*Job for _, arch := range archs { + target := targets.List[OS][arch] + constInfo := compiler.ExtractConsts(descriptions, target, nil) + if OS == targets.TestOS { + // The ConstFile object provides no guarantees re concurrent read-write, + // so let's patch it before we start goroutines. + compiler.FabricateSyscallConsts(target, constInfo, constFile) + } jobs = append(jobs, &Job{ - Target: targets.List[OS][arch], + Target: target, Unsupported: make(map[string]bool), + ConstInfo: constInfo, }) } sort.Slice(jobs, func(i, j int) bool { @@ -167,6 +175,7 @@ type Job struct { Errors []string Unsupported map[string]bool ArchData ArchData + ConstInfo map[string]*compiler.ConstInfo } func processJob(job *Job, descriptions *ast.Description, constFile *compiler.ConstFile) { @@ -174,10 +183,6 @@ func processJob(job *Job, descriptions *ast.Description, constFile *compiler.Con job.Errors = append(job.Errors, fmt.Sprintf("%v: %v\n", pos, msg)) } consts := constFile.Arch(job.Target.Arch) - if job.Target.OS == targets.TestOS { - constInfo := compiler.ExtractConsts(descriptions, job.Target, eh) - compiler.FabricateSyscallConsts(job.Target, constInfo, consts) - } prog := compiler.Compile(descriptions, consts, job.Target, eh) if prog == nil { return |
