diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2019-08-09 18:05:51 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2019-08-09 18:05:51 +0200 |
| commit | 1ecb069f0e95a740181fb7fc7b89ae79ce11ae58 (patch) | |
| tree | 7dc378ef807dc5ce54ea27ca04b7f7f962851c7b /sys | |
| parent | aff9e255cd708709adef545d1f932020ee5c0978 (diff) | |
sys/targets: fix build on darwin
Currently build on darwin crashes when we try to access host.CCompiler/CPP
(there is no darwin target). Check that we have the host target before using it,
otherwise use default gcc/cpp.
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/targets/targets.go | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/sys/targets/targets.go b/sys/targets/targets.go index d5eb388a6..3299e52b5 100644 --- a/sys/targets/targets.go +++ b/sys/targets/targets.go @@ -311,7 +311,6 @@ var oses = map[string]osCommon{ ExecutorUsesShmem: true, ExecutorUsesForkServer: true, KernelObject: "vmlinux", - CPP: "cpp", }, "freebsd": { SyscallNumbers: true, @@ -328,7 +327,6 @@ var oses = map[string]osCommon{ ExecutorUsesShmem: true, ExecutorUsesForkServer: true, KernelObject: "netbsd.gdb", - CPP: "cpp", }, "openbsd": { SyscallNumbers: true, @@ -344,7 +342,6 @@ var oses = map[string]osCommon{ ExecutorUsesShmem: false, ExecutorUsesForkServer: false, KernelObject: "zircon.elf", - CPP: "cpp", }, "windows": { SyscallNumbers: false, @@ -352,7 +349,6 @@ var oses = map[string]osCommon{ ExecutorUsesForkServer: false, ExeExtension: ".exe", KernelObject: "vmlinux", - CPP: "cpp", }, "akaros": { BuildOS: "linux", @@ -361,12 +357,10 @@ var oses = map[string]osCommon{ ExecutorUsesShmem: false, ExecutorUsesForkServer: true, KernelObject: "akaros-kernel-64b", - CPP: "cpp", }, "trusty": { SyscallNumbers: true, SyscallPrefix: "__NR_", - CPP: "cpp", }, } @@ -397,8 +391,12 @@ func init() { goos = "linux" } for _, target := range List["test"] { - target.CCompiler = List[goos][runtime.GOARCH].CCompiler - target.CPP = List[goos][runtime.GOARCH].CPP + if List[goos] != nil { + if host := List[goos][runtime.GOARCH]; host != nil { + target.CCompiler = host.CCompiler + target.CPP = host.CPP + } + } target.BuildOS = goos if runtime.GOOS == "freebsd" && runtime.GOARCH == "amd64" && target.PtrSize == 4 { // -m32 alone does not work on freebsd with gcc. @@ -430,6 +428,9 @@ func initTarget(target *Target, OS, arch string) { if target.CCompiler == "" { target.CCompiler = target.CCompilerPrefix + "gcc" } + if target.CPP == "" { + target.CPP = "cpp" + } if target.BuildOS == "" { target.BuildOS = OS } |
