• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2017 syzkaller project authors. All rights reserved.
2// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
3
4package main
5
6import (
7	"fmt"
8	"path/filepath"
9
10	"github.com/google/syzkaller/pkg/compiler"
11)
12
13type akaros struct{}
14
15func (*akaros) prepare(sourcedir string, build bool, arches []string) error {
16	if sourcedir == "" {
17		return fmt.Errorf("provide path to kernel checkout via -sourcedir flag (or make extract SOURCEDIR)")
18	}
19	return nil
20}
21
22func (*akaros) prepareArch(arch *Arch) error {
23	return nil
24}
25
26func (*akaros) processFile(arch *Arch, info *compiler.ConstInfo) (map[string]uint64, map[string]bool, error) {
27	dir := arch.sourceDir
28	args := []string{
29		"-fmessage-length=0",
30		"-D__KERNEL__",
31		"-DROS_KERNEL",
32		"-I", filepath.Join(dir, "kern", "include"),
33		"-I", filepath.Join(dir, "user", "parlib", "include"),
34	}
35	for _, incdir := range info.Incdirs {
36		args = append(args, "-I"+filepath.Join(dir, incdir))
37	}
38	return extract(info, "gcc", args, "", true)
39}
40