aboutsummaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorMichael Tuexen <tuexen@fh-muenster.de>2020-05-12 23:06:08 +0200
committerDmitry Vyukov <dvyukov@google.com>2020-05-14 11:06:41 +0200
commite36b2ae53da11f462646204bce64349b0898a340 (patch)
tree42304da7e50ef4b2dee196741a686b50f9a9eefa /sys
parenta885920d007a2f1ce91eb50f810255b190076cd1 (diff)
sys/targets: fix tests when building on FreeBSD
gmake test is failing on FreeBSD since switching to clang. To address this: * use g++ as the C preprocessor for now. * use a C compiler for compiling C sources and add -lc++ when compiling executor.cc. Without this, clang warns about using a C++ compiler for compiling C code. * some test configs add -no-pie, which is not used by clang. Add -Wno-unused-command-line-argument to silence a warning
Diffstat (limited to 'sys')
-rw-r--r--sys/targets/targets.go16
1 files changed, 12 insertions, 4 deletions
diff --git a/sys/targets/targets.go b/sys/targets/targets.go
index 32a04e495..6a66d91f7 100644
--- a/sys/targets/targets.go
+++ b/sys/targets/targets.go
@@ -195,8 +195,8 @@ var List = map[string]map[string]*Target{
"amd64": {
PtrSize: 8,
PageSize: 4 << 10,
- CCompiler: "c++",
- CFlags: []string{"-m64", "-static"},
+ CCompiler: "clang",
+ CFlags: []string{"-m64"},
NeedSyscallDefine: dontNeedSyscallDefine,
},
"386": {
@@ -204,8 +204,8 @@ var List = map[string]map[string]*Target{
PtrSize: 4,
PageSize: 4 << 10,
Int64Alignment: 4,
- CCompiler: "c++",
- CFlags: []string{"-m32", "-static"},
+ CCompiler: "clang",
+ CFlags: []string{"-m32"},
NeedSyscallDefine: dontNeedSyscallDefine,
},
},
@@ -344,6 +344,8 @@ var oses = map[string]osCommon{
ExecutorUsesShmem: true,
ExecutorUsesForkServer: true,
KernelObject: "kernel.full",
+ CPP: "g++",
+ cflags: []string{"-static", "-lc++"},
},
"netbsd": {
BuildOS: "linux",
@@ -425,6 +427,12 @@ func init() {
if host := List[goos][runtime.GOARCH]; host != nil {
target.CCompiler = host.CCompiler
target.CPP = host.CPP
+ if goos == "freebsd" {
+ // For some configurations -no-pie is passed to the compiler,
+ // which is not used by clang.
+ // Ensure clang does not complain about it.
+ target.CFlags = append(target.CFlags, "-Wno-unused-command-line-argument")
+ }
}
}
target.BuildOS = goos