aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/compiler/consts.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-01-12 15:31:35 +0100
committerDmitry Vyukov <dvyukov@google.com>2018-01-13 12:52:09 +0100
commita94baff95ecc03cf34ff2fbf5d514bb924f54855 (patch)
tree6f1be9f558b6d7f3253c75094e93f064f46b4d55 /pkg/compiler/consts.go
parent1623c95de18e7743bc514fae929d37ece749bdf4 (diff)
sys/syz-sysgen: don't generate syz_ syscall numbers
They don't seem to be used today.
Diffstat (limited to 'pkg/compiler/consts.go')
-rw-r--r--pkg/compiler/consts.go30
1 files changed, 1 insertions, 29 deletions
diff --git a/pkg/compiler/consts.go b/pkg/compiler/consts.go
index 7f0cb7e38..46a781f39 100644
--- a/pkg/compiler/consts.go
+++ b/pkg/compiler/consts.go
@@ -127,39 +127,11 @@ func convertConstInfo(infos map[string]*constInfo) map[string]*ConstInfo {
// assignSyscallNumbers assigns syscall numbers, discards unsupported syscalls.
func (comp *compiler) assignSyscallNumbers(consts map[string]uint64) {
- // Pseudo syscalls starting from syz_ are assigned numbers starting from syzbase.
- // Note: the numbers must be stable (not depend on file reading order, etc),
- // so we have to do it in 2 passes.
- const syzbase = 1000000
- syzcalls := make(map[string]bool)
for _, decl := range comp.desc.Nodes {
c, ok := decl.(*ast.Call)
- if !ok {
+ if !ok || strings.HasPrefix(c.CallName, "syz_") {
continue
}
- if strings.HasPrefix(c.CallName, "syz_") {
- syzcalls[c.CallName] = true
- }
- }
- syznr := make(map[string]uint64)
- for i, name := range toArray(syzcalls) {
- syznr[name] = syzbase + uint64(i)
- }
-
- for _, decl := range comp.desc.Nodes {
- c, ok := decl.(*ast.Call)
- if !ok {
- continue
- }
- if strings.HasPrefix(c.CallName, "syz_") {
- c.NR = syznr[c.CallName]
- continue
- }
- // TODO(dvyukov): we don't need even syz consts in this case.
- if !comp.target.SyscallNumbers {
- continue
- }
- // Lookup in consts.
str := comp.target.SyscallPrefix + c.CallName
nr, ok := consts[str]
if ok {