Message ID | 20220102163713.26299-1-soeren@soeren-tempel.net |
---|---|
State | New |
Headers |
Return-Path: <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 93CD53858421 for <patchwork@sourceware.org>; Sun, 2 Jan 2022 16:37:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 93CD53858421 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1641141472; bh=ZzoiJ0K6AObsc2peNnHYzqbArE3jtwgDYdpspxpy77A=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=fyqij5zXW121W/ZaG+97P+Jfwa3y47fCrQFULnAPNVQbFT/O/7V7739XSFcr/8VA2 aZ4wJqrGC2W87uFrbxGYDg1m9QEBhWrDe6n+QXuCVKwCWnGvG1sfwgUQjnxu6Y/Bsi 26HPXF8KqpLcAEnrqdpcMOB8EkE7p/mRZmuxorQE= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from magnesium.8pit.net (magnesium.8pit.net [45.76.88.171]) by sourceware.org (Postfix) with ESMTP id EB32A3858C27; Sun, 2 Jan 2022 16:37:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EB32A3858C27 Received: from localhost (ip5f5ae040.dynamic.kabel-deutschland.de [95.90.224.64]) by magnesium.8pit.net (OpenSMTPD) with ESMTPSA id 3706a581 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:YES); Sun, 2 Jan 2022 17:37:20 +0100 (CET) To: gcc-patches@gcc.gnu.org Subject: [PATCH] libgo: include asm/ptrace.h for pt_regs definition on PowerPC Date: Sun, 2 Jan 2022 17:37:13 +0100 Message-Id: <20220102163713.26299-1-soeren@soeren-tempel.net> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: soeren--- via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: soeren@soeren-tempel.net Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> |
Series |
libgo: include asm/ptrace.h for pt_regs definition on PowerPC
|
|
Commit Message
Li, Pan2 via Gcc-patches
Jan. 2, 2022, 4:37 p.m. UTC
From: Sören Tempel <soeren@soeren-tempel.net> Both glibc and musl libc declare pt_regs as an incomplete type. This type has to be completed by inclusion of another header. On Linux, the asm/ptrace.h header file provides this type definition. Without including this header file, it is not possible to access the regs member of the mcontext_t struct as done in libgo/runtime/go-signal.c. On glibc, other headers (e.g. sys/user.h) include asm/ptrace.h but on musl asm/ptrace.h is not included by other headers and thus the aforementioned files do not compile without an explicit include of asm/ptrace.h: libgo/runtime/go-signal.c: In function 'getSiginfo': libgo/runtime/go-signal.c:227:63: error: invalid use of undefined type 'struct pt_regs' 227 | ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.regs->nip; | See also: * https://git.musl-libc.org/cgit/musl/commit/?id=c2518a8efb6507f1b41c3b12e03b06f8f2317a1f * https://github.com/kaniini/libucontext/issues/36 Signed-off-by: Sören Tempel <soeren@soeren-tempel.net> ChangeLog: * libgo/runtime/go-signal.c: Include asm/ptrace.h for the definition of pt_regs (used by mcontext_t) on PowerPC. --- libgo/runtime/go-signal.c | 6 ++++++ 1 file changed, 6 insertions(+)
Comments
Ping. Summary: Fix build of libgo on PPC with musl libc and libucontext by explicitly including the Linux header defining `struct pt_regs` instead of relying on other libc headers to include it implicitly. See: https://gcc.gnu.org/pipermail/gcc-patches/2022-January/587520.html If the patch needs to be revised further please let me know. This patch has been applied at Alpine Linux downstream (which uses musl libc) for a while, I have not tested it on other systems. Greetings, Sören Sören Tempel <soeren@soeren-tempel.net> wrote: > Both glibc and musl libc declare pt_regs as an incomplete type. This > type has to be completed by inclusion of another header. On Linux, the > asm/ptrace.h header file provides this type definition. Without > including this header file, it is not possible to access the regs member > of the mcontext_t struct as done in libgo/runtime/go-signal.c. On glibc, > other headers (e.g. sys/user.h) include asm/ptrace.h but on musl > asm/ptrace.h is not included by other headers and thus the > aforementioned files do not compile without an explicit include of > asm/ptrace.h: > > libgo/runtime/go-signal.c: In function 'getSiginfo': > libgo/runtime/go-signal.c:227:63: error: invalid use of undefined type 'struct pt_regs' > 227 | ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.regs->nip; > | > > See also: > > * https://git.musl-libc.org/cgit/musl/commit/?id=c2518a8efb6507f1b41c3b12e03b06f8f2317a1f > * https://github.com/kaniini/libucontext/issues/36 > > Signed-off-by: Sören Tempel <soeren@soeren-tempel.net> > > ChangeLog: > > * libgo/runtime/go-signal.c: Include asm/ptrace.h for the > definition of pt_regs (used by mcontext_t) on PowerPC. > --- > libgo/runtime/go-signal.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/libgo/runtime/go-signal.c b/libgo/runtime/go-signal.c > index d30d1603adc..fc01e04e4a1 100644 > --- a/libgo/runtime/go-signal.c > +++ b/libgo/runtime/go-signal.c > @@ -10,6 +10,12 @@ > #include <sys/time.h> > #include <ucontext.h> > > +// On PowerPC, ucontext.h uses a pt_regs struct as an incomplete > +// type. This type must be completed by including asm/ptrace.h. > +#ifdef __PPC__ > +#include <asm/ptrace.h> > +#endif > + > #include "runtime.h" > > #ifndef SA_RESTART
On Jan 02 2022, soeren--- via Gcc-patches wrote: > libgo/runtime/go-signal.c: In function 'getSiginfo': > libgo/runtime/go-signal.c:227:63: error: invalid use of undefined type 'struct pt_regs' > 227 | ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.regs->nip; Why does that use .regs instead of .uc_regs?
Note for gofrontend-dev: on gcc-patches only Andreas Schwab suggested using uc_regs instead of regs, which does look correct to me. Ian On Mon, Feb 21, 2022 at 8:47 AM Sören Tempel <soeren@soeren-tempel.net> wrote: > > Ping. > > Summary: Fix build of libgo on PPC with musl libc and libucontext by > explicitly including the Linux header defining `struct pt_regs` instead of > relying on other libc headers to include it implicitly. > > See: https://gcc.gnu.org/pipermail/gcc-patches/2022-January/587520.html > > If the patch needs to be revised further please let me know. This patch has > been applied at Alpine Linux downstream (which uses musl libc) for a while, I > have not tested it on other systems. > > Greetings, > Sören > > Sören Tempel <soeren@soeren-tempel.net> wrote: > > Both glibc and musl libc declare pt_regs as an incomplete type. This > > type has to be completed by inclusion of another header. On Linux, the > > asm/ptrace.h header file provides this type definition. Without > > including this header file, it is not possible to access the regs member > > of the mcontext_t struct as done in libgo/runtime/go-signal.c. On glibc, > > other headers (e.g. sys/user.h) include asm/ptrace.h but on musl > > asm/ptrace.h is not included by other headers and thus the > > aforementioned files do not compile without an explicit include of > > asm/ptrace.h: > > > > libgo/runtime/go-signal.c: In function 'getSiginfo': > > libgo/runtime/go-signal.c:227:63: error: invalid use of undefined type 'struct pt_regs' > > 227 | ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.regs->nip; > > | > > > > See also: > > > > * https://git.musl-libc.org/cgit/musl/commit/?id=c2518a8efb6507f1b41c3b12e03b06f8f2317a1f > > * https://github.com/kaniini/libucontext/issues/36 > > > > Signed-off-by: Sören Tempel <soeren@soeren-tempel.net> > > > > ChangeLog: > > > > * libgo/runtime/go-signal.c: Include asm/ptrace.h for the > > definition of pt_regs (used by mcontext_t) on PowerPC. > > --- > > libgo/runtime/go-signal.c | 6 ++++++ > > 1 file changed, 6 insertions(+) > > > > diff --git a/libgo/runtime/go-signal.c b/libgo/runtime/go-signal.c > > index d30d1603adc..fc01e04e4a1 100644 > > --- a/libgo/runtime/go-signal.c > > +++ b/libgo/runtime/go-signal.c > > @@ -10,6 +10,12 @@ > > #include <sys/time.h> > > #include <ucontext.h> > > > > +// On PowerPC, ucontext.h uses a pt_regs struct as an incomplete > > +// type. This type must be completed by including asm/ptrace.h. > > +#ifdef __PPC__ > > +#include <asm/ptrace.h> > > +#endif > > + > > #include "runtime.h" > > > > #ifndef SA_RESTART > > -- > You received this message because you are subscribed to the Google Groups "gofrontend-dev" group. > To unsubscribe from this group and stop receiving emails from it, send an email to gofrontend-dev+unsubscribe@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/msgid/gofrontend-dev/2FICMX0ORZ6O1.3DYXRTDHNGXCN%408pit.net.
What would be the benefit of using .uc_regs instead of .regs? The current code works entirely fine as it, it just needs an include of the Linux Kernel header defining the pt_regs type (which my proposed patch adds). Furthermore, it seems to me that .uc_regs is only available on powerpc but not on power64 [1]? musl libc also only defines the .uc_regs member for powerpc [2] and not for powerpc64 [3] on ucontext_t. Is there any documentation for .uc_regs on PowerPC? Sincerely, Sören [1]: https://github.com/torvalds/linux/blob/c3617f72036c909e1f6086b5b9e364e0ef90a6da/arch/powerpc/include/uapi/asm/ucontext.h#L24-L27 [2]: https://git.musl-libc.org/cgit/musl/tree/arch/powerpc/bits/signal.h?id=f8bdc3048216f41eaaf655524fa286cfb1184a70#n67 [3]: https://git.musl-libc.org/cgit/musl/tree/arch/powerpc64/bits/signal.h?id=f8bdc3048216f41eaaf655524fa286cfb1184a70#n56 Ian Lance Taylor <iant@golang.org> wrote: > Note for gofrontend-dev: on gcc-patches only Andreas Schwab suggested > using uc_regs instead of regs, which does look correct to me. > > Ian > > On Mon, Feb 21, 2022 at 8:47 AM Sören Tempel <soeren@soeren-tempel.net> wrote: > > > > Ping. > > > > Summary: Fix build of libgo on PPC with musl libc and libucontext by > > explicitly including the Linux header defining `struct pt_regs` instead of > > relying on other libc headers to include it implicitly. > > > > See: https://gcc.gnu.org/pipermail/gcc-patches/2022-January/587520.html > > > > If the patch needs to be revised further please let me know. This patch has > > been applied at Alpine Linux downstream (which uses musl libc) for a while, I > > have not tested it on other systems. > > > > Greetings, > > Sören > > > > Sören Tempel <soeren@soeren-tempel.net> wrote: > > > Both glibc and musl libc declare pt_regs as an incomplete type. This > > > type has to be completed by inclusion of another header. On Linux, the > > > asm/ptrace.h header file provides this type definition. Without > > > including this header file, it is not possible to access the regs member > > > of the mcontext_t struct as done in libgo/runtime/go-signal.c. On glibc, > > > other headers (e.g. sys/user.h) include asm/ptrace.h but on musl > > > asm/ptrace.h is not included by other headers and thus the > > > aforementioned files do not compile without an explicit include of > > > asm/ptrace.h: > > > > > > libgo/runtime/go-signal.c: In function 'getSiginfo': > > > libgo/runtime/go-signal.c:227:63: error: invalid use of undefined type 'struct pt_regs' > > > 227 | ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.regs->nip; > > > | > > > > > > See also: > > > > > > * https://git.musl-libc.org/cgit/musl/commit/?id=c2518a8efb6507f1b41c3b12e03b06f8f2317a1f > > > * https://github.com/kaniini/libucontext/issues/36 > > > > > > Signed-off-by: Sören Tempel <soeren@soeren-tempel.net> > > > > > > ChangeLog: > > > > > > * libgo/runtime/go-signal.c: Include asm/ptrace.h for the > > > definition of pt_regs (used by mcontext_t) on PowerPC. > > > --- > > > libgo/runtime/go-signal.c | 6 ++++++ > > > 1 file changed, 6 insertions(+) > > > > > > diff --git a/libgo/runtime/go-signal.c b/libgo/runtime/go-signal.c > > > index d30d1603adc..fc01e04e4a1 100644 > > > --- a/libgo/runtime/go-signal.c > > > +++ b/libgo/runtime/go-signal.c > > > @@ -10,6 +10,12 @@ > > > #include <sys/time.h> > > > #include <ucontext.h> > > > > > > +// On PowerPC, ucontext.h uses a pt_regs struct as an incomplete > > > +// type. This type must be completed by including asm/ptrace.h. > > > +#ifdef __PPC__ > > > +#include <asm/ptrace.h> > > > +#endif > > > + > > > #include "runtime.h" > > > > > > #ifndef SA_RESTART > > > > -- > > You received this message because you are subscribed to the Google Groups "gofrontend-dev" group. > > To unsubscribe from this group and stop receiving emails from it, send an email to gofrontend-dev+unsubscribe@googlegroups.com. > > To view this discussion on the web visit https://groups.google.com/d/msgid/gofrontend-dev/2FICMX0ORZ6O1.3DYXRTDHNGXCN%408pit.net.
On Mon, Feb 21, 2022 at 09:25:43AM -0800, Ian Lance Taylor via Gcc-patches wrote: > Note for gofrontend-dev: on gcc-patches only Andreas Schwab suggested > using uc_regs instead of regs, which does look correct to me. Yes, this is absolutely the correct fix. Having pt_regs appear at all in code not using ptrace is a serious code smell. The root of this problem is twofold: (1) ancient Linux (2.0.x?) had a bad definition of powerpc32 ucontext_t that lacked any mcontext_t, instead having a regs member pointing to the storage for the register state (as pt_regs). This was ostensibly done for extensibility reasons, but was non-POSIX-conforming and broken, and was later fixed. And (2) glibc's definition of ucontext_t is also non-conforming, making the uc_mcontext member have type anon-union rather than type mcontext_t. musl does not follow this but puts the uc_mcontext member in the place later kernel ABI assigned to it after the kernel mistake was fixed. Ideally you would access uc_mcontext.gregs[32] (32==NIP) and be done with it, but this won't work on glibc because of (2). However musl also supports the old uc_regs pointer (it's in the reserved namespace anyway so not a conformance error), making it so uc_regs->gregs[32] works on either. Rich > On Mon, Feb 21, 2022 at 8:47 AM Sören Tempel <soeren@soeren-tempel.net> wrote: > > > > Ping. > > > > Summary: Fix build of libgo on PPC with musl libc and libucontext by > > explicitly including the Linux header defining `struct pt_regs` instead of > > relying on other libc headers to include it implicitly. > > > > See: https://gcc.gnu.org/pipermail/gcc-patches/2022-January/587520.html > > > > If the patch needs to be revised further please let me know. This patch has > > been applied at Alpine Linux downstream (which uses musl libc) for a while, I > > have not tested it on other systems. > > > > Greetings, > > Sören > > > > Sören Tempel <soeren@soeren-tempel.net> wrote: > > > Both glibc and musl libc declare pt_regs as an incomplete type. This > > > type has to be completed by inclusion of another header. On Linux, the > > > asm/ptrace.h header file provides this type definition. Without > > > including this header file, it is not possible to access the regs member > > > of the mcontext_t struct as done in libgo/runtime/go-signal.c. On glibc, > > > other headers (e.g. sys/user.h) include asm/ptrace.h but on musl > > > asm/ptrace.h is not included by other headers and thus the > > > aforementioned files do not compile without an explicit include of > > > asm/ptrace.h: > > > > > > libgo/runtime/go-signal.c: In function 'getSiginfo': > > > libgo/runtime/go-signal.c:227:63: error: invalid use of undefined type 'struct pt_regs' > > > 227 | ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.regs->nip; > > > | > > > > > > See also: > > > > > > * https://git.musl-libc.org/cgit/musl/commit/?id=c2518a8efb6507f1b41c3b12e03b06f8f2317a1f > > > * https://github.com/kaniini/libucontext/issues/36 > > > > > > Signed-off-by: Sören Tempel <soeren@soeren-tempel.net> > > > > > > ChangeLog: > > > > > > * libgo/runtime/go-signal.c: Include asm/ptrace.h for the > > > definition of pt_regs (used by mcontext_t) on PowerPC. > > > --- > > > libgo/runtime/go-signal.c | 6 ++++++ > > > 1 file changed, 6 insertions(+) > > > > > > diff --git a/libgo/runtime/go-signal.c b/libgo/runtime/go-signal.c > > > index d30d1603adc..fc01e04e4a1 100644 > > > --- a/libgo/runtime/go-signal.c > > > +++ b/libgo/runtime/go-signal.c > > > @@ -10,6 +10,12 @@ > > > #include <sys/time.h> > > > #include <ucontext.h> > > > > > > +// On PowerPC, ucontext.h uses a pt_regs struct as an incomplete > > > +// type. This type must be completed by including asm/ptrace.h. > > > +#ifdef __PPC__ > > > +#include <asm/ptrace.h> > > > +#endif > > > + > > > #include "runtime.h" > > > > > > #ifndef SA_RESTART > > > > -- > > You received this message because you are subscribed to the Google Groups "gofrontend-dev" group. > > To unsubscribe from this group and stop receiving emails from it, send an email to gofrontend-dev+unsubscribe@googlegroups.com. > > To view this discussion on the web visit https://groups.google.com/d/msgid/gofrontend-dev/2FICMX0ORZ6O1.3DYXRTDHNGXCN%408pit.net.
On Sun, Mar 06, 2022 at 10:22:56AM -0500, Rich Felker wrote: > On Mon, Feb 21, 2022 at 09:25:43AM -0800, Ian Lance Taylor via Gcc-patches wrote: > > Note for gofrontend-dev: on gcc-patches only Andreas Schwab suggested > > using uc_regs instead of regs, which does look correct to me. > > Yes, this is absolutely the correct fix. Having pt_regs appear at all > in code not using ptrace is a serious code smell. > > The root of this problem is twofold: (1) ancient Linux (2.0.x?) had a > bad definition of powerpc32 ucontext_t that lacked any mcontext_t, > instead having a regs member pointing to the storage for the register > state (as pt_regs). This was ostensibly done for extensibility > reasons, but was non-POSIX-conforming and broken, and was later fixed. > > And (2) glibc's definition of ucontext_t is also non-conforming, > making the uc_mcontext member have type anon-union rather than type > mcontext_t. > > musl does not follow this but puts the uc_mcontext member in the place > later kernel ABI assigned to it after the kernel mistake was fixed. > > Ideally you would access uc_mcontext.gregs[32] (32==NIP) and be done > with it, but this won't work on glibc because of (2). However musl > also supports the old uc_regs pointer (it's in the reserved namespace > anyway so not a conformance error), making it so uc_regs->gregs[32] > works on either. I mistakenly thought this was ppc32 because I wasn't remembering that a lesser mess was still present on ppc64. The above applies to ppc32. On ppc64 it would be uc_mcontext.gp_regs[32]. I'm not sure if the code is intended to also work on ppc32, but even if that's not supported now, when fixing this it should probably condition the use of gregs/gp_regs name on __WORDSIZE or whatever so that, if anyone ever does try to add ppc32 support, they don't get bogged down in this again and get it wrong again... Rich > > On Mon, Feb 21, 2022 at 8:47 AM Sören Tempel <soeren@soeren-tempel.net> wrote: > > > > > > Ping. > > > > > > Summary: Fix build of libgo on PPC with musl libc and libucontext by > > > explicitly including the Linux header defining `struct pt_regs` instead of > > > relying on other libc headers to include it implicitly. > > > > > > See: https://gcc.gnu.org/pipermail/gcc-patches/2022-January/587520.html > > > > > > If the patch needs to be revised further please let me know. This patch has > > > been applied at Alpine Linux downstream (which uses musl libc) for a while, I > > > have not tested it on other systems. > > > > > > Greetings, > > > Sören > > > > > > Sören Tempel <soeren@soeren-tempel.net> wrote: > > > > Both glibc and musl libc declare pt_regs as an incomplete type. This > > > > type has to be completed by inclusion of another header. On Linux, the > > > > asm/ptrace.h header file provides this type definition. Without > > > > including this header file, it is not possible to access the regs member > > > > of the mcontext_t struct as done in libgo/runtime/go-signal.c. On glibc, > > > > other headers (e.g. sys/user.h) include asm/ptrace.h but on musl > > > > asm/ptrace.h is not included by other headers and thus the > > > > aforementioned files do not compile without an explicit include of > > > > asm/ptrace.h: > > > > > > > > libgo/runtime/go-signal.c: In function 'getSiginfo': > > > > libgo/runtime/go-signal.c:227:63: error: invalid use of undefined type 'struct pt_regs' > > > > 227 | ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.regs->nip; > > > > | > > > > > > > > See also: > > > > > > > > * https://git.musl-libc.org/cgit/musl/commit/?id=c2518a8efb6507f1b41c3b12e03b06f8f2317a1f > > > > * https://github.com/kaniini/libucontext/issues/36 > > > > > > > > Signed-off-by: Sören Tempel <soeren@soeren-tempel.net> > > > > > > > > ChangeLog: > > > > > > > > * libgo/runtime/go-signal.c: Include asm/ptrace.h for the > > > > definition of pt_regs (used by mcontext_t) on PowerPC. > > > > --- > > > > libgo/runtime/go-signal.c | 6 ++++++ > > > > 1 file changed, 6 insertions(+) > > > > > > > > diff --git a/libgo/runtime/go-signal.c b/libgo/runtime/go-signal.c > > > > index d30d1603adc..fc01e04e4a1 100644 > > > > --- a/libgo/runtime/go-signal.c > > > > +++ b/libgo/runtime/go-signal.c > > > > @@ -10,6 +10,12 @@ > > > > #include <sys/time.h> > > > > #include <ucontext.h> > > > > > > > > +// On PowerPC, ucontext.h uses a pt_regs struct as an incomplete > > > > +// type. This type must be completed by including asm/ptrace.h. > > > > +#ifdef __PPC__ > > > > +#include <asm/ptrace.h> > > > > +#endif > > > > + > > > > #include "runtime.h" > > > > > > > > #ifndef SA_RESTART > > > > > > -- > > > You received this message because you are subscribed to the Google Groups "gofrontend-dev" group. > > > To unsubscribe from this group and stop receiving emails from it, send an email to gofrontend-dev+unsubscribe@googlegroups.com. > > > To view this discussion on the web visit https://groups.google.com/d/msgid/gofrontend-dev/2FICMX0ORZ6O1.3DYXRTDHNGXCN%408pit.net.
diff --git a/libgo/runtime/go-signal.c b/libgo/runtime/go-signal.c index d30d1603adc..fc01e04e4a1 100644 --- a/libgo/runtime/go-signal.c +++ b/libgo/runtime/go-signal.c @@ -10,6 +10,12 @@ #include <sys/time.h> #include <ucontext.h> +// On PowerPC, ucontext.h uses a pt_regs struct as an incomplete +// type. This type must be completed by including asm/ptrace.h. +#ifdef __PPC__ +#include <asm/ptrace.h> +#endif + #include "runtime.h" #ifndef SA_RESTART