From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dedi548.your-server.de (dedi548.your-server.de [85.10.215.148]) by sourceware.org (Postfix) with ESMTPS id 71532381EC9D for ; Wed, 7 Dec 2022 07:54:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 71532381EC9D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embedded-brains.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embedded-brains.de Received: from sslproxy01.your-server.de ([78.46.139.224]) by dedi548.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1p2pGA-000Ovx-0J; Wed, 07 Dec 2022 08:54:30 +0100 Received: from [82.100.198.138] (helo=mail.embedded-brains.de) by sslproxy01.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p2pG9-000Mdu-Sq; Wed, 07 Dec 2022 08:54:29 +0100 Received: from localhost (localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id 6A99B480089; Wed, 7 Dec 2022 08:54:29 +0100 (CET) Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id dn_R7xoYDNt6; Wed, 7 Dec 2022 08:54:29 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id E83B4480188; Wed, 7 Dec 2022 08:54:28 +0100 (CET) X-Virus-Scanned: amavisd-new at zimbra.eb.localhost Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id mVTZ3F020JMY; Wed, 7 Dec 2022 08:54:28 +0100 (CET) Received: from [192.168.96.159] (unknown [192.168.96.159]) by mail.embedded-brains.de (Postfix) with ESMTPSA id B92AB480089; Wed, 7 Dec 2022 08:54:28 +0100 (CET) Message-ID: Date: Wed, 7 Dec 2022 08:54:28 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [PATCH v2 1/2] Allow subtarget customization of CC1_SPEC Content-Language: en-US To: Thomas Schwinge Cc: Jeff Law , gcc-patches@gcc.gnu.org, Iain Sandoe References: <20221121072526.103446-1-sebastian.huber@embedded-brains.de> <87k034s0lz.fsf@dirichlet.schwinge.homeip.net> <87tu278za7.fsf@dem-tschwing-1.ger.mentorg.com> From: Sebastian Huber In-Reply-To: <87tu278za7.fsf@dem-tschwing-1.ger.mentorg.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Authenticated-Sender: smtp-embedded@poldinet.de X-Virus-Scanned: Clear (ClamAV 0.103.7/26742/Tue Dec 6 09:18:20 2022) X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_STATUS,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,TXREP 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: On 07.12.22 08:10, Thomas Schwinge wrote: > Hi! >=20 > On 2022-12-07T07:04:10+0100, Sebastian Huber wrote: >> On 06.12.22 22:06, Thomas Schwinge wrote: >> I suppose I just fail to see some detail here, but: >> >>> On 2022-11-21T08:25:25+0100, Sebastian Huber wrote: >>>> gcc/ChangeLog: >>>> >>>> * gcc.cc (SUBTARGET_CC1_SPEC): Define if not defined. >>>> (cc1_spec): Append SUBTARGET_CC1_SPEC. >>>> --- >>>> v2: Append SUBTARGET_CC1_SPEC directly to cc1_spec and not through C= C1_SPEC. >>>> This avoids having to modify all the CC1_SPEC definitions in t= he targets. >>>> >>>> gcc/gcc.cc | 9 ++++++++- >>>> 1 file changed, 8 insertions(+), 1 deletion(-) >>>> >>>> diff --git a/gcc/gcc.cc b/gcc/gcc.cc >>>> index 830ab88701f..4e1574a4df1 100644 >>>> --- a/gcc/gcc.cc >>>> +++ b/gcc/gcc.cc >>>> @@ -706,6 +706,13 @@ proper position among the other output files. = */ >>>> #define CPP_SPEC "" >>>> #endif >>>> >>>> +/* Subtargets can define SUBTARGET_CC1_SPEC to provide extra args t= o cc1 and >>>> + cc1plus or extra switch-translations. The SUBTARGET_CC1_SPEC is= appended >>>> + to CC1_SPEC. */ >>>> +#ifndef SUBTARGET_CC1_SPEC >>>> +#define SUBTARGET_CC1_SPEC "" >>>> +#endif >>>> + >>>> /* config.h can define CC1_SPEC to provide extra args to cc1 and = cc1plus >>>> or extra switch-translations. */ >>>> #ifndef CC1_SPEC >>>> @@ -1174,7 +1181,7 @@ proper position among the other output files. = */ >>>> static const char *asm_debug =3D ASM_DEBUG_SPEC; >>>> static const char *asm_debug_option =3D ASM_DEBUG_OPTION_SPEC; >>>> static const char *cpp_spec =3D CPP_SPEC; >>>> -static const char *cc1_spec =3D CC1_SPEC; >>>> +static const char *cc1_spec =3D CC1_SPEC SUBTARGET_CC1_SPEC; >>>> static const char *cc1plus_spec =3D CC1PLUS_SPEC; >>>> static const char *link_gcc_c_sequence_spec =3D LINK_GCC_C_SEQUEN= CE_SPEC; >>>> static const char *link_ssp_spec =3D LINK_SSP_SPEC; >>> >>> ... doesn't this (at least potentially?) badly interact with any exis= ting >>> 'SUBTARGET_CC1_SPEC' definitions -- which pe rabove get appended to >>> 'cc1_spec'? >>> >>> gcc/config/loongarch/gnu-user.h- and provides this hook inste= ad. */ >>> gcc/config/loongarch/gnu-user.h:#undef SUBTARGET_CC1_SPEC >>> gcc/config/loongarch/gnu-user.h:#define SUBTARGET_CC1_SPEC GNU_= USER_TARGET_CC1_SPEC >>> gcc/config/loongarch/gnu-user.h- >>> -- >>> gcc/config/loongarch/loongarch.h-#define EXTRA_SPECS \ >>> gcc/config/loongarch/loongarch.h: {"subtarget_cc1_spec", SUBTA= RGET_CC1_SPEC}, \ >>> gcc/config/loongarch/loongarch.h- {"subtarget_cpp_spec", SUBTA= RGET_CPP_SPEC}, \ >>> -- >>> gcc/config/mips/gnu-user.h- and provides this hook instead. = */ >>> gcc/config/mips/gnu-user.h:#undef SUBTARGET_CC1_SPEC >>> gcc/config/mips/gnu-user.h:#define SUBTARGET_CC1_SPEC GNU_USER_= TARGET_CC1_SPEC >>> gcc/config/mips/gnu-user.h- >>> -- >>> gcc/config/mips/linux-common.h- >>> gcc/config/mips/linux-common.h:#undef SUBTARGET_CC1_SPEC >>> gcc/config/mips/linux-common.h:#define SUBTARGET_CC1_SPEC = \ >>> gcc/config/mips/linux-common.h- LINUX_OR_ANDROID_CC (GNU_USER_= TARGET_CC1_SPEC, \ >>> -- >>> gcc/config/mips/mips.h- >>> gcc/config/mips/mips.h:/* SUBTARGET_CC1_SPEC is passed to the c= ompiler proper. It may be >>> gcc/config/mips/mips.h- overridden by subtargets. */ >>> gcc/config/mips/mips.h:#ifndef SUBTARGET_CC1_SPEC >>> gcc/config/mips/mips.h:#define SUBTARGET_CC1_SPEC "" >>> gcc/config/mips/mips.h-#endif >>> -- >>> gcc/config/mips/mips.h-#define EXTRA_SPECS = \ >>> gcc/config/mips/mips.h: { "subtarget_cc1_spec", SUBTARGET_CC1_= SPEC }, \ >>> gcc/config/mips/mips.h- { "subtarget_cpp_spec", SUBTARGET_CPP_= SPEC }, \ >>> -- >>> gcc/config/mips/r3900.h-/* By default (if not mips-something-el= se) produce code for the r3900 */ >>> gcc/config/mips/r3900.h:#undef SUBTARGET_CC1_SPEC >>> gcc/config/mips/r3900.h:#define SUBTARGET_CC1_SPEC "\ >>> gcc/config/mips/r3900.h-%{mhard-float:%e-mhard-float not suppor= ted} \ >> >> Oh, I came up with the name SUBTARGET_CC1_SPEC after a discussion on t= he >> mailing list >=20 > I've put Iain in CC. >=20 >> and I have to admit that I didn't check that it was >> actually already in use. >=20 > Always one of the first things I do. ;-) >=20 >> What about renaming the loongarch/mips define >> to LOONGARCH_CC1_SPEC and MIPS_CC1_SPEC? >=20 > Also in use are a number of other 'SUBTARGET_[...]_SPEC' and > corresponding 'subtarget_[...]_spec' in 'EXTRA_SPECS', for example: >=20 > gcc/config/mips/mips.h-#define EXTRA_SPECS = \ > gcc/config/mips/mips.h: { "subtarget_cc1_spec", SUBTARGET_CC1_SPE= C }, \ > gcc/config/mips/mips.h: { "subtarget_cpp_spec", SUBTARGET_CPP_SPE= C }, \ > gcc/config/mips/mips.h: { "subtarget_asm_debugging_spec", SUBTARG= ET_ASM_DEBUGGING_SPEC }, \ > gcc/config/mips/mips.h: { "subtarget_asm_spec", SUBTARGET_ASM_SPE= C }, \ > gcc/config/mips/mips.h- { "asm_abi_default_spec", "-" MULTILIB_AB= I_DEFAULT }, \ > gcc/config/mips/mips.h- { "endian_spec", ENDIAN_SPEC }, = \ > gcc/config/mips/mips.h: SUBTARGET_EXTRA_SPECS >=20 > Do we need/want to keep the association of same-name > upper-case/lower-case variants; in your proposal you'd then get > '{ "subtarget_cc1_spec", MIPS_CC1_SPEC }', for example? (I didn't > quickly grok all 'EXTRA_SPECS' usage.) >=20 > Alternatively, what about renaming your 'SUBTARGET_CC1_SPEC' to > 'CC1_SPEC_EXTRA' -- if that makes sense? >=20 > static const char *cc1_spec =3D CC1_SPEC CC1_SPEC_EXTRA; I was told that an operating system is the subtarget in this context. So=20 from the name SUBTARGET_CC1_SPEC is is clear who is in charge. This is=20 not clear from CC1_SPEC_EXTRA. >=20 > But doesn't somehow this whole thing feel a bit like "chating the > system"? ;-) >=20 > Can't you actually achieve your thing (TLS model) via (new) 'EXTRA_SPEC= S' > in 'gcc/config/rtems.h', for example? The EXTRA_SPECS definition seems to be target-specific. Not all targets=20 let an operating system define SUBTARGET_EXTRA_SPECS. The=20 SUBTARGET_EXTRA_SPECS would need to get propagated to the corresponding=20 specs, which seems to be also target-specific, for example for mips we ha= ve: #undef CC1_SPEC #define CC1_SPEC "\ %{G*} %{EB:-meb} %{EL:-mel} %{EB:%{EL:%emay not use both -EB and -EL}} \ %(subtarget_cc1_spec)" I think going this route would lead to a lot of changes affecting all=20 targets. --=20 embedded brains GmbH Herr Sebastian HUBER Dornierstr. 4 82178 Puchheim Germany email: sebastian.huber@embedded-brains.de phone: +49-89-18 94 741 - 16 fax: +49-89-18 94 741 - 08 Registergericht: Amtsgericht M=C3=BCnchen Registernummer: HRB 157899 Vertretungsberechtigte Gesch=C3=A4ftsf=C3=BChrer: Peter Rasmussen, Thomas= D=C3=B6rfler Unsere Datenschutzerkl=C3=A4rung finden Sie hier: https://embedded-brains.de/datenschutzerklaerung/