aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/compiler
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2017-09-02 13:21:47 +0200
committerDmitry Vyukov <dvyukov@google.com>2017-09-02 13:21:47 +0200
commit2c0b7b7ff31bbb899cc0c95766b5d04ebbd2d269 (patch)
treec1cbb0136f8194b636bd13baecff4d342d1ef2b6 /pkg/compiler
parenta7206b24cac96c08aecf2f3b4cc3c2e555eec708 (diff)
pkg/compiler: restore generation of unsupported syscalls
Unfortunately this is sitll needed, see the added comment. Update #191
Diffstat (limited to 'pkg/compiler')
-rw-r--r--pkg/compiler/consts.go15
1 files changed, 14 insertions, 1 deletions
diff --git a/pkg/compiler/consts.go b/pkg/compiler/consts.go
index 970a79050..44c0c4f18 100644
--- a/pkg/compiler/consts.go
+++ b/pkg/compiler/consts.go
@@ -139,6 +139,15 @@ func (comp *compiler) assignSyscallNumbers(consts map[string]uint64) {
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:
@@ -205,7 +214,11 @@ func (comp *compiler) patchConsts(consts map[string]uint64) {
}
// We have to keep partially broken resources and structs,
// because otherwise their usages will error.
- if _, ok := decl.(*ast.Call); !ok {
+ if c, ok := decl.(*ast.Call); !ok {
+ top = append(top, decl)
+ } else {
+ // See comment in assignSyscallNumbers.
+ c.NR = ^uint64(0)
top = append(top, decl)
}
}