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 B00683818FE1 for ; Wed, 7 Dec 2022 09:50:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B00683818FE1 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com 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 21A4D23A; Wed, 7 Dec 2022 01:50:59 -0800 (PST) Received: from localhost (e121540-lin.manchester.arm.com [10.32.99.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AD2083F73B; Wed, 7 Dec 2022 01:50:51 -0800 (PST) From: Richard Sandiford To: Sebastian Huber Mail-Followup-To: Sebastian Huber ,Thomas Schwinge , Jeff Law , gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Cc: Thomas Schwinge , Jeff Law , gcc-patches@gcc.gnu.org Subject: Re: [PATCH v2 1/2] Allow subtarget customization of CC1_SPEC References: <20221121072526.103446-1-sebastian.huber@embedded-brains.de> <87k034s0lz.fsf@dirichlet.schwinge.homeip.net> Date: Wed, 07 Dec 2022 09:50:50 +0000 In-Reply-To: (Sebastian Huber's message of "Wed, 7 Dec 2022 07:04:10 +0100") 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=-38.6 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_NONE,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_NONE,SPF_NONE,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: Sebastian Huber writes: > On 06.12.22 22:06, Thomas Schwinge wrote: >> Hi! >> >> 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 CC1_SPEC. >>> This avoids having to modify all the CC1_SPEC definitions in the 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 to 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 = ASM_DEBUG_SPEC; >>> static const char *asm_debug_option = ASM_DEBUG_OPTION_SPEC; >>> static const char *cpp_spec = CPP_SPEC; >>> -static const char *cc1_spec = CC1_SPEC; >>> +static const char *cc1_spec = CC1_SPEC SUBTARGET_CC1_SPEC; >>> static const char *cc1plus_spec = CC1PLUS_SPEC; >>> static const char *link_gcc_c_sequence_spec = LINK_GCC_C_SEQUENCE_SPEC; >>> static const char *link_ssp_spec = LINK_SSP_SPEC; >> ... doesn't this (at least potentially?) badly interact with any existing >> 'SUBTARGET_CC1_SPEC' definitions -- which pe rabove get appended to >> 'cc1_spec'? >> >> gcc/config/loongarch/gnu-user.h- and provides this hook instead. */ >> 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", SUBTARGET_CC1_SPEC}, \ >> gcc/config/loongarch/loongarch.h- {"subtarget_cpp_spec", SUBTARGET_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 compiler 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-else) 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 supported} \ > > Oh, I came up with the name SUBTARGET_CC1_SPEC after a discussion on the > mailing list and I have to admit that I didn't check that it was > actually already in use. What about renaming the loongarch/mips define > to LOONGARCH_CC1_SPEC and MIPS_CC1_SPEC? One drawback to that is that people might have their own spec files that reference the existing names. Typically those would be produced by using -dumpspecs and editing the output. I think we only really support that if people regenerate the specs files for each release, but for targets like MIPS that don't see much activity, it's probably easy to get away without doing that. How about going back to Jose's suggestion from the original thread of using OS_CC1_SPEC? The patch is OK with that change if no-one objects in 24 hours. Thanks, Richard