diff options
| author | Anton Lindqvist <anton@basename.se> | 2018-11-17 19:32:19 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2018-11-17 10:32:19 -0800 |
| commit | 1508cc9c44358f1eaf1a53988c6f7c8b6c0dd7ee (patch) | |
| tree | daec295076e15ad16bdbb35170e6e779fc066a10 | |
| parent | b08ee62aecfa850eac53b4dd903299d32b5c567d (diff) | |
pkg/csource: add support for creating reproducers on OpenBSD
| -rw-r--r-- | docs/openbsd/setup.md | 6 | ||||
| -rw-r--r-- | pkg/csource/common.go | 3 | ||||
| -rw-r--r-- | sys/targets/targets.go | 9 | ||||
| -rwxr-xr-x | tools/create-openbsd-gce-ci.sh | 2 |
4 files changed, 18 insertions, 2 deletions
diff --git a/docs/openbsd/setup.md b/docs/openbsd/setup.md index ccc150136..da27a235e 100644 --- a/docs/openbsd/setup.md +++ b/docs/openbsd/setup.md @@ -22,6 +22,12 @@ Variables used throughout the instructions: # pkg_add git gmake go ``` + In order for reproducers to work, GCC from ports is also required: + + ```sh + # pkg_add gcc + ``` + 2. Clone repository: ```sh diff --git a/pkg/csource/common.go b/pkg/csource/common.go index 80ce02ef6..9de387952 100644 --- a/pkg/csource/common.go +++ b/pkg/csource/common.go @@ -27,7 +27,8 @@ const ( func createCommonHeader(p, mmapProg *prog.Prog, replacements map[string]string, opts Options) ([]byte, error) { defines := defineList(p, mmapProg, opts) - cmd := osutil.Command("cpp", "-nostdinc", "-undef", "-fdirectives-only", "-dDI", "-E", "-P", "-") + sysTarget := targets.Get(p.Target.OS, p.Target.Arch) + cmd := osutil.Command(sysTarget.CPP, "-nostdinc", "-undef", "-fdirectives-only", "-dDI", "-E", "-P", "-") for _, def := range defines { cmd.Args = append(cmd.Args, "-D"+def) } diff --git a/sys/targets/targets.go b/sys/targets/targets.go index ad47579ed..9d5af07f4 100644 --- a/sys/targets/targets.go +++ b/sys/targets/targets.go @@ -45,6 +45,8 @@ type osCommon struct { ExeExtension string // Name of the kernel object file. KernelObject string + // Name of cpp(1) executable. + CPP string } func Get(OS, arch string) *Target { @@ -259,6 +261,7 @@ var oses = map[string]osCommon{ ExecutorUsesShmem: true, ExecutorUsesForkServer: true, KernelObject: "vmlinux", + CPP: "cpp", }, "freebsd": { SyscallNumbers: true, @@ -266,6 +269,7 @@ var oses = map[string]osCommon{ ExecutorUsesShmem: true, ExecutorUsesForkServer: true, KernelObject: "vmlinux", + CPP: "cpp", }, "netbsd": { SyscallNumbers: true, @@ -273,6 +277,7 @@ var oses = map[string]osCommon{ ExecutorUsesShmem: true, ExecutorUsesForkServer: true, KernelObject: "vmlinux", + CPP: "cpp", }, "openbsd": { SyscallNumbers: true, @@ -280,12 +285,14 @@ var oses = map[string]osCommon{ ExecutorUsesShmem: true, ExecutorUsesForkServer: true, KernelObject: "bsd.gdb", + CPP: "ecpp", }, "fuchsia": { SyscallNumbers: false, ExecutorUsesShmem: false, ExecutorUsesForkServer: false, KernelObject: "zircon.elf", + CPP: "cpp", }, "windows": { SyscallNumbers: false, @@ -293,6 +300,7 @@ var oses = map[string]osCommon{ ExecutorUsesForkServer: false, ExeExtension: ".exe", KernelObject: "vmlinux", + CPP: "cpp", }, "akaros": { SyscallNumbers: true, @@ -300,6 +308,7 @@ var oses = map[string]osCommon{ ExecutorUsesShmem: false, ExecutorUsesForkServer: true, KernelObject: "akaros-kernel-64b", + CPP: "cpp", }, "trusty": { SyscallNumbers: true, diff --git a/tools/create-openbsd-gce-ci.sh b/tools/create-openbsd-gce-ci.sh index e6ff0a92f..f5903f166 100755 --- a/tools/create-openbsd-gce-ci.sh +++ b/tools/create-openbsd-gce-ci.sh @@ -30,7 +30,7 @@ rm -fr etc && mkdir -p etc cat >install.site <<EOF #!/bin/sh syspatch -PKGS="bash git gmake go llvm nano wget" +PKGS="bash gcc git gmake go llvm nano wget" PKG_PATH=https://${MIRROR}/pub/OpenBSD/${DOWNLOAD_VERSION}/packages/${ARCH}/ pkg_add -I \$PKGS PKG_PATH=http://firmware.openbsd.org/firmware/snapshots/ pkg_add vmm-firmware PKG_PATH= pkg_info -I \$PKGS vmm-firmware && echo pkg_add OK |
