aboutsummaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/targets/targets.go54
1 files changed, 28 insertions, 26 deletions
diff --git a/sys/targets/targets.go b/sys/targets/targets.go
index ba84b1ee0..7d10dfc04 100644
--- a/sys/targets/targets.go
+++ b/sys/targets/targets.go
@@ -625,34 +625,36 @@ func init() {
goos = Linux
}
for _, target := range List[TestOS] {
- if List[goos] != nil {
- arch := arch64
- if target.PtrSize == 4 {
- arch = arch32
- }
- host := List[goos][arch]
- if host != nil {
- target.CCompiler = host.CCompiler
- target.CPP = host.CPP
- target.CFlags = append(append([]string{}, host.CFlags...), target.CFlags...)
- target.CFlags = processMergedFlags(target.CFlags)
- // In ESA/390 mode, the CPU is able to address only 31bit of memory but
- // arithmetic operations are still 32bit
- // Fix cflags by replacing compiler's -m32 option with -m31
- if arch == S390x {
- for i := range target.CFlags {
- target.CFlags[i] = strings.Replace(target.CFlags[i], "-m32", "-m31", -1)
- }
- }
- }
- if target.PtrSize == 4 && goos == FreeBSD && arch == AMD64 {
- // A hack to let 32-bit "test" target tests run on FreeBSD:
- // freebsd/386 requires a non-default DataOffset to avoid
- // clobbering mappings created by the C runtime. Since that is the
- // only target with this constraint, just special-case it for now.
- target.DataOffset = List[goos][I386].DataOffset
+ if List[goos] == nil {
+ continue
+ }
+ arch := arch64
+ if target.PtrSize == 4 {
+ arch = arch32
+ }
+ host := List[goos][arch]
+ if host == nil {
+ continue
+ }
+ target.CCompiler = host.CCompiler
+ target.CPP = host.CPP
+ target.CFlags = append(append([]string{}, host.CFlags...), target.CFlags...)
+ target.CFlags = processMergedFlags(target.CFlags)
+ // In ESA/390 mode, the CPU is able to address only 31bit of memory but
+ // arithmetic operations are still 32bit
+ // Fix cflags by replacing compiler's -m32 option with -m31
+ if arch == S390x {
+ for i := range target.CFlags {
+ target.CFlags[i] = strings.Replace(target.CFlags[i], "-m32", "-m31", -1)
}
}
+ if target.PtrSize == 4 && goos == FreeBSD && arch == AMD64 {
+ // A hack to let 32-bit "test" target tests run on FreeBSD:
+ // freebsd/386 requires a non-default DataOffset to avoid
+ // clobbering mappings created by the C runtime. Since that is the
+ // only target with this constraint, just special-case it for now.
+ target.DataOffset = List[goos][I386].DataOffset
+ }
target.BuildOS = goos
}
}