aboutsummaryrefslogtreecommitdiffstats
path: root/sys/sys.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2017-09-14 11:47:11 +0200
committerDmitry Vyukov <dvyukov@google.com>2017-09-15 16:02:37 +0200
commit487aa0d5371e9b020c69d2f9e4a955ed8e5b2555 (patch)
treed930a1e07640a88a9c42a3bd85cc3f2f93a3a2aa /sys/sys.go
parent91def5c506951f8a55f31979ce54657de460f528 (diff)
sys: consolidate info about various targets
Info about targets (like C arch/CFLAGS) is required in multiple places: extract.sh syz-extract syz-sysgen csource vm/qemu ... Consolidate it in one place and use that in syz-sysgen.
Diffstat (limited to 'sys/sys.go')
-rw-r--r--sys/sys.go55
1 files changed, 55 insertions, 0 deletions
diff --git a/sys/sys.go b/sys/sys.go
index f41d68dbc..d5ddd6028 100644
--- a/sys/sys.go
+++ b/sys/sys.go
@@ -6,3 +6,58 @@ package sys
import (
_ "github.com/google/syzkaller/sys/linux"
)
+
+type Target struct {
+ PtrSize uint64
+ CArch []string
+ CFlags []string
+ CCompiler string
+ KernelArch string
+ KernelHeaderArch string
+ KernelCrossCompile string
+}
+
+var Targets = map[string]map[string]*Target{
+ "linux": map[string]*Target{
+ "amd64": {
+ PtrSize: 8,
+ CArch: []string{"__x86_64__"},
+ CFlags: []string{"-m64"},
+ CCompiler: "x86_64-linux-gnu-",
+ KernelArch: "x86_64",
+ KernelHeaderArch: "x86",
+ },
+ "386": {
+ PtrSize: 4,
+ CArch: []string{"__i386__"},
+ CFlags: []string{"-m32"},
+ CCompiler: "x86_64-linux-gnu-",
+ KernelArch: "i386",
+ KernelHeaderArch: "x86",
+ },
+ "arm64": {
+ PtrSize: 8,
+ CArch: []string{"__aarch64__"},
+ CFlags: []string{},
+ CCompiler: "aarch64-linux-gnu-",
+ KernelArch: "arm64",
+ KernelHeaderArch: "arm64",
+ },
+ "arm": {
+ PtrSize: 4,
+ CArch: []string{"__arm__"},
+ CFlags: []string{"-D__LINUX_ARM_ARCH__=6", "-march=armv6t2", "-m32"},
+ CCompiler: "arm-linux-gnueabihf-",
+ KernelArch: "arm",
+ KernelHeaderArch: "arm",
+ },
+ "ppc64le": {
+ PtrSize: 8,
+ CArch: []string{"__ppc64__", "__PPC64__", "__powerpc64__"},
+ CFlags: []string{"-D__powerpc64__"},
+ CCompiler: "powerpc64le-linux-gnu-",
+ KernelArch: "powerpc",
+ KernelHeaderArch: "powerpc",
+ },
+ },
+}