diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2017-09-15 14:15:52 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2017-09-15 16:02:37 +0200 |
| commit | 66393d1884cb6a6d36dcbe5ad772ae9cf8f2adad (patch) | |
| tree | a8747f057372ed2e2a451a0c0988b99f70a012dc /pkg/compiler/consts.go | |
| parent | 4f60e46e498eedc0d9407d11d1078208c37d19f1 (diff) | |
pkg/compiler: don't genererate missing syscalls
We used to generate them only because manager had no idea
what arch it is testing. So syscalls numbers had to match
between all arches.
This is not needed anymore.
Also don't generate unreferenced structs/resources.
Diffstat (limited to 'pkg/compiler/consts.go')
| -rw-r--r-- | pkg/compiler/consts.go | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/pkg/compiler/consts.go b/pkg/compiler/consts.go index 44c0c4f18..f64f4ed7f 100644 --- a/pkg/compiler/consts.go +++ b/pkg/compiler/consts.go @@ -128,26 +128,18 @@ func (comp *compiler) assignSyscallNumbers(consts map[string]uint64) { // Lookup in consts. str := "__NR_" + c.CallName nr, ok := consts[str] + top = append(top, decl) if ok { c.NR = nr - top = append(top, decl) continue } + c.NR = ^uint64(0) // mark as unused to not generate it name := "syscall " + c.CallName if !comp.unsupported[name] { comp.unsupported[name] = true comp.warning(c.Pos, "unsupported syscall: %v due to missing const %v", c.CallName, str) } - // TODO: we still have to preserve the syscall. - // The problem is that manager and fuzzer use syscall indexes - // to communicate enabled syscalls. If manager is built for - // amd64 and fuzzer for arm64, then they would have different - // sets of syscalls and would not agree on syscall indexes. - // Remove this once we have proper cross-OS/arch support. - // The same happens in patchConsts. - c.NR = ^uint64(0) - top = append(top, decl) case *ast.IntFlags, *ast.Resource, *ast.Struct, *ast.StrFlags: top = append(top, decl) case *ast.NewLine, *ast.Comment, *ast.Include, *ast.Incdir, *ast.Define: @@ -214,12 +206,9 @@ func (comp *compiler) patchConsts(consts map[string]uint64) { } // We have to keep partially broken resources and structs, // because otherwise their usages will error. - if c, ok := decl.(*ast.Call); !ok { - top = append(top, decl) - } else { - // See comment in assignSyscallNumbers. - c.NR = ^uint64(0) - top = append(top, decl) + top = append(top, decl) + if c, ok := decl.(*ast.Call); ok { + c.NR = ^uint64(0) // mark as unused to not generate it } } } |
