aboutsummaryrefslogtreecommitdiff
path: root/libgo
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2018-10-01 20:17:11 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2018-10-01 20:17:11 +0000
commit44ef03008c75059368245eb3dcd6054bed3f7643 (patch)
treeb5bbe87fcb0616ef9758a0ce62e988d331f879cb /libgo
parent1b28253347dedba72abaf81e86b1812863d07a11 (diff)
downloadgcc-44ef03008c75059368245eb3dcd6054bed3f7643.zip
gcc-44ef03008c75059368245eb3dcd6054bed3f7643.tar.gz
gcc-44ef03008c75059368245eb3dcd6054bed3f7643.tar.bz2
libgo: support x32 as GOARCH=amd64p32 GOOS=linux
This is enough to let libgo build when configured using --with-multilib-list=m64,m32,mx32. I don't have an x32-enabled kernel so I haven't tested whether it executes correctly. For https://gcc.gnu.org/PR87470 Reviewed-on: https://go-review.googlesource.com/138817 From-SVN: r264772
Diffstat (limited to 'libgo')
-rwxr-xr-xlibgo/configure12
-rw-r--r--libgo/configure.ac9
-rw-r--r--libgo/go/hash/crc32/crc32_amd64p32.go2
-rw-r--r--libgo/go/internal/syscall/unix/getrandom_linux_amd64p32.go9
-rw-r--r--libgo/go/runtime/lfstack_32bit.go2
-rwxr-xr-xlibgo/goarch.sh7
6 files changed, 37 insertions, 4 deletions
diff --git a/libgo/configure b/libgo/configure
index 7166f94..f7996e1 100755
--- a/libgo/configure
+++ b/libgo/configure
@@ -13685,7 +13685,19 @@ _ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
GOARCH=386
else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#ifdef __ILP32__
+#error x32
+#endif
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
GOARCH=amd64
+else
+ GOARCH=amd64p32
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
;;
diff --git a/libgo/configure.ac b/libgo/configure.ac
index 1c19275..20ce205 100644
--- a/libgo/configure.ac
+++ b/libgo/configure.ac
@@ -252,8 +252,13 @@ changequote([,])dnl
#ifdef __x86_64__
#error 64-bit
#endif],
-[GOARCH=386],
-[GOARCH=amd64])
+ [GOARCH=386],
+ AC_COMPILE_IFELSE([
+#ifdef __ILP32__
+#error x32
+#endif],
+ [GOARCH=amd64],
+ [GOARCH=amd64p32]))
;;
ia64-*-*)
GOARCH=ia64
diff --git a/libgo/go/hash/crc32/crc32_amd64p32.go b/libgo/go/hash/crc32/crc32_amd64p32.go
index 1ec44cb4..f61b801 100644
--- a/libgo/go/hash/crc32/crc32_amd64p32.go
+++ b/libgo/go/hash/crc32/crc32_amd64p32.go
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+// +build ignore
+
package crc32
import "internal/cpu"
diff --git a/libgo/go/internal/syscall/unix/getrandom_linux_amd64p32.go b/libgo/go/internal/syscall/unix/getrandom_linux_amd64p32.go
new file mode 100644
index 0000000..911b608
--- /dev/null
+++ b/libgo/go/internal/syscall/unix/getrandom_linux_amd64p32.go
@@ -0,0 +1,9 @@
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package unix
+
+// Linux getrandom system call number.
+// See GetRandom in getrandom_linux.go.
+const randomTrap uintptr = 0x40000000 + 318
diff --git a/libgo/go/runtime/lfstack_32bit.go b/libgo/go/runtime/lfstack_32bit.go
index 1288c1a..f50c508 100644
--- a/libgo/go/runtime/lfstack_32bit.go
+++ b/libgo/go/runtime/lfstack_32bit.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build 386 arm nacl armbe m68k mips mipsle mips64p32 mips64p32le nios2 ppc s390 sh shbe sparc
+// +build 386 amd64p32 arm nacl armbe m68k mips mipsle mips64p32 mips64p32le nios2 ppc s390 sh shbe sparc
package runtime
diff --git a/libgo/goarch.sh b/libgo/goarch.sh
index f5c0a34..f7aef9d 100755
--- a/libgo/goarch.sh
+++ b/libgo/goarch.sh
@@ -57,10 +57,15 @@ case $goarch in
defaultphyspagesize=8192
pcquantum=4
;;
- amd64 | amd64p32)
+ amd64)
family=AMD64
hugepagesize="1 << 21"
;;
+ amd64p32)
+ family=AMD64
+ hugepagesize="1 << 21"
+ ptrsize=4
+ ;;
arm | armbe)
family=ARM
cachelinesize=32