aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/compiler/consts.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2017-09-25 08:47:15 +0200
committerDmitry Vyukov <dvyukov@google.com>2017-09-25 08:47:48 +0200
commite9c477a5b3a05a614d9a0c68ba9724762a363784 (patch)
treea89fbfd6c3f8543f0b86a4c8c68c365a53a40ba1 /pkg/compiler/consts.go
parent8f8cf20bd23a37aaf4ac3a7ec3fab2370ef2a755 (diff)
sys/syz-extract: support fuchsia
Diffstat (limited to 'pkg/compiler/consts.go')
-rw-r--r--pkg/compiler/consts.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/pkg/compiler/consts.go b/pkg/compiler/consts.go
index 4cb68e773..c2051ab5d 100644
--- a/pkg/compiler/consts.go
+++ b/pkg/compiler/consts.go
@@ -25,7 +25,7 @@ type ConstInfo struct {
}
// ExtractConsts returns list of literal constants and other info required const value extraction.
-func ExtractConsts(desc *ast.Description, eh0 ast.ErrorHandler) *ConstInfo {
+func ExtractConsts(desc *ast.Description, target *targets.Target, eh0 ast.ErrorHandler) *ConstInfo {
errors := 0
eh := func(pos ast.Pos, msg string, args ...interface{}) {
errors++
@@ -42,6 +42,7 @@ func ExtractConsts(desc *ast.Description, eh0 ast.ErrorHandler) *ConstInfo {
includeMap := make(map[string]bool)
incdirMap := make(map[string]bool)
constMap := make(map[string]bool)
+ syscallNumbers := targets.OSList[target.OS].SyscallNumbers
ast.Walk(desc, func(n1 ast.Node) {
switch n := n1.(type) {
@@ -74,7 +75,7 @@ func ExtractConsts(desc *ast.Description, eh0 ast.ErrorHandler) *ConstInfo {
info.Defines[name] = v
constMap[name] = true
case *ast.Call:
- if !strings.HasPrefix(n.CallName, "syz_") {
+ if syscallNumbers && !strings.HasPrefix(n.CallName, "syz_") {
constMap["__NR_"+n.CallName] = true
}
case *ast.Type: