• 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 fuchsia struct{}
14
15func (*fuchsia) 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 (*fuchsia) prepareArch(arch *Arch) error {
23	return nil
24}
25
26func (*fuchsia) processFile(arch *Arch, info *compiler.ConstInfo) (map[string]uint64, map[string]bool, error) {
27	dir := arch.sourceDir
28	headerArch := arch.target.KernelHeaderArch
29	cc := filepath.Join(dir, "buildtools", "linux-x64", "clang", "bin", "clang")
30	includeDir := filepath.Join(dir, "out", "build-zircon", "build-"+headerArch, "sysroot", "include")
31	args := []string{"-fmessage-length=0", "-I" + includeDir}
32	for _, incdir := range info.Incdirs {
33		args = append(args, "-I"+filepath.Join(dir, incdir))
34	}
35	return extract(info, cc, args, "", true)
36}
37