aboutsummaryrefslogtreecommitdiffstats
path: root/sys/targets
diff options
context:
space:
mode:
authorAlexander Egorenkov <Alexander.Egorenkov@ibm.com>2020-09-16 19:01:36 +0200
committerDmitry Vyukov <dvyukov@google.com>2020-09-18 07:49:33 +0200
commit8c70a2f7b7ded6a33aed1bbf9ee82befbef9851f (patch)
tree989ac8cf344933713a6aae00d84662fdb2c9031a /sys/targets
parent8247808b71d540d96d8c28ea2854f1c5d1afb8ba (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>
Diffstat (limited to 'sys/targets')
-rw-r--r--sys/targets/targets.go8
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: