targets

package
v0.0.0-...-f0d17a2 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: Apache-2.0, 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", "-static"},
			// contains filtered or unexported fields
		},
		"64_fork": {
			PtrSize:     8,
			PageSize:    8 << 10,
			CFlags:      []string{"-m64"},
			CrossCFlags: []string{"-m64", "-static"},
			// 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__"},
			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,
		},
	},
	"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}/buildtools/linux-x64/clang/bin/clang++"),
			CrossCFlags: []string{
				"-Wno-deprecated",
				"--target=x86_64-fuchsia",
				"-lfdio",
				"-lzircon",
				"-ldriver",
				"--sysroot", os.ExpandEnv("${SOURCEDIR}/out/x64/sdk/exported/zircon_sysroot/arch/x64/sysroot"),
				"-I", os.ExpandEnv("${SOURCEDIR}/zircon/system/ulib/fdio/include"),
				"-I", os.ExpandEnv("${SOURCEDIR}/zircon/system/ulib/ddk/include"),
				"-L", os.ExpandEnv("${SOURCEDIR}/out/x64/x64-shared"),
			},
		},
		"arm64": {
			PtrSize:          8,
			PageSize:         4 << 10,
			KernelHeaderArch: "arm64",
			CCompiler:        os.ExpandEnv("${SOURCEDIR}/buildtools/linux-x64/clang/bin/clang++"),
			CrossCFlags: []string{
				"-Wno-deprecated",
				"--target=aarch64-fuchsia",
				"-lfdio",
				"-lzircon",
				"-ldriver",
				"--sysroot", os.ExpandEnv("${SOURCEDIR}/out/arm64/sdk/exported/zircon_sysroot/arch/arm64/sysroot"),
				"-L", os.ExpandEnv("${SOURCEDIR}/out/arm64/arm64-shared"),
				"-I", os.ExpandEnv("${SOURCEDIR}/zircon/system/ulib/fdio/include"),
				"-I", os.ExpandEnv("${SOURCEDIR}/zircon/system/ulib/ddk/include"),
			},
		},
	},
	"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