From patchwork Wed Feb 23 10:13:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Pan2 via Gcc-patches" X-Patchwork-Id: 51328 Return-Path: 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 963D539484A2 for ; Wed, 23 Feb 2022 10:13:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 963D539484A2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1645611226; bh=9vFMl+ifQSZB2sEHvmfW/wb4rghCumtsJe+2Gb9ClUg=; h=Subject:To:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=hNrwZuZBTdscq4/go8iicmKy8aZN7qkIU1c1o/xNNZVerSJznj0fwLOlqYkJ1vj5T TNd66YaqzEyM/VyUmaampwvSpQ359+07Refi1XvwdQyXnfa1fMljYYoIIujXrQcu6m 1ST1uDTZ1kVJPcGk0Z1Uv6ms8w43HzPxMAapqC3U= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by sourceware.org (Postfix) with ESMTPS id 0F9EC385AC3D for ; Wed, 23 Feb 2022 10:13:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0F9EC385AC3D Received: by mail-lj1-x22f.google.com with SMTP id r20so23849754ljj.1 for ; Wed, 23 Feb 2022 02:13:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:subject:from:reply-to:to:cc:date :organization:user-agent:mime-version; bh=9vFMl+ifQSZB2sEHvmfW/wb4rghCumtsJe+2Gb9ClUg=; b=Ip8xYq+UGMYeUV1nLf0qtNjCyVhTIKS6sxxYLcDX8tDZtC5VcklrbENM5CcUEDs23+ UhxSQoJX3b1UE552aI7q+cC5OigPA+hlvwECJWBioq+5Vy3YWUCVrTe2LJiCI7cFHK72 alKLnKM1kaziXIWoq6wXnBhttMnWoiXYXMJJcYkY7C2orPLLxyEz7k5S6GXvCrihi6Cu 0u1BsksSQ2gKc3e2vLqN9AfiZPLQd4EtQQqKZku6PVoTh70QU02jWtxfCyfEyEu4gB6N keTg5rJTPtJLKlcAIB64EhVPNIVJRuGLD2Y5679HorWlfPulC4C8T5mj/L+eZdl8G8U0 HZYA== X-Gm-Message-State: AOAM533RpBNy1jTGk3ZnjOR42fKBNO9udQZCm9l+przCNlimURp9E0O2 0bEpjs3sr7PQXZA6i9kCDLmix9qd/xBOCw== X-Google-Smtp-Source: ABdhPJz4oxvgeCVAA+nyoupTAHBsZzQKIeLnji6BUENrJfR/8Da+WmL/X4D526oE6b22Pd6rwE2JSg== X-Received: by 2002:a2e:a786:0:b0:246:215e:a0c1 with SMTP id c6-20020a2ea786000000b00246215ea0c1mr18192256ljf.118.1645611195437; Wed, 23 Feb 2022 02:13:15 -0800 (PST) Received: from G3620.lan (178-78-231-178.customers.ownit.se. [178.78.231.178]) by smtp.gmail.com with ESMTPSA id a5sm2043575ljd.16.2022.02.23.02.13.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Feb 2022 02:13:14 -0800 (PST) Message-ID: Subject: [PATCH] gcc-12: Re-enable split-stack support for GNU/Hurd. To: gcc-patches Date: Wed, 23 Feb 2022 11:13:50 +0100 Organization: Home User-Agent: Evolution 3.30.5-1.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, 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-Patchwork-Original-From: Svante Signell via Gcc-patches From: "Li, Pan2 via Gcc-patches" Reply-To: svante.signell@gmail.com Cc: Ian Lance Taylor Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hello, In line of porting the latest build of libgo/go with gcc-12 to GNU/Hurd, support of split-stack was found to be removed. After patching the files in libgo the build of gotools fails: go1: error: '-fsplit-stack' currently only supported on GNU/Linux go1: error: '-fsplit-stack' is not supported by this compiler configuration The attached patch defines OPTION_GLIBC_P(opts) and OPTION_GLIBC that was lost in config/gnu.h, needed to enable split-stack support for GNU/Hurd. This problem happened with the latest commit as discussed in the mail thread starting with https://gcc.gnu.org/pipermail/gcc-patches/2022-January/588973.html . The file first doing this check is: (first error: ..) src/gcc/common/config/i386/i386-common.cc in function: static bool ix86_supports_split_stack (bool report, struct gcc_options *opts ATTRIBUTE_UNUSED) and secondly in:src/gcc/opts.cc: (second error: ...) in function: void finish_options (struct gcc_options *opts, struct gcc_options *opts_set, location_t loc) The checking logic is in function ix86_supports_split_stack(): #if defined(TARGET_THREAD_SPLIT_STACK_OFFSET) && defined(OPTION_GLIBC_P) if (!OPTION_GLIBC_P (opts)) #endif { if (report) error ("%<-fsplit-stack%> currently only supported on GNU/Linux"); return false; } bool ret = true; In case of GNU/Hurd TARGET_THREAD_SPLIT_STACK_OFFSET is defined as well as OPTION_GLIBC_P but OPTION_GLIBC_P(opts) is needed to. The attached patch to src/gcc/config/gnu.h creates that definition. For GNU/Hurd, gnu.h is included in the configure stage: Configuring stage 1 in ./gcc ... Using the following target machine macro files: ... ../../src/gcc/config/gnu.h For a longer history about this bug see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104290 Additionally, I would propose the text in gcc/common/config/i386/i386-common.cc to change from: error ("%<-fsplit-stack%> currently only supported on GNU/Linux"); to: error ("%<-fsplit-stack%> currently only supported on GLIBC-based systems"); Thanks! --- a/src/gcc/config/gnu.h 2022-02-06 11:59:41.000000000 +0100 +++ b/src/gcc/config/gnu.h 2022-02-06 12:00:19.000000000 +0100 @@ -19,6 +19,9 @@ along with GCC. If not, see . */ +#define OPTION_GLIBC_P(opts) (DEFAULT_LIBC == LIBC_GLIBC) +#define OPTION_GLIBC OPTION_GLIBC_P (&global_options) + #undef GNU_USER_TARGET_OS_CPP_BUILTINS #define GNU_USER_TARGET_OS_CPP_BUILTINS() \ do { \