From patchwork Mon Nov 1 09:34:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 46890 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 E5FA53857C6F for ; Mon, 1 Nov 2021 09:36:31 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by sourceware.org (Postfix) with ESMTPS id 29AFD3858426 for ; Mon, 1 Nov 2021 09:35:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 29AFD3858426 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rasmusvillemoes.dk Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rasmusvillemoes.dk Received: by mail-lf1-x134.google.com with SMTP id bu18so17994697lfb.0 for ; Mon, 01 Nov 2021 02:35:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=b0LWDUYYEm8HunOBgXUK8W4rsi2nKPd+IxP+z5Pf/yU=; b=cZ0CCSjuaSRbM66SVZR/I2c/3LSEh9r2uAiT2hpCuUixTKjJ7CVOQtHUrTWVj0jlUq uzu1qChz4YKkoJe5It0nGlp6zwVc44WtXl+A55lUxlBUcg2W4QrP6JSnCEpvuis3qVtj j5eRjB7hQHHJBIC8QdemiQg77ac2TwicNOkTc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=b0LWDUYYEm8HunOBgXUK8W4rsi2nKPd+IxP+z5Pf/yU=; b=2Z6m4kSf84WJHj36UVhgDoaEZKDsGza9Q4yZgsEyjiU12P7Yf2BlvVWJtuk5hbHqvG 8OjA4n9/SxqYk1z4sXrkncyb1hr3SI4OkcSrZWgEqoMs0QZ7XwSsEvTiBErSnqcLKKwc oBOA+cS3vGS2/Mj7O1Z89MlE8soWnq+iUz/rg5vQkMbNtZx840d0kyndS+RE5iSkUv86 uRC/CXO7oTcO5TOHKuOINY3mOgcb8hvaqnQeX3rxrsXAiPcYVve8uyiiaGLhWEAU5l0d x3w89iJ6k+NRyJwyA3pe001zovPIe6Ho6qz/wRFQrxu7DjRgBCAKqIGGre/KwDD9qU0z Zc6g== X-Gm-Message-State: AOAM530kGwUJa78Q3w0gnr7Q7e8JTRO4mUpFQMYUkzw/CHwdfLbP2N8r QpXalJE4RfMOVX1NIUmxRxF82Q4X8ufS1zct X-Google-Smtp-Source: ABdhPJyYXZn99j43Qq9LyXeGAAiVmdZYgO8YJgyF6n88KMY2thm6NPVNrZfs0delBDHclza4Zh1KRw== X-Received: by 2002:a05:6512:10cb:: with SMTP id k11mr26955249lfg.617.1635759344890; Mon, 01 Nov 2021 02:35:44 -0700 (PDT) Received: from prevas-ravi.prevas.se ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id e27sm1045296ljo.5.2021.11.01.02.35.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Nov 2021 02:35:44 -0700 (PDT) From: Rasmus Villemoes X-Google-Original-From: Rasmus Villemoes To: Olivier Hainque Subject: [PATCH 1/4] libgcc: remove crt{begin, end}.o from powerpc-wrs-vxworks target Date: Mon, 1 Nov 2021 10:34:53 +0100 Message-Id: <20211101093456.2003236-2-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211101093456.2003236-1-rasmus.villemoes@prevas.dk> References: <20211101093456.2003236-1-rasmus.villemoes@prevas.dk> MIME-Version: 1.0 X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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: , Cc: gcc-patches@gcc.gnu.org, Rasmus Villemoes Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Since commit 78e49fb1bc (Introduce vxworks specific crtstuff support), the generic crtbegin.o/crtend.o have been unnecessary to build. So remove them from extra_parts. This is effectively a revert of commit 9a5b8df70 (libgcc: add crt{begin,end} for powerpc-wrs-vxworks target). libgcc/ * config.host (powerpc-wrs-vxworks): Do not add crtbegin.o and crtend.o to extra_parts. --- libgcc/config.host | 1 - 1 file changed, 1 deletion(-) diff --git a/libgcc/config.host b/libgcc/config.host index 85de83da766..651e63adb23 100644 --- a/libgcc/config.host +++ b/libgcc/config.host @@ -1243,7 +1243,6 @@ powerpc*-wrs-vxworks7*) ;; powerpc-wrs-vxworks*) tmake_file="$tmake_file rs6000/t-ppccomm rs6000/t-savresfgpr t-fdpbit" - extra_parts="$extra_parts crtbegin.o crtend.o" ;; powerpc-*-lynxos*) tmake_file="$tmake_file rs6000/t-lynx t-fdpbit" From patchwork Mon Nov 1 09:34:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 46891 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 76F1F385800B for ; Mon, 1 Nov 2021 09:37:01 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by sourceware.org (Postfix) with ESMTPS id 161A73858427 for ; Mon, 1 Nov 2021 09:35:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 161A73858427 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rasmusvillemoes.dk Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rasmusvillemoes.dk Received: by mail-lj1-x229.google.com with SMTP id 17so25287629ljq.0 for ; Mon, 01 Nov 2021 02:35:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CTsL4vwO71czp5jZWHMedFbdRg8so5vDSRg7mf+fBWk=; b=f1ND/kNQUmSPhw3AU05gyu0waQJw2mbIOXP+cIc6+a1x3W4uct7H42f6F13YKm62RG /uf8+yrmbICRw4yJrHcjsoRIgHHKiUbG9gtfLXoxs4TujT6Gxh48v49JaasgNoYSiylO LfndFL9ylGeBRB4MARQKuYTbO7p5Ma8s6dg9s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=CTsL4vwO71czp5jZWHMedFbdRg8so5vDSRg7mf+fBWk=; b=kXpeBgr+fjgW9I4HbcAbL7xYfsOx8g0lKZ7U4NHBwh/xpXsex7TjePPYyXErx3E4+v 7qK4WuaENLMfjrDUwm9NKOk3L+rLjrh+cwWycUO0ivwT/q3bIPTw4yvFwskPTxZq+1T7 /aXw2N+FSjXsvyJPr3j09PBEsC3JOLXVcazAoDIbLD3Eb5kD0wPUT+8IsYwORtG24WwA zTC7KRGh4CernJ0VRmP34oPjhHiuB01bSBCT/EvrehsNIYgW72uo1z+0WkuJO6nzur04 V86tBlxlFI0dS/EXNdqKZy8pQiKNp1S90K3a3QFEZL+kF2KwpxRwcbXiVxKPvSe6KrJf jsfw== X-Gm-Message-State: AOAM533+yh4acAVyghVKdESwrVjfKc77Rj72RCwjVuNzA3iS9VABdMl1 jWxDveDNXl4gLG/QM15XfHJh4MvEw9qWwO6m X-Google-Smtp-Source: ABdhPJzhmLfWKXkP9OiCidYXpL6yNfsfr7R4KUk5dJtjrpn7JysgwKxCzBjh8MVc/qDF5lOj46on6A== X-Received: by 2002:a05:651c:907:: with SMTP id e7mr31489564ljq.300.1635759345694; Mon, 01 Nov 2021 02:35:45 -0700 (PDT) Received: from prevas-ravi.prevas.se ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id e27sm1045296ljo.5.2021.11.01.02.35.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Nov 2021 02:35:45 -0700 (PDT) From: Rasmus Villemoes X-Google-Original-From: Rasmus Villemoes To: Olivier Hainque Subject: [PATCH 2/4] libgcc: vxcrtstuff.c: remove ctor/dtor declarations Date: Mon, 1 Nov 2021 10:34:54 +0100 Message-Id: <20211101093456.2003236-3-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211101093456.2003236-1-rasmus.villemoes@prevas.dk> References: <20211101093456.2003236-1-rasmus.villemoes@prevas.dk> MIME-Version: 1.0 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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: , Cc: gcc-patches@gcc.gnu.org, Rasmus Villemoes Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" These declarations prevent the priority given in the constructor/destructor attributes from taking effect, thus emitting the function pointers in the ordinary (lowest-priority) .init_array/.fini_array sections. libgcc/ * config/vxcrtstuff.c: Remove constructor/destructor declarations. --- libgcc/config/vxcrtstuff.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/libgcc/config/vxcrtstuff.c b/libgcc/config/vxcrtstuff.c index 87fadda9ac5..c146e1be3be 100644 --- a/libgcc/config/vxcrtstuff.c +++ b/libgcc/config/vxcrtstuff.c @@ -88,9 +88,6 @@ __attribute__((section(__LIBGCC_EH_FRAME_SECTION_NAME__), aligned(4))) #endif /* USE_INITFINI_ARRAY */ -void EH_CTOR_NAME (void); -void EH_DTOR_NAME (void); - EH_CTOR_ATTRIBUTE void EH_CTOR_NAME (void) { static struct object object; From patchwork Mon Nov 1 09:34:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 46892 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 CB6F93858000 for ; Mon, 1 Nov 2021 09:37:30 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by sourceware.org (Postfix) with ESMTPS id 8FB36385842D for ; Mon, 1 Nov 2021 09:35:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8FB36385842D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rasmusvillemoes.dk Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rasmusvillemoes.dk Received: by mail-lf1-x12c.google.com with SMTP id l13so35182341lfg.6 for ; Mon, 01 Nov 2021 02:35:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ezToV0UpW8W49k2FuCl2ZehehsmW8GTSvZ0zLSFSBvU=; b=VMvPHLcmibRYXEbZ3CqHKzvH4ES7bidUivf3O0UOXpO5lnnGf6STIJtjsh8QxR4e6T 9OEmoAd2Vh7quwLh/smxA3tVVzUfGqbU8OMYjl9fqQ07dZQNBcRCQaEpYpe4iTdy972l F/LbVUWm6CymxR0o1YWUbGzLT7wGRCcMwg9vc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=ezToV0UpW8W49k2FuCl2ZehehsmW8GTSvZ0zLSFSBvU=; b=lNpksX/2NaIT3O11g7z6NzaSGiPCL6oCF4HB1+JWBgl026YyQIDu7hsF9rT8Ywjmgn pkS+E9XSWsunhnQ8JoS0lMr82a2hw0UnvZl7lqevqNVPTiKGLOgXTjVh1Ne6AgenFpGg dQL5xqqS5iHp42HBf/udd+MxtnT/wXSyUbpzB4nh1qDvQksn32bdCtEC4uTrF5tLHXvK +44Jv5mzuO1F0mDqKr0U/L21v/7CZxSTE7GQYlAQwH4RtJUBFeWZZrpCAR1TlJhzhdi7 cx23RJkIpe/Rw1Mp2NqAYouaUJVwNldLrtKARpr6i/VpB3NPb/d0SRLdldA1RcoGwMlF m1Zg== X-Gm-Message-State: AOAM530+nmcLSKRKPs/2gZdCau23SwKcoEVqqlI7DmvPV+vXSJMDz6YE 3fTIH3M4ZUJS97MOUzJmA2KXDQ== X-Google-Smtp-Source: ABdhPJzc7StNEppb0sLR5CnfMz/JAC4uLEGK3udalgJCO5/4tcnvvG3ABpkUhgt3pUgh1Uu7Nv0jUQ== X-Received: by 2002:a05:6512:1690:: with SMTP id bu16mr25969234lfb.401.1635759346475; Mon, 01 Nov 2021 02:35:46 -0700 (PDT) Received: from prevas-ravi.prevas.se ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id e27sm1045296ljo.5.2021.11.01.02.35.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Nov 2021 02:35:46 -0700 (PDT) From: Rasmus Villemoes X-Google-Original-From: Rasmus Villemoes To: Olivier Hainque Subject: [PATCH 3/4] libgcc: vxcrtstuff.c: make ctor/dtor functions static Date: Mon, 1 Nov 2021 10:34:55 +0100 Message-Id: <20211101093456.2003236-4-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211101093456.2003236-1-rasmus.villemoes@prevas.dk> References: <20211101093456.2003236-1-rasmus.villemoes@prevas.dk> MIME-Version: 1.0 X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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: , Cc: gcc-patches@gcc.gnu.org, Rasmus Villemoes Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" When the translation unit itself creates pointers to the ctors/dtors in a specific section handled by the linker (whether .init_array or .ctors.*), there's no reason for the functions to have external linkage. That ends up polluting the symbol table in the running kernel. This makes vxcrtstuff.c on par with the generic crtstuff.c which also defines e.g. frame_dummy and __do_global_dtors_aux static. libgcc/ * config/vxcrtstuff.c: Make constructor and destructor functions static when possible. --- libgcc/config/vxcrtstuff.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libgcc/config/vxcrtstuff.c b/libgcc/config/vxcrtstuff.c index c146e1be3be..652a65364b0 100644 --- a/libgcc/config/vxcrtstuff.c +++ b/libgcc/config/vxcrtstuff.c @@ -58,14 +58,18 @@ __attribute__((section(__LIBGCC_EH_FRAME_SECTION_NAME__), aligned(4))) #define EH_CTOR_NAME _crtbe_register_frame #define EH_DTOR_NAME _ctrbe_deregister_frame +#define EH_LINKAGE static #else /* No specific sections for constructors or destructors: we thus use a symbol naming convention so that the constructors are then recognized - by munch or whatever tool is used for the final link phase. */ + by munch or whatever tool is used for the final link phase. Since the + pointers to the constructor/destructor functions are not created in this + translation unit, they must have external linkage. */ #define EH_CTOR_NAME _GLOBAL__I_00101_0__crtbe_register_frame #define EH_DTOR_NAME _GLOBAL__D_00101_1__crtbe_deregister_frame +#define EH_LINKAGE #endif @@ -88,13 +92,13 @@ __attribute__((section(__LIBGCC_EH_FRAME_SECTION_NAME__), aligned(4))) #endif /* USE_INITFINI_ARRAY */ -EH_CTOR_ATTRIBUTE void EH_CTOR_NAME (void) +EH_LINKAGE EH_CTOR_ATTRIBUTE void EH_CTOR_NAME (void) { static struct object object; __register_frame_info (__EH_FRAME_BEGIN__, &object); } -EH_DTOR_ATTRIBUTE void EH_DTOR_NAME (void) +EH_LINKAGE EH_DTOR_ATTRIBUTE void EH_DTOR_NAME (void) { __deregister_frame_info (__EH_FRAME_BEGIN__); } From patchwork Mon Nov 1 09:34:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 46893 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 21DF2385800B for ; Mon, 1 Nov 2021 09:38:09 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by sourceware.org (Postfix) with ESMTPS id 79F323858422 for ; Mon, 1 Nov 2021 09:35:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 79F323858422 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rasmusvillemoes.dk Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rasmusvillemoes.dk Received: by mail-lf1-x130.google.com with SMTP id bu18so17994865lfb.0 for ; Mon, 01 Nov 2021 02:35:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UrDDlN6LtirIiR3nEiRwVvtFba3yRRlMVwPLcJ9kNE8=; b=GUj6/rpZcnQTukNom2GbMsBEBedd0N0I+gvsHjsBlMi72opibFxX2H4ytZnHi459MM v+a0y6pm9H23Z0gbQP09KbWb5JhP+EuWiozbU0qL2yji4j9VeHol5F30fjzflEUyViPA e/PG84K1Ry45fxF63Elua1SMJPc+Btwf7H4+s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=UrDDlN6LtirIiR3nEiRwVvtFba3yRRlMVwPLcJ9kNE8=; b=bW56tk0mBzwzsfHeKA0nTn/Gg6wBZm1PBYJChhYsvFpZwf7NZAybTQlJyKUIgEBuM9 MeA6aFCRh9WO4ZJFeqKod6f1jYVORmXooZK7oFFZzczsKabcM2H17sxgF1Nk0i9X7aU0 FoUPJvEQrD/RUz8Xjn8NULw392jgmTnSeQ+lr43BP0MpAI25NYcEsqGoo4OoSPaI0n25 yG1JIfjnJhKTwwoz/NSk0/y+0bgpmDzwXw1zP7ZxE0flJypOJ+MvdGJkQ7/2TbGbN3Cu EM0R13HP8rjT3blb8xLarSWsAGl5uXgjnsjbFvJ1Q7+XQase6+4ggp5l2N9tKnw/8AZ/ Ie3Q== X-Gm-Message-State: AOAM532FbqdWFaoyFRNmextzZF8OrtTGIH84Ny4jpV23UFfEukMmXK74 L2jMjMnRTLuA86XWGA28bzCqCg== X-Google-Smtp-Source: ABdhPJyF3tJC/ibH0BN8KsYsYe2Yi2n43+nXjwlWaOF9+z9m8wi2LUPjEU3fV5fsVuwP/fAzJcLYXw== X-Received: by 2002:ac2:42c5:: with SMTP id n5mr26667790lfl.511.1635759347321; Mon, 01 Nov 2021 02:35:47 -0700 (PDT) Received: from prevas-ravi.prevas.se ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id e27sm1045296ljo.5.2021.11.01.02.35.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Nov 2021 02:35:46 -0700 (PDT) From: Rasmus Villemoes X-Google-Original-From: Rasmus Villemoes To: Olivier Hainque Subject: [PATCH 4/4] libgcc: vxcrtstuff.c: add a few undefs Date: Mon, 1 Nov 2021 10:34:56 +0100 Message-Id: <20211101093456.2003236-5-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211101093456.2003236-1-rasmus.villemoes@prevas.dk> References: <20211101093456.2003236-1-rasmus.villemoes@prevas.dk> MIME-Version: 1.0 X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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: , Cc: gcc-patches@gcc.gnu.org, Rasmus Villemoes Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" When vxcrtstuff.c was created, the set of #includes was copied from crtstuff.c. But crtstuff.c also has a bunch of #undefs after the first #include, because, as the comment says, including auto-host.h when building objects that are meant for target is technically not correct. This manifests when I try do do a canadian cross, with build=linux, host=windows and target=vxworks, in that we pick up a #define caddr_t char * from auto-host.h, which then of course creates a problem when we later include a target header that has typedef char * caddr_t; I assume that the #undefs in crtstuff.c have been added for similar reasons. These potentially problematic #defines all seem to be guarded by #ifndef USED_FOR_TARGET, which tconfig.h defines before including auto-host.h. So at first, it seems that one could avoid the problem by simply removing the initial include of auto-host.h. Unfortunately, we do need some of the things defined in auto-host.h within such an ifndef USED_FOR_TARGET, namely the define of HAVE_INITFINI_ARRAY_SUPPORT, which is what later causes initfini-array.h to define USE_INITFINI_ARRAY. So as the next best fix, just copy the #undefs from crtstuff.c. libgcc/ * config/vxcrtstuff.c: Undefine caddr_t, pid_t, rlim_t, ssize_t and vfork after including auto-host.h. --- libgcc/config/vxcrtstuff.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libgcc/config/vxcrtstuff.c b/libgcc/config/vxcrtstuff.c index 652a65364b0..c15e15e54e9 100644 --- a/libgcc/config/vxcrtstuff.c +++ b/libgcc/config/vxcrtstuff.c @@ -26,7 +26,15 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define IN_LIBGCC2 +/* FIXME: Including auto-host is incorrect, but until we have + identified the set of defines that need to go into auto-target.h, + this will have to do. */ #include "auto-host.h" +#undef caddr_t +#undef pid_t +#undef rlim_t +#undef ssize_t +#undef vfork #include "tconfig.h" #include "tsystem.h" #include "coretypes.h"