From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 35A2A3858C2C for ; Wed, 3 Jan 2024 09:49:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 35A2A3858C2C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 35A2A3858C2C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704275351; cv=none; b=u4JLP+IAra8L3fHX3aRa5Ot6JthCOWpZj1g9FB0jALIaB6Qgs9n7CBlOPr77lTwK9cTv1e4kGKjFqYy5hpjptVVoo9tejMQzAN3wSgJgjn20SfFDSYyTnIDgt+3fv7VvXguE8ZKAAKKpTnW/hdQ7iAs20sgL55d8sVCugUDnArQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704275351; c=relaxed/simple; bh=OjYeECdi7VO/HfyJDnruRIvRT0QJM1rmLnfZnIvbc6w=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=nhfS4we0+d132JzHwg0Wf1sxV3IaEtpp5HlntAWJBhKsDNQ1Tw3Ckf4nL/ChClIh/VpGqw1d5QbKSyetrZjJNV1lIdQgqngAKyNtT4DTdTRjQ42dWCsDH+zViXs5I8xio7zKNyafQmObN294ywaiG2INjoE8iHoRdCRWtsTSi48= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9D4E4C15; Wed, 3 Jan 2024 01:49:54 -0800 (PST) Received: from localhost (e121540-lin.manchester.arm.com [10.32.110.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 030B53F7A6; Wed, 3 Jan 2024 01:49:07 -0800 (PST) From: Richard Sandiford To: Sergey Bugaev Mail-Followup-To: Sergey Bugaev ,gcc-patches@gcc.gnu.org, bug-hurd@gnu.org, thomas@schwinge.name, richard.sandiford@arm.com Cc: gcc-patches@gcc.gnu.org, bug-hurd@gnu.org, thomas@schwinge.name Subject: Re: [PATCH gcc 1/3] Move GNU/Hurd startfile spec from config/i386/gnu.h to config/gnu.h References: <20240101115356.614446-1-bugaevc@gmail.com> Date: Wed, 03 Jan 2024 09:49:06 +0000 In-Reply-To: <20240101115356.614446-1-bugaevc@gmail.com> (Sergey Bugaev's message of "Mon, 1 Jan 2024 14:53:54 +0300") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-21.6 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_NONE,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,KAM_SHORT,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Sergey Bugaev writes: > Since it's not i386-specific; this makes it possible to reuse it for other > architectures. > > Also, add a warning for the case gnu.h is specified before gnu-user.h, which > would cause gnu-user's version of the spec to override gnu's, and not the other > way around as it's intended. The i?86-gnu target currently specifies them in > the right order, but it's easy to accidentally put them in a wrong order. > > Signed-off-by: Sergey Bugaev The series looks good to me FWIW, but Thomas should have the final say. Thanks, Richard > --- > gcc/config/gnu.h | 16 ++++++++++++++++ > gcc/config/i386/gnu.h | 11 ----------- > 2 files changed, 16 insertions(+), 11 deletions(-) > > diff --git a/gcc/config/gnu.h b/gcc/config/gnu.h > index 97baea939..89904cd9b 100644 > --- a/gcc/config/gnu.h > +++ b/gcc/config/gnu.h > @@ -31,3 +31,19 @@ along with GCC. If not, see . > builtin_assert ("system=unix"); \ > builtin_assert ("system=posix"); \ > } while (0) > + > + > +#ifndef GNU_USER_TARGET_STARTFILE_SPEC > +# warning This file should be included after gnu-user.h, to override its STARTFILE_SPEC > +#endif > + > +#undef STARTFILE_SPEC > +#if defined HAVE_LD_PIE > +#define STARTFILE_SPEC \ > + "%{!shared: %{pg|p|profile:%{static-pie:grcrt0.o%s;static:gcrt0.o%s;:gcrt1.o%s};static-pie:rcrt0.o%s;static:crt0.o%s;" PIE_SPEC ":Scrt1.o%s;:crt1.o%s}} \ > + crti.o%s %{static:crtbeginT.o%s;shared|static-pie|" PIE_SPEC ":crtbeginS.o%s;:crtbegin.o%s}" > +#else > +#define STARTFILE_SPEC \ > + "%{!shared: %{pg|p|profile:%{static:gcrt0.o%s;:gcrt1.o%s};static:crt0.o%s;:crt1.o%s}} \ > + crti.o%s %{static:crtbeginT.o%s;shared:crtbeginS.o%s;:crtbegin.o%s}" > +#endif > diff --git a/gcc/config/i386/gnu.h b/gcc/config/i386/gnu.h > index e776144f9..60244bfc8 100644 > --- a/gcc/config/i386/gnu.h > +++ b/gcc/config/i386/gnu.h > @@ -24,17 +24,6 @@ along with GCC. If not, see . > #undef GNU_USER_DYNAMIC_LINKER > #define GNU_USER_DYNAMIC_LINKER "/lib/ld.so" > > -#undef STARTFILE_SPEC > -#if defined HAVE_LD_PIE > -#define STARTFILE_SPEC \ > - "%{!shared: %{pg|p|profile:%{static-pie:grcrt0.o%s;static:gcrt0.o%s;:gcrt1.o%s};static-pie:rcrt0.o%s;static:crt0.o%s;" PIE_SPEC ":Scrt1.o%s;:crt1.o%s}} \ > - crti.o%s %{static:crtbeginT.o%s;shared|static-pie|" PIE_SPEC ":crtbeginS.o%s;:crtbegin.o%s}" > -#else > -#define STARTFILE_SPEC \ > - "%{!shared: %{pg|p|profile:%{static:gcrt0.o%s;:gcrt1.o%s};static:crt0.o%s;:crt1.o%s}} \ > - crti.o%s %{static:crtbeginT.o%s;shared:crtbeginS.o%s;:crtbegin.o%s}" > -#endif > - > #ifdef TARGET_LIBC_PROVIDES_SSP > > /* i386 glibc provides __stack_chk_guard in %gs:0x14. */