mirror of
https://github.com/reactos/syzkaller.git
synced 2024-11-27 21:30:33 +00:00
77beeccbe0
Consolidating FIDL library build mappings in one place, so that it can be used from extraction, and script invoking fidlgen. This also makes code clearer, and provides a more natural path for evolutions / dealing with oddities. Minor doc update post fx command changes.
42 lines
1.3 KiB
Go
42 lines
1.3 KiB
Go
// 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"
|
|
"github.com/google/syzkaller/sys/fuchsia/layout"
|
|
)
|
|
|
|
type fuchsia struct{}
|
|
|
|
func (*fuchsia) 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 (*fuchsia) prepareArch(arch *Arch) error {
|
|
return nil
|
|
}
|
|
|
|
func (*fuchsia) processFile(arch *Arch, info *compiler.ConstInfo) (map[string]uint64, map[string]bool, error) {
|
|
dir := arch.sourceDir
|
|
headerArch := arch.target.KernelHeaderArch
|
|
cc := filepath.Join(dir, "buildtools", "linux-x64", "clang", "bin", "clang")
|
|
includeDir := filepath.Join(dir, "out", headerArch, "sdk", "exported",
|
|
"zircon_sysroot", "arch", headerArch, "sysroot", "include")
|
|
args := []string{"-fmessage-length=0", "-I" + includeDir}
|
|
for _, fidlLib := range layout.AllFidlLibraries {
|
|
args = append(args, "-I"+filepath.Join(dir, "out", headerArch, fidlLib.PathToCompiledDir()))
|
|
}
|
|
for _, incdir := range info.Incdirs {
|
|
args = append(args, "-I"+filepath.Join(dir, incdir))
|
|
}
|
|
return extract(info, cc, args, "", true)
|
|
}
|