diff options
| author | Alexander Egorenkov <Alexander.Egorenkov@ibm.com> | 2020-09-16 19:01:36 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-09-18 07:49:33 +0200 |
| commit | 8c70a2f7b7ded6a33aed1bbf9ee82befbef9851f (patch) | |
| tree | 989ac8cf344933713a6aae00d84662fdb2c9031a | |
| parent | 8247808b71d540d96d8c28ea2854f1c5d1afb8ba (diff) | |
sys/targets: use -m31 gcc option on s390x arch for 32bit targets
In ESA/S390 mode, the CPU is able to address only 31bit of
memory address space. GCC on s390x expects the flag -m31 instead
of -m32 for 32bit code.
Signed-off-by: Alexander Egorenkov <Alexander.Egorenkov@ibm.com>
| -rw-r--r-- | sys/targets/targets.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/targets/targets.go b/sys/targets/targets.go index 6c667bb52..7c0ab8fef 100644 --- a/sys/targets/targets.go +++ b/sys/targets/targets.go @@ -476,6 +476,14 @@ func init() { // to link against the libc++ library. target.CFlags = append(target.CFlags, "-lc++") } + // 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 goarch == "s390x" { + for i := range target.CFlags { + target.CFlags[i] = strings.Replace(target.CFlags[i], "-m32", "-m31", -1) + } + } } if target.PtrSize == 4 && goos == "freebsd" && goarch == "amd64" { // A hack to let 32-bit "test" target tests run on FreeBSD: |
