syzkaller/sys/syz-extract/akaros.go

35 lines
979 B
Go
Raw Normal View History

2017-10-14 16:36:17 +00:00
// Copyright 2017 syzkaller project authors. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
package main
import (
"fmt"
"path/filepath"
"github.com/google/syzkaller/pkg/compiler"
)
type akaros struct{}
func (*akaros) prepare(sourcedir string, build bool, arches []string) error {
if sourcedir == "" {
return fmt.Errorf("provide path to kernel checkout via -sourcedir flag (or make extract SOURCEDIR)")
}
return nil
}
func (*akaros) prepareArch(arch *Arch) error {
return nil
}
func (*akaros) processFile(arch *Arch, info *compiler.ConstInfo) (map[string]uint64, map[string]bool, error) {
dir := arch.sourceDir
syscallH := filepath.Join(dir, "kern", "include", "ros", "bits", "syscall.h")
args := []string{"-fmessage-length=0", "--include", syscallH}
for _, incdir := range info.Incdirs {
args = append(args, "-I"+filepath.Join(dir, incdir))
}
return extract(info, "gcc", args, "")
}