From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 94252158089 for ; Sat, 30 Sep 2023 09:38:59 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B1CF92BC03F; Sat, 30 Sep 2023 09:38:58 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 967922BC03F for ; Sat, 30 Sep 2023 09:38:58 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 97112335D3B for ; Sat, 30 Sep 2023 09:38:57 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id B8D491172 for ; Sat, 30 Sep 2023 09:38:55 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1696066720.5f54fc59c91393781a4fdace7e2cdc27f9651d15.sam@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/ X-VCS-Repository: repo/gentoo X-VCS-Files: eclass/toolchain.eclass X-VCS-Directories: eclass/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 5f54fc59c91393781a4fdace7e2cdc27f9651d15 X-VCS-Branch: master Date: Sat, 30 Sep 2023 09:38:55 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 48f1b98e-5623-4b56-ab46-e949135a19de X-Archives-Hash: aa69d875601de9160572d56305de7870 commit: 5f54fc59c91393781a4fdace7e2cdc27f9651d15 Author: Sam James gentoo org> AuthorDate: Fri Sep 29 00:44:16 2023 +0000 Commit: Sam James gentoo org> CommitDate: Sat Sep 30 09:38:40 2023 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5f54fc59 toolchain.eclass: support bootstrap-O3 Upstream are fine with bootstrapping with -O3, so don't strip it out if the user set it, even with USE=-custom-cflags. Signed-off-by: Sam James gentoo.org> eclass/toolchain.eclass | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass index a145e74d5521..90a6098445f5 100644 --- a/eclass/toolchain.eclass +++ b/eclass/toolchain.eclass @@ -753,6 +753,9 @@ setup_multilib_osdirnames() { #---->> src_configure <<---- toolchain_src_configure() { + BUILD_CONFIG_TARGETS=() + is-flagq '-O3' && BUILD_CONFIG_TARGETS+=( bootstrap-O3 ) + downgrade_arch_flags gcc_do_filter_flags @@ -772,8 +775,6 @@ toolchain_src_configure() { local confgcc=( --host=${CHOST} ) - local build_config_targets=() - if is_crosscompile || tc-is-cross-compiler ; then # Straight from the GCC install doc: # "GCC has code to correctly determine the correct value for target @@ -898,11 +899,11 @@ toolchain_src_configure() { # Build compiler itself using LTO if tc_version_is_at_least 9.1 && _tc_use_if_iuse lto ; then - build_config_targets+=( bootstrap-lto ) + BUILD_CONFIG_TARGETS+=( bootstrap-lto ) fi if tc_version_is_at_least 12 && _tc_use_if_iuse cet ; then - build_config_targets+=( bootstrap-cet ) + BUILD_CONFIG_TARGETS+=( bootstrap-cet ) fi # Support to disable PCH when building libstdcxx @@ -1321,9 +1322,9 @@ toolchain_src_configure() { confgcc+=( "$@" ${EXTRA_ECONF} ) - if ! is_crosscompile && ! tc-is-cross-compiler && [[ -n ${build_config_targets} ]] ; then + if ! is_crosscompile && ! tc-is-cross-compiler && [[ -n ${BUILD_CONFIG_TARGETS} ]] ; then # e.g. ./configure --with-build-config='bootstrap-lto bootstrap-cet' - confgcc+=( --with-build-config="${build_config_targets[*]}" ) + confgcc+=( --with-build-config="${BUILD_CONFIG_TARGETS[*]}" ) fi # Nothing wrong with a good dose of verbosity @@ -1501,7 +1502,14 @@ gcc_do_filter_flags() { # Lock gcc at -O2; we want to be conservative here. filter-flags '-O?' - append-flags -O2 + + # We allow -O3 given it's a supported option upstream. + # Only add -O2 if we're not doing -O3. + if [[ ${BUILD_CONFIG_TARGETS[@]} == *bootstrap-O3* ]] ; then + append-flags '-O3' + else + append-flags '-O2' + fi fi # Please use USE=lto instead (bug #906007).