diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2023-01-17 17:23:46 +0100 |
|---|---|---|
| committer | Aleksandr Nogikh <wp32pw@gmail.com> | 2023-01-18 11:21:44 +0100 |
| commit | 6434079ffdc826cfd09b1cf754686ede638fa955 (patch) | |
| tree | 690b4dda17e1821085922fd4bd0be79d2877a64a | |
| parent | a635fc592bda72f93491d4bf137a42e7187862c9 (diff) | |
sys/targets: ignore unachievable test targets
Don't set BuildOS for those targets, where we have not managed to find a
reference target based on GOARCH/GOOS. It doesn't make much sense to use
such test targets in such cases.
| -rw-r--r-- | sys/targets/targets.go | 54 |
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 } } |
