targets

package
v0.0.0-...-6deb685 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var List = map[string]map[string]*Target{
	"test": {
		"64": {
			PtrSize:  8,
			PageSize: 4 << 10,
			CFlags:   []string{"-m64"},

			CrossCFlags: []string{"-m64", "-fsanitize=address", "-no-pie"},
			// contains filtered or unexported fields
		},
		"64_fork": {
			PtrSize:  8,
			PageSize: 8 << 10,
			CFlags:   []string{"-m64"},

			CrossCFlags: []string{"-m64", "-fsanitize=address", "-no-pie"},
			// contains filtered or unexported fields
		},
		"32_shmem": {
			PtrSize:     4,
			PageSize:    8 << 10,
			CFlags:      []string{"-m32"},
			CrossCFlags: []string{"-m32", "-static"},
			// contains filtered or unexported fields
		},
		"32_fork_shmem": {
			PtrSize:     4,
			PageSize:    4 << 10,
			CFlags:      []string{"-m32"},
			CrossCFlags: []string{"-m32", "-static"},
			// contains filtered or unexported fields
		},
	},
	"linux": {
		"amd64": {
			PtrSize:          8,
			PageSize:         4 << 10,
			CFlags:           []string{"-m64"},
			CrossCFlags:      []string{"-m64", "-static"},
			CCompilerPrefix:  "x86_64-linux-gnu-",
			KernelArch:       "x86_64",
			KernelHeaderArch: "x86",
			NeedSyscallDefine: func(nr uint64) bool {

				return nr >= 313
			},
		},
		"386": {
			VMArch:           "amd64",
			PtrSize:          4,
			PageSize:         4 << 10,
			CFlags:           []string{"-m32"},
			CrossCFlags:      []string{"-m32", "-static"},
			CCompilerPrefix:  "x86_64-linux-gnu-",
			KernelArch:       "i386",
			KernelHeaderArch: "x86",
		},
		"arm64": {
			PtrSize:          8,
			PageSize:         4 << 10,
			CrossCFlags:      []string{"-static"},
			CCompilerPrefix:  "aarch64-linux-gnu-",
			KernelArch:       "arm64",
			KernelHeaderArch: "arm64",
		},
		"arm": {
			VMArch:           "arm64",
			PtrSize:          4,
			PageSize:         4 << 10,
			CFlags:           []string{"-D__LINUX_ARM_ARCH__=6", "-m32", "-D__ARM_EABI__"},
			CrossCFlags:      []string{"-D__LINUX_ARM_ARCH__=6", "-march=armv6", "-static"},
			CCompilerPrefix:  "arm-linux-gnueabi-",
			KernelArch:       "arm",
			KernelHeaderArch: "arm",
		},
		"ppc64le": {
			PtrSize:  8,
			PageSize: 4 << 10,
			CFlags: []string{
				"-D__powerpc64__",
				"-D__LITTLE_ENDIAN__=1",
				"-D__BYTE_ORDER__=__ORDER_LITTLE_ENDIAN__",
			},
			CrossCFlags:      []string{"-D__powerpc64__", "-static"},
			CCompilerPrefix:  "powerpc64le-linux-gnu-",
			KernelArch:       "powerpc",
			KernelHeaderArch: "powerpc",
		},
	},
	"freebsd": {
		"amd64": {
			PtrSize:           8,
			PageSize:          4 << 10,
			CFlags:            []string{"-m64"},
			CrossCFlags:       []string{"-m64", "-static"},
			NeedSyscallDefine: dontNeedSyscallDefine,
		},
		"386": {
			VMArch:   "amd64",
			PtrSize:  4,
			PageSize: 4 << 10,
			CFlags:   []string{"-m32"},

			CrossCFlags:       []string{"-m32", "-static", "-B/usr/lib32"},
			NeedSyscallDefine: dontNeedSyscallDefine,
		},
	},
	"netbsd": {
		"amd64": {
			PtrSize:  8,
			PageSize: 4 << 10,
			CFlags:   []string{"-m64"},
			CrossCFlags: []string{"-m64", "-static",
				"--sysroot", os.ExpandEnv("${SOURCEDIR}/../dest/"),
			},
			CCompiler: os.ExpandEnv("${SOURCEDIR}/../tools/bin/x86_64--netbsd-g++"),
		},
	},
	"openbsd": {
		"amd64": {
			PtrSize:     8,
			PageSize:    4 << 10,
			CFlags:      []string{"-m64"},
			CCompiler:   "c++",
			CrossCFlags: []string{"-m64", "-static", "-lutil"},
			NeedSyscallDefine: func(nr uint64) bool {
				switch nr {
				case 8:
					return true
				case 94:
					return true
				case 198:
					return true
				case 295:
					return true
				case 301:
					return true
				case 302:
					return true
				case 303:
					return true
				case 304:
					return true
				case 329:
					return true
				case 330:
					return true
				}
				return false
			},
		},
	},
	"fuchsia": {
		"amd64": {
			PtrSize:          8,
			PageSize:         4 << 10,
			KernelHeaderArch: "x64",
			CCompiler:        os.ExpandEnv("${SOURCEDIR}/prebuilt/third_party/clang/linux-x64/bin/clang++"),
			CrossCFlags: []string{
				"-Wno-deprecated",
				"--target=x86_64-fuchsia",
				"-ldriver",
				"-lfdio",
				"-lzircon",
				"--sysroot", os.ExpandEnv("${SOURCEDIR}/out/x64/sdk/exported/zircon_sysroot/arch/x64/sysroot"),
				"-I", os.ExpandEnv("${SOURCEDIR}/zircon/system/ulib/ddk/include"),
				"-I", os.ExpandEnv("${SOURCEDIR}/zircon/system/ulib/fdio/include"),
				"-I", os.ExpandEnv("${SOURCEDIR}/zircon/system/ulib/fidl/include"),
				"-I", os.ExpandEnv("${SOURCEDIR}/out/x64/fidling/gen/zircon/system/fidl/fuchsia-device"),
				"-I", os.ExpandEnv("${SOURCEDIR}/out/x64/fidling/gen/zircon/system/fidl/fuchsia-device-manager"),
				"-I", os.ExpandEnv("${SOURCEDIR}/out/x64/fidling/gen/zircon/system/fidl/fuchsia-hardware-nand"),
				"-I", os.ExpandEnv("${SOURCEDIR}/out/x64/fidling/gen/zircon/system/fidl/fuchsia-hardware-usb-peripheral"),
				"-L", os.ExpandEnv("${SOURCEDIR}/out/x64/gen/zircon/public/lib/driver"),
				"-L", os.ExpandEnv("${SOURCEDIR}/out/x64/gen/zircon/public/lib/fdio"),
			},
		},
		"arm64": {
			PtrSize:          8,
			PageSize:         4 << 10,
			KernelHeaderArch: "arm64",
			CCompiler:        os.ExpandEnv("${SOURCEDIR}/prebuilt/third_party/clang/linux-x64/bin/clang++"),
			CrossCFlags: []string{
				"-Wno-deprecated",
				"--target=aarch64-fuchsia",
				"-ldriver",
				"-lfdio",
				"-lzircon",
				"--sysroot", os.ExpandEnv("${SOURCEDIR}/out/arm64/sdk/exported/zircon_sysroot/arch/arm64/sysroot"),
				"-I", os.ExpandEnv("${SOURCEDIR}/zircon/system/ulib/ddk/include"),
				"-I", os.ExpandEnv("${SOURCEDIR}/zircon/system/ulib/fdio/include"),
				"-I", os.ExpandEnv("${SOURCEDIR}/zircon/system/ulib/fidl/include"),
				"-I", os.ExpandEnv("${SOURCEDIR}/out/arm64/fidling/gen/zircon/system/fidl/fuchsia-device"),
				"-I", os.ExpandEnv("${SOURCEDIR}/out/arm64/fidling/gen/zircon/system/fidl/fuchsia-device-manager"),
				"-I", os.ExpandEnv("${SOURCEDIR}/out/arm64/fidling/gen/zircon/system/fidl/fuchsia-hardware-nand"),
				"-I", os.ExpandEnv("${SOURCEDIR}/out/arm64/fidling/gen/zircon/system/fidl/fuchsia-hardware-usb-peripheral"),
				"-L", os.ExpandEnv("${SOURCEDIR}/out/arm64/gen/zircon/public/lib/driver"),
				"-L", os.ExpandEnv("${SOURCEDIR}/out/arm64/gen/zircon/public/lib/fdio"),
			},
		},
	},
	"windows": {
		"amd64": {
			PtrSize: 8,

			PageSize: 4 << 10,
		},
	},
	"akaros": {
		"amd64": {
			PtrSize:           8,
			PageSize:          4 << 10,
			KernelHeaderArch:  "x86",
			NeedSyscallDefine: dontNeedSyscallDefine,
			CCompiler:         os.ExpandEnv("${SOURCEDIR}/toolchain/x86_64-ucb-akaros-gcc/bin/x86_64-ucb-akaros-g++"),
			CrossCFlags: []string{
				"-static",
			},
		},
	},
	"trusty": {
		"arm": {
			PtrSize:           4,
			PageSize:          4 << 10,
			NeedSyscallDefine: dontNeedSyscallDefine,
		},
	},
}

nolint: lll

Functions

func MakePosixMmap

func MakePosixMmap(target *prog.Target) func(addr, size uint64) *prog.Call

MakePosixMmap creates a "normal" posix mmap call that maps [addr, addr+size) range.

func MakeSyzMmap

func MakeSyzMmap(target *prog.Target) func(addr, size uint64) *prog.Call

Types

type Target

type Target struct {
	OS               string
	Arch             string
	VMArch           string // e.g. amd64 for 386, or arm64 for arm
	PtrSize          uint64
	PageSize         uint64
	NumPages         uint64
	DataOffset       uint64
	CFlags           []string
	CrossCFlags      []string
	CCompilerPrefix  string
	CCompiler        string
	KernelArch       string
	KernelHeaderArch string
	// NeedSyscallDefine is used by csource package to decide when to emit __NR_* defines.
	NeedSyscallDefine func(nr uint64) bool
	// contains filtered or unexported fields
}

func Get

func Get(OS, arch string) *Target

type UnixSanitizer

type UnixSanitizer struct {
	MAP_FIXED uint64
	S_IFREG   uint64
	S_IFCHR   uint64
	S_IFBLK   uint64
	S_IFIFO   uint64
	S_IFSOCK  uint64
}

func MakeUnixSanitizer

func MakeUnixSanitizer(target *prog.Target) *UnixSanitizer

func (*UnixSanitizer) SanitizeCall

func (arch *UnixSanitizer) SanitizeCall(c *prog.Call)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL