From 487aa0d5371e9b020c69d2f9e4a955ed8e5b2555 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 14 Sep 2017 11:47:11 +0200 Subject: 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. --- sys/sys.go | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'sys/sys.go') 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", + }, + }, +} -- cgit mrf-deployment