From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qv1-xf36.google.com (mail-qv1-xf36.google.com [IPv6:2607:f8b0:4864:20::f36]) by sourceware.org (Postfix) with ESMTPS id 241EC3858D3C for ; Sun, 23 Jan 2022 09:06:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 241EC3858D3C Received: by mail-qv1-xf36.google.com with SMTP id g13so13964612qvw.4 for ; Sun, 23 Jan 2022 01:06:28 -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; bh=6sL7xcB519ef+0xgHHw8ZL83bC5GpFt5Axr/ufJIxog=; b=3iqpDuzJJol7B5u02aBhvrDybWoepRHCgQ7G8AZqUMfPlmgUuIt4fywGILeF6S/R7O Qm3Jxa0+iWOOQEk0H8PAMtbo4IvhrkMVh6Qxn0cM2IBERuyc4V+cGI9EQqrfFI63pRTI OjmTEoT51htrBcePvZgFb73k4OQIabCGAmQMoPXl/3Z+AVK+uk06HbWQlU7GxzGIBXC/ DKKwJRWXDGxaHoRwQOj9wpaCKW95rNcbZFkrn/ecka910rwOSjz4te9Dyd/EUepLcFwt pj8GA7IPEJ8UhHQY9bd346zB32wVhZoAsVdPHsWOQ2CfI75kMqiCupFKRYqZLTZ3Pn1K 5rHA== X-Gm-Message-State: AOAM532UTGQ4YICiOnjoEyyLN1zq4CuJMEeNGA6xjKw9dmWFGxz8JAUU ed+8Qg0dhJ/P6W+PGjT3AkPEy8UOmoXs+1SmIjBU2QP7 X-Google-Smtp-Source: ABdhPJwPscMMNweBjp0J/KKbxxhEZk5BcNe3cgUihH5RbDRdpp0dEE1R+O0wrMiPrxJdXyEILPLGT7i1mlnMBzUVrQY= X-Received: by 2002:a05:6214:76c:: with SMTP id f12mr10364402qvz.2.1642928786683; Sun, 23 Jan 2022 01:06:26 -0800 (PST) MIME-Version: 1.0 References: <20211218104317.23622-1-soeren@soeren-tempel.net> <463eb1a5-bdfb-62e0-023f-d7f9438cf0a4@suse.cz> <20220122121638.GX2646553@tucnak> <20220122180348.GZ2646553@tucnak> In-Reply-To: <20220122180348.GZ2646553@tucnak> From: Uros Bizjak Date: Sun, 23 Jan 2022 10:06:24 +0100 Message-ID: Subject: Re: [PATCH] Disable -fsplit-stack support on non-glibc targets To: Jakub Jelinek Cc: =?UTF-8?Q?Martin_Li=C5=A1ka?= , "gcc-patches@gcc.gnu.org" , soeren@soeren-tempel.net Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jan 2022 09:06:30 -0000 On Sat, Jan 22, 2022 at 7:04 PM Jakub Jelinek via Gcc-patches wrote: > > On Sat, Jan 22, 2022 at 01:16:38PM +0100, Jakub Jelinek via Gcc-patches wrote: > > Actually, I suspect we either need something like following patch, > > or need to change gcc/config/{linux,rs6000/linux{,64},alpha/linux}.h > > so that next to those OPTION_GLIBC etc. macros it also defines versions > > of those macros with opts argument. > > And here is a larger but perhaps cleaner patch that matches how e.g. > options.h defines TARGET_WHATEVER_P(opts) options and then TARGET_WHATEVER > too. > > Only compile tested on x86_64-linux so far. > > 2022-01-22 Jakub Jelinek > > * config/linux.h (OPTION_GLIBC_P, OPTION_UCLIBC_P, > OPTION_BIONIC_P, OPTION_MUSL_P): Define. > (OPTION_GLIBC, OPTION_UCLIBC, OPTION_BIONIC, OPTION_MUSL): Redefine > using OPTION_*_P macros. > * config/alpha/linux.h (OPTION_GLIBC_P, OPTION_UCLIBC_P, > OPTION_BIONIC_P, OPTION_MUSL_P): Define. > (OPTION_GLIBC, OPTION_UCLIBC, OPTION_BIONIC, OPTION_MUSL): Redefine > using OPTION_*_P macros. > * config/rs6000/linux.h (OPTION_GLIBC_P, OPTION_UCLIBC_P, > OPTION_BIONIC_P, OPTION_MUSL_P): Define. > (OPTION_GLIBC, OPTION_UCLIBC, OPTION_BIONIC, OPTION_MUSL): Redefine > using OPTION_*_P macros. > * config/rs6000/linux64.h (OPTION_GLIBC_P, OPTION_UCLIBC_P, > OPTION_BIONIC_P, OPTION_MUSL_P): Define. > (OPTION_GLIBC, OPTION_UCLIBC, OPTION_BIONIC, OPTION_MUSL): Redefine > using OPTION_*_P macros. > * config/fuchsia.h (OPTION_MUSL_P): Redefine. > * config/glibc-stdint.h (OPTION_MUSL_P): Define if not defined. > * common/config/s390/s390-common.cc (s390_supports_split_stack): Re-add > ATTRIBUTE_UNUSED to opts parameter. If OPTION_GLIBC_P is defined, use > OPTION_GLIBC_P (opts) as condition, otherwise assume if (false). > * common/config/i386/i386-common.cc (ix86_supports_split_stack): If > OPTION_GLIBC_P is defined use !OPTION_GLIBC_P (opts) as condition, > otherwise assume if (true). I wonder why every target defines its own set of #defines. I'd expect that they include toplevel gcc/config/linux.h and inherit these defines from it. Uros. > > --- gcc/config/linux.h.jj 2022-01-18 11:58:59.160988086 +0100 > +++ gcc/config/linux.h 2022-01-22 18:42:25.476235564 +0100 > @@ -29,18 +29,23 @@ see the files COPYING3 and COPYING.RUNTI > > /* C libraries supported on Linux. */ > #ifdef SINGLE_LIBC > -#define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC) > -#define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC) > -#define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC) > -#undef OPTION_MUSL > -#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL) > +#define OPTION_GLIBC_P(opts) (DEFAULT_LIBC == LIBC_GLIBC) > +#define OPTION_UCLIBC_P(opts) (DEFAULT_LIBC == LIBC_UCLIBC) > +#define OPTION_BIONIC_P(opts) (DEFAULT_LIBC == LIBC_BIONIC) > +#undef OPTION_MUSL_P > +#define OPTION_MUSL_P(opts) (DEFAULT_LIBC == LIBC_MUSL) > #else > -#define OPTION_GLIBC (linux_libc == LIBC_GLIBC) > -#define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC) > -#define OPTION_BIONIC (linux_libc == LIBC_BIONIC) > -#undef OPTION_MUSL > -#define OPTION_MUSL (linux_libc == LIBC_MUSL) > +#define OPTION_GLIBC_P(opts) ((opts)->x_linux_libc == LIBC_GLIBC) > +#define OPTION_UCLIBC_P(opts) ((opts)->x_linux_libc == LIBC_UCLIBC) > +#define OPTION_BIONIC_P(opts) ((opts)->x_linux_libc == LIBC_BIONIC) > +#undef OPTION_MUSL_P > +#define OPTION_MUSL_P(opts) ((opts)->x_linux_libc == LIBC_MUSL) > #endif > +#define OPTION_GLIBC OPTION_GLIBC_P (&global_options) > +#define OPTION_UCLIBC OPTION_UCLIBC_P (&global_options) > +#define OPTION_BIONIC OPTION_BIONIC_P (&global_options) > +#undef OPTION_MUSL > +#define OPTION_MUSL OPTION_MUSL_P (&global_options) > > #define GNU_USER_TARGET_OS_CPP_BUILTINS() \ > do { \ > --- gcc/config/alpha/linux.h.jj 2022-01-11 23:11:21.692299963 +0100 > +++ gcc/config/alpha/linux.h 2022-01-22 18:43:59.739923743 +0100 > @@ -58,18 +58,23 @@ along with GCC; see the file COPYING3. > #define WCHAR_TYPE "int" > > #ifdef SINGLE_LIBC > -#define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC) > -#define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC) > -#define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC) > -#undef OPTION_MUSL > -#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL) > +#define OPTION_GLIBC_P(opts) (DEFAULT_LIBC == LIBC_GLIBC) > +#define OPTION_UCLIBC_P(opts) (DEFAULT_LIBC == LIBC_UCLIBC) > +#define OPTION_BIONIC_P(opts) (DEFAULT_LIBC == LIBC_BIONIC) > +#undef OPTION_MUSL_P > +#define OPTION_MUSL_P(opts) (DEFAULT_LIBC == LIBC_MUSL) > #else > -#define OPTION_GLIBC (linux_libc == LIBC_GLIBC) > -#define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC) > -#define OPTION_BIONIC (linux_libc == LIBC_BIONIC) > -#undef OPTION_MUSL > -#define OPTION_MUSL (linux_libc == LIBC_MUSL) > +#define OPTION_GLIBC_P(opts) ((opts)->x_linux_libc == LIBC_GLIBC) > +#define OPTION_UCLIBC_P(opts) ((opts)->x_linux_libc == LIBC_UCLIBC) > +#define OPTION_BIONIC_P(opts) ((opts)->x_linux_libc == LIBC_BIONIC) > +#undef OPTION_MUSL_P > +#define OPTION_MUSL_P(opts) ((opts)->x_linux_libc == LIBC_MUSL) > #endif > +#define OPTION_GLIBC OPTION_GLIBC_P (&global_options) > +#define OPTION_UCLIBC OPTION_UCLIBC_P (&global_options) > +#define OPTION_BIONIC OPTION_BIONIC_P (&global_options) > +#undef OPTION_MUSL > +#define OPTION_MUSL OPTION_MUSL_P (&global_options) > > /* Determine what functions are present at the runtime; > this includes full c99 runtime and sincos. */ > --- gcc/config/rs6000/linux.h.jj 2022-01-11 23:11:21.939296492 +0100 > +++ gcc/config/rs6000/linux.h 2022-01-22 18:42:59.834757410 +0100 > @@ -27,18 +27,23 @@ > #define NO_PROFILE_COUNTERS 1 > > #ifdef SINGLE_LIBC > -#define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC) > -#define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC) > -#define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC) > -#undef OPTION_MUSL > -#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL) > +#define OPTION_GLIBC_P(opts) (DEFAULT_LIBC == LIBC_GLIBC) > +#define OPTION_UCLIBC_P(opts) (DEFAULT_LIBC == LIBC_UCLIBC) > +#define OPTION_BIONIC_P(opts) (DEFAULT_LIBC == LIBC_BIONIC) > +#undef OPTION_MUSL_P > +#define OPTION_MUSL_P(opts) (DEFAULT_LIBC == LIBC_MUSL) > #else > -#define OPTION_GLIBC (linux_libc == LIBC_GLIBC) > -#define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC) > -#define OPTION_BIONIC (linux_libc == LIBC_BIONIC) > -#undef OPTION_MUSL > -#define OPTION_MUSL (linux_libc == LIBC_MUSL) > +#define OPTION_GLIBC_P(opts) ((opts)->x_linux_libc == LIBC_GLIBC) > +#define OPTION_UCLIBC_P(opts) ((opts)->x_linux_libc == LIBC_UCLIBC) > +#define OPTION_BIONIC_P(opts) ((opts)->x_linux_libc == LIBC_BIONIC) > +#undef OPTION_MUSL_P > +#define OPTION_MUSL_P(opts) ((opts)->x_linux_libc == LIBC_MUSL) > #endif > +#define OPTION_GLIBC OPTION_GLIBC_P (&global_options) > +#define OPTION_UCLIBC OPTION_UCLIBC_P (&global_options) > +#define OPTION_BIONIC OPTION_BIONIC_P (&global_options) > +#undef OPTION_MUSL > +#define OPTION_MUSL OPTION_MUSL_P (&global_options) > > /* Determine what functions are present at the runtime; > this includes full c99 runtime and sincos. */ > --- gcc/config/rs6000/linux64.h.jj 2022-01-11 23:11:21.939296492 +0100 > +++ gcc/config/rs6000/linux64.h 2022-01-22 18:43:37.830228647 +0100 > @@ -265,18 +265,23 @@ extern int dot_symbols; > #define OS_MISSING_POWERPC64 !TARGET_64BIT > > #ifdef SINGLE_LIBC > -#define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC) > -#define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC) > -#define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC) > -#undef OPTION_MUSL > -#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL) > +#define OPTION_GLIBC_P(opts) (DEFAULT_LIBC == LIBC_GLIBC) > +#define OPTION_UCLIBC_P(opts) (DEFAULT_LIBC == LIBC_UCLIBC) > +#define OPTION_BIONIC_P(opts) (DEFAULT_LIBC == LIBC_BIONIC) > +#undef OPTION_MUSL_P > +#define OPTION_MUSL_P(opts) (DEFAULT_LIBC == LIBC_MUSL) > #else > -#define OPTION_GLIBC (linux_libc == LIBC_GLIBC) > -#define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC) > -#define OPTION_BIONIC (linux_libc == LIBC_BIONIC) > -#undef OPTION_MUSL > -#define OPTION_MUSL (linux_libc == LIBC_MUSL) > +#define OPTION_GLIBC_P(opts) ((opts)->x_linux_libc == LIBC_GLIBC) > +#define OPTION_UCLIBC_P(opts) ((opts)->x_linux_libc == LIBC_UCLIBC) > +#define OPTION_BIONIC_P(opts) ((opts)->x_linux_libc == LIBC_BIONIC) > +#undef OPTION_MUSL_P > +#define OPTION_MUSL_P(opts) ((opts)->x_linux_libc == LIBC_MUSL) > #endif > +#define OPTION_GLIBC OPTION_GLIBC_P (&global_options) > +#define OPTION_UCLIBC OPTION_UCLIBC_P (&global_options) > +#define OPTION_BIONIC OPTION_BIONIC_P (&global_options) > +#undef OPTION_MUSL > +#define OPTION_MUSL OPTION_MUSL_P (&global_options) > > /* Determine what functions are present at the runtime; > this includes full c99 runtime and sincos. */ > --- gcc/config/fuchsia.h.jj 2022-01-11 23:11:21.750299147 +0100 > +++ gcc/config/fuchsia.h 2022-01-22 18:49:53.927996890 +0100 > @@ -52,6 +52,8 @@ along with GCC; see the file COPYING3. > /* We are using MUSL as our libc. */ > #undef OPTION_MUSL > #define OPTION_MUSL 1 > +#undef OPTION_MUSL_P > +#define OPTION_MUSL_P(opts) 1 > > #ifndef TARGET_SUB_OS_CPP_BUILTINS > #define TARGET_SUB_OS_CPP_BUILTINS() > --- gcc/config/glibc-stdint.h.jj 2022-01-11 23:11:21.753299105 +0100 > +++ gcc/config/glibc-stdint.h 2022-01-22 18:49:53.928996876 +0100 > @@ -27,6 +27,9 @@ see the files COPYING3 and COPYING.RUNTI > #ifndef OPTION_MUSL > #define OPTION_MUSL 0 > #endif > +#ifndef OPTION_MUSL_P > +#define OPTION_MUSL_P(opts) 0 > +#endif > > #define SIG_ATOMIC_TYPE "int" > > --- gcc/common/config/s390/s390-common.cc.jj 2022-01-22 18:37:18.701504795 +0100 > +++ gcc/common/config/s390/s390-common.cc 2022-01-22 18:39:09.820958400 +0100 > @@ -121,10 +121,12 @@ s390_handle_option (struct gcc_options * > > static bool > s390_supports_split_stack (bool report, > - struct gcc_options *opts) > + struct gcc_options *opts ATTRIBUTE_UNUSED) > { > - if (opts->x_linux_libc == LIBC_GLIBC) > +#ifdef OPTION_GLIBC_P > + if (OPTION_GLIBC_P (opts)) > return true; > +#endif > > if (report) > error ("%<-fsplit-stack%> currently only supported on GNU/Linux"); > --- gcc/common/config/i386/i386-common.cc.jj 2022-01-22 18:37:18.700504809 +0100 > +++ gcc/common/config/i386/i386-common.cc 2022-01-22 18:39:09.821958386 +0100 > @@ -1717,8 +1717,8 @@ static bool > ix86_supports_split_stack (bool report, > struct gcc_options *opts ATTRIBUTE_UNUSED) > { > -#ifdef TARGET_THREAD_SPLIT_STACK_OFFSET > - if (opts->x_linux_libc != LIBC_GLIBC) > +#if defined(TARGET_THREAD_SPLIT_STACK_OFFSET) && defined(OPTION_GLIBC_P) > + if (!OPTION_GLIBC_P (opts)) > #endif > { > if (report) > > > Jakub >