From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by sourceware.org (Postfix) with ESMTPS id 068E3385C41D for ; Mon, 21 Feb 2022 17:25:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 068E3385C41D Received: by mail-ed1-x535.google.com with SMTP id u18so30847835edt.6 for ; Mon, 21 Feb 2022 09:25:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=GWiXQfGORuce1ZfzcruvFqk4skXGnSNRzLuQc1dBQdo=; b=pJGcvIn4t22axboWL6+KKEotxewrmFEjHoWEuw6YWdXGTcDZBJmUD4Kyy3q1zDbbRJ q/XdmWU75ObVXvLGphypZvblY1p0xIwzOSKevgHBOfPmp7emgMAwzN3jlNbCpYrFIS51 isAho9TKgUfljBMSpa1GNZcqyyM9PK6+KJr2FkXAWJ1tJ/rL+iy6243H3Rt0RXPJg8xS K1SbwEC+fskbaqNsI5dsVkYFYEvFYb+9o3Y53Flu9m7hxJyePQrKi8Be1B2XHYGFovlY yExoozOKEm7J6O6Pm/jUbxBAwwrc8LWS1Fystwz57lsUBQndReg+67d/PHIvz1F5gdUo OtjA== X-Gm-Message-State: AOAM532haEnMSvWopBinX/SgZKWwFBIBlhJWz0Zc15a5RGVkD/DcP81a wSyusvDy2AET0ynXrKaTdDoEhBAGRn197UWs/qZSIA== X-Google-Smtp-Source: ABdhPJyrNb9KvUKHzlDdRGIqSRKU3BzOfq3+z9q6wRblfZtWwE220uRxx9yf+ALMP7v4XzQ3lVL0whe/BBNVcPhBV/k= X-Received: by 2002:a05:6402:424b:b0:40f:1386:5fa6 with SMTP id g11-20020a056402424b00b0040f13865fa6mr22631378edb.268.1645464353943; Mon, 21 Feb 2022 09:25:53 -0800 (PST) MIME-Version: 1.0 References: <20220102163713.26299-1-soeren@soeren-tempel.net> <2FICMX0ORZ6O1.3DYXRTDHNGXCN@8pit.net> In-Reply-To: <2FICMX0ORZ6O1.3DYXRTDHNGXCN@8pit.net> From: Ian Lance Taylor Date: Mon, 21 Feb 2022 09:25:43 -0800 Message-ID: Subject: Re: [gofrontend-dev] Re: [PATCH] libgo: include asm/ptrace.h for pt_regs definition on PowerPC To: =?UTF-8?Q?S=C3=B6ren_Tempel?= Cc: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Feb 2022 17:25:57 -0000 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=C3=B6ren Tempel 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 o= f > 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 h= as > been applied at Alpine Linux downstream (which uses musl libc) for a whil= e, I > have not tested it on other systems. > > Greetings, > S=C3=B6ren > > S=C3=B6ren Tempel 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 membe= r > > 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 =3D ((ucontext_t*)(context))->uc_mconte= xt.regs->nip; > > | > > > > See also: > > > > * https://git.musl-libc.org/cgit/musl/commit/?id=3Dc2518a8efb6507f1b41c= 3b12e03b06f8f2317a1f > > * https://github.com/kaniini/libucontext/issues/36 > > > > Signed-off-by: S=C3=B6ren Tempel > > > > 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 > > #include > > > > +// 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 > > +#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/msgi= d/gofrontend-dev/2FICMX0ORZ6O1.3DYXRTDHNGXCN%408pit.net.