From patchwork Mon Oct 14 23:18:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Packard X-Patchwork-Id: 1997129 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=keithp.com header.i=@keithp.com header.a=rsa-sha256 header.s=mail header.b=WWjGxOkT; dkim=fail reason="signature verification failed" (2048-bit key) header.d=keithp.com header.i=@keithp.com header.a=rsa-sha256 header.s=mail header.b=LBRubPRF; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XSD8c2XRdz1xsc for ; Tue, 15 Oct 2024 10:34:24 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 71794385AC32 for ; Mon, 14 Oct 2024 23:34:22 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from elaine.keithp.com (home.keithp.com [63.227.221.253]) by sourceware.org (Postfix) with ESMTPS id 6593A3858C98 for ; Mon, 14 Oct 2024 23:33:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6593A3858C98 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=keithp.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=keithp.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6593A3858C98 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=63.227.221.253 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728948839; cv=none; b=Oi7om0OwA0ci7QOHp8FB5R0n0le9hPn6I1oZY4XJ1SRSkOWxMDTxdypc2ZLa8NJAF8KzSCbPoVAZQwHx/1XHh7KUtSta9vcNIBaCpOQw5X8Hy/MAsn6FREqKwR6UNXgpEbo8hdS8vK3jq8RykNSZaGsKGQnZb54+THR3hg/tlkM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728948839; c=relaxed/simple; bh=wuiGI6Dawyn0yxQy9s1Z8n/OycFLgzvYrjQkXNuTGnY=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=CAmyNzoe64BGkTFWKi2CJAi4Owy8P4FJgfnYhl2c7BKNBC+CpnVp1JQ+naBqZFQdLyooDU0MDsS3+dtkXnfYkSg55h9+YyMc+kVU3v5IukwdwO/7uyMFPMcqpYijDgz03GJhWQ++EMv22zOID9kTECD9c8XU5FJdvKPp1Vds9lw= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=keithp.com; s=mail; t=1728948836; bh=wuiGI6Dawyn0yxQy9s1Z8n/OycFLgzvYrjQkXNuTGnY=; h=From:To:Cc:Subject:Date:From; b=WWjGxOkT9mIgReUCDFLPpABXmXg5yBQd1FOJKEqjqMhazwO6KFdC4ne6dXwNHTXTD eRRD8DRyrXJaXK6hHUGNyluAhKDN7OnETuIGDSdv91yySoBmzI1mhqXYXYh5kDKqyc o4Fwmn47P1jxEP/JfXJG21R2nK1BgMnJYF1ColC6bkupxE4hsWmz0jft3q0bs1Wug9 q+UFxrNYStBahnB8eBF9yO6Mb5AFeNKTOoJuhnhbUkItIYmrbGrDgIEZkTk+yvhv4o 6ZH9P/osUNWPTWh7bOWAvbntReTTuwdf+KL1oDYxH5bJAyxmI+yoUYo/ygldC3N5Sq JTDAbq60OExcg== Received: from localhost (localhost [127.0.0.1]) by elaine.keithp.com (Postfix) with ESMTP id 3EFD73F21B1C for ; Mon, 14 Oct 2024 16:33:56 -0700 (PDT) X-Virus-Scanned: Debian amavis at keithp.com Received: from elaine.keithp.com ([127.0.0.1]) by localhost (elaine.keithp.com [127.0.0.1]) (amavis, port 10024) with LMTP id iwYP-kWYjujE; Mon, 14 Oct 2024 16:33:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=keithp.com; s=mail; t=1728948834; bh=wuiGI6Dawyn0yxQy9s1Z8n/OycFLgzvYrjQkXNuTGnY=; h=From:To:Cc:Subject:Date:From; b=LBRubPRFzRFIlqIVjrmfxlYc/TIMTryUy0pIkQM/gSzwQxNA7SIzANlhtHrZdHzC4 hK7Acbau2tfJaEw0lY0xUNGC0RZ7yOea9ll1Lao34uJEFFHxOBiQ4dPJNTW6fH3Bmd ww9ZG/CesEmITRq6j08gadoOkcVJ7hUBwJsOYLsyERfxvCZs0tbIa+eD/EokwGRv2z 5jikbVJkB/yC7sxNtH/5awZlGjCYWBfFKE5mjE5eRQTA8pwC5dqPITKQlQW2RQUxOR qjA3G9W5+uc9cYxfye9DfpACCCBriD0evVhYKL2A3B9NYYoUI5my6QJKuHYoLLEeGZ DKTYMbZghvDAA== Received: from keithp.com (koto.keithp.com [192.168.11.2]) by elaine.keithp.com (Postfix) with ESMTPSA id C91833F20561; Mon, 14 Oct 2024 16:33:54 -0700 (PDT) Received: by keithp.com (Postfix, from userid 1000) id 853D01E60239; Tue, 15 Oct 2024 01:33:54 +0200 (CEST) From: Keith Packard To: gcc-patches@gcc.gnu.org Cc: Keith Packard Subject: [PATCH 0/2] Automate creation of -O2 and -Os multilib variants Date: Mon, 14 Oct 2024 16:18:33 -0700 Message-ID: <20241014233350.1625639-1-keithp@keithp.com> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, LIKELY_SPAM_BODY, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org When building toolchains for embedded development, some projects will want to optimize for speed while others are much more concerned about overall code size. We can do this using the existing GCC multilib infrastructure, adding suitable speed and size variants as another dimension of the multilib table. This could replace the current Debian arm-none-eabi toolchain practice of duplicating the C library build into 'regular' and 'release' variants and then requiring application developers select which to use with a new GCC flag, --picolibc-buildtype=release, which is processed in a custom .specs file. This mechanism only provides space/speed optimized versions of the C library, and not libgcc or libstdc++. The first patch in this series allows multilib configurations to enable -Os or -Oz while building libgcc by pulling any -Os or -Oz setting out of the CC and CFLAGS variables and appending them to the end of the compiler flags used for libgcc and other targets, overriding numerous uses of -O2 throughout the build system. The second patch enables a new configuration option, --enable-multilib-space, which adds -Os as one of the multilib options and then extends any existing MULTILIB_EXCEPTIONS and MULTILIB_REQUIRED settings, adding Os variants of each entry. This has been tested by building all 28 Zephyr toolchains and running a set of Zephyr tests using the resulting compilers. As an alternative, we could alter the multilib settings for each target, but that would touch many more files. If this is the preferred approach, we'll still need the first patch in this series which allows a multilib configuration that includes -Os to override the existing optimization settings used while building libgcc.