From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1643) id 5AA543858CDA; Tue, 9 Apr 2024 07:24:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5AA543858CDA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1712647462; bh=x1B9LPShARA+5KdEozDdTPmfsfA5UyWeZhUe3Oi+49I=; h=From:To:Subject:Date:From; b=lh1c9atWGdsDs5J8SidGvjuHFAQ0YtCLL19UM6W2dHpyBJa04A3koypL8vsmVxfnG cbofjATeAL+U19EzkfzVj9HmhIqoh8jevqAIX7BQdCTlMEXF/6nTLph87iDbmxjrFD F5LReShs1mc6nC0sqS4dWsLvktiKrLbVS6qr1WSU= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Thomas Schwinge To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-9856] Move GNU/Hurd startfile spec from config/i386/gnu.h to config/gnu.h X-Act-Checkin: gcc X-Git-Author: Sergey Bugaev X-Git-Refname: refs/heads/trunk X-Git-Oldrev: d76df699b8ff792575e9df4d214c21fed0ed3b6b X-Git-Newrev: 532c57f8c3a15b109a46d3e2b14d60a5c40979d5 Message-Id: <20240409072422.5AA543858CDA@sourceware.org> Date: Tue, 9 Apr 2024 07:24:22 +0000 (GMT) List-Id: https://gcc.gnu.org/g:532c57f8c3a15b109a46d3e2b14d60a5c40979d5 commit r14-9856-g532c57f8c3a15b109a46d3e2b14d60a5c40979d5 Author: Sergey Bugaev Date: Sat Mar 23 17:35:11 2024 +0300 Move GNU/Hurd startfile spec from config/i386/gnu.h to config/gnu.h 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. gcc/Changelog: * config/i386/gnu.h: Move GNU/Hurd STARTFILE_SPEC from here... * config/gnu.h: ...to here. Signed-off-by: Sergey Bugaev Diff: --- 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 ac99f760547..e2a33baf040 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 3f42714d16c..af1d55887ed 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. */