unix/linux: add ppc system call definitions, for use with gccgo

Add system call definitions for 32-bit PowerPC (ppc).  These are
expected to be used with gccgo, as gc does not have a suitable code
generator.

These definitions are largely copied from ppc64x, with some 32-bit
specific wrappers copied from arm.

The glibc definitions of epoll_event and sockaddr_un structures need
to be overridden on ppc, similarly to some other architectures.

For golang/go#18031
Fixes golang/go#37443

Change-Id: I061ac2b8fa452dd37c2239a0b09dff2f3e9d50da
GitHub-Last-Rev: aada37a10b99a914cb9efe2abe4ef8f7f112da43
GitHub-Pull-Request: golang/sys#106
Reviewed-on: https://go-review.googlesource.com/c/sys/+/312349
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
This commit is contained in:
Ben Hutchings
2021-04-21 22:16:51 +00:00
committed by Ian Lance Taylor
parent ac73e9fd89
commit 33663a62ff
9 changed files with 2969 additions and 8 deletions
+2 -2
View File
@@ -45,8 +45,8 @@ RUN apt-get update && apt-get install -y \
gcc-aarch64-linux-gnu gcc-arm-linux-gnueabi \
gcc-mips-linux-gnu gcc-mips64-linux-gnuabi64 \
gcc-mips64el-linux-gnuabi64 gcc-mipsel-linux-gnu \
gcc-powerpc64-linux-gnu gcc-powerpc64le-linux-gnu \
gcc-riscv64-linux-gnu \
gcc-powerpc-linux-gnu gcc-powerpc64-linux-gnu \
gcc-powerpc64le-linux-gnu gcc-riscv64-linux-gnu \
gcc-s390x-linux-gnu gcc-sparc64-linux-gnu \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
+7
View File
@@ -107,6 +107,13 @@ var targets = []target{
GNUArch: "mips64el-linux-gnuabi64",
Bits: 64,
},
{
GoArch: "ppc",
LinuxArch: "powerpc",
GNUArch: "powerpc-linux-gnu",
BigEndian: true,
Bits: 32,
},
{
GoArch: "ppc64",
LinuxArch: "powerpc",
+4 -4
View File
@@ -260,7 +260,7 @@ struct sockaddr_rc {
// copied from /usr/include/linux/un.h
struct my_sockaddr_un {
sa_family_t sun_family;
#if defined(__ARM_EABI__) || defined(__powerpc64__) || defined(__riscv)
#if defined(__ARM_EABI__) || defined(__powerpc__) || defined(__powerpc64__) || defined(__riscv)
// on some platforms char is unsigned by default
signed char sun_path[108];
#else
@@ -282,7 +282,7 @@ struct sockaddr_iucv {
typedef struct user_regs PtraceRegs;
#elif defined(__aarch64__)
typedef struct user_pt_regs PtraceRegs;
#elif defined(__mips__) || defined(__powerpc64__)
#elif defined(__mips__) || defined(__powerpc__) || defined(__powerpc64__)
typedef struct pt_regs PtraceRegs;
#elif defined(__s390x__)
typedef struct _user_regs_struct PtraceRegs;
@@ -310,8 +310,8 @@ struct my_epoll_event {
// padding is not specified in linux/eventpoll.h but added to conform to the
// alignment requirements of EABI
int32_t padFd;
#elif defined(__powerpc64__) || defined(__s390x__) || defined(__sparc__) || defined(__riscv) \
|| (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI64)
#elif defined(__powerpc__) || defined(__powerpc64__) || defined(__s390x__) || defined(__sparc__) \
|| defined(__riscv) || (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI64)
int32_t _padFd;
#endif
int32_t fd;