aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/csource/build.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2019-03-07 20:36:03 +0100
committerDmitry Vyukov <dvyukov@google.com>2019-03-07 20:37:43 +0100
commit4b69c3cbaccd51b7ea719e7bd756d680e825988d (patch)
treef73f4504fccb75ef084a9f311fd21cc627f8f38c /pkg/csource/build.go
parent5fb683f0dacad8149e6702cac650c81474fbfcf7 (diff)
pkg/runtest: make tests pass on freebsd
The problem is stupid: <endian.h> should be included as <sys/endian.h> on freebsd. Pass actual host OS to executor build as HOSTGOOS and use it to figure out how we should include this header.
Diffstat (limited to 'pkg/csource/build.go')
-rw-r--r--pkg/csource/build.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/pkg/csource/build.go b/pkg/csource/build.go
index 83b69b537..35ac28e83 100644
--- a/pkg/csource/build.go
+++ b/pkg/csource/build.go
@@ -9,6 +9,7 @@ import (
"io/ioutil"
"os"
"os/exec"
+ "runtime"
"github.com/google/syzkaller/pkg/osutil"
"github.com/google/syzkaller/prog"
@@ -42,6 +43,7 @@ func build(target *prog.Target, src []byte, file string) (string, error) {
"-o", bin,
"-DGOOS_" + target.OS + "=1",
"-DGOARCH_" + target.Arch + "=1",
+ "-DHOSTGOOS_" + runtime.GOOS + "=1",
}
if file == "" {
flags = append(flags, "-x", "c", "-")