From patchwork Mon Oct 14 23:18:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Packard X-Patchwork-Id: 1997130 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=lbQm7ftc; 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=lR6mIn1j; 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 4XSD8f4nfjz1xsc for ; Tue, 15 Oct 2024 10:34:26 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D8FD13858414 for ; Mon, 14 Oct 2024 23:34:24 +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 160B73858414 for ; Mon, 14 Oct 2024 23:33:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 160B73858414 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 160B73858414 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=1728948844; cv=none; b=iXglCFQzfJd+JmqhVtut8bCeX9bVkaLDIqfGsZa8wpqluYPvGLJvQPDAmcFsoamy0YvfFFS/fwrtS+xcJtSx7/qolfN6OnnEFnS68FUO8XkWZLiTmudkUQGwm/5Jq7xN9TTFIJfhLmgwvrPLOwk+iZ30a5fXK+ofm8n6M8Li3D8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728948844; c=relaxed/simple; bh=T8mpv0aWwGV9LdqKWdCvRax0HDNm0cu077ogUcr2kh0=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=NqsyyNhhtKd093E8gQebnmE0At9dMMqlvb+e6kpUKWhEh77BkESCEUGISJU/na0y2LP0HeBzlkUYdN6gcRGM/mJchaD5XXJKItT3Jz+p8Pdf7yJxy06micy8P/l+ho9c4nVr6E+pYHle6wiZUECiFhhY8HZ+lpFr9rZ0aU1cg5E= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=keithp.com; s=mail; t=1728948837; bh=T8mpv0aWwGV9LdqKWdCvRax0HDNm0cu077ogUcr2kh0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lbQm7ftcvv70szUaGD4AtAbEWak0OXJIJmSzrcUzu/XBP2Id7tQOO6U64YNSmqGCk 3raSh6uHGdRl8ADx8XS+6WAeCajKpofbrPuQdzWg2hl0+TAcdcMnhb66SVh08g0zRo hxWIit8cP58v1lDEFD+sJHk+vqnSqXNQ5lCARU80wzuLtT1kUWPdbl3rLScFtuPsvA vGWdspupQdCcnH8NdKDevsUvy9maZzw1So58D44EBnPPZHOm//CLzqJEd//1jDkL8n /fywxHwaz45S33MuxYr1xKFqn1VVaw6BNzw+4XUYvHIzsIlHHv3IgnKyyhV6Hd1oVu bhEFUiUA/iqVg== Received: from localhost (localhost [127.0.0.1]) by elaine.keithp.com (Postfix) with ESMTP id 2D9AE3F20561 for ; Mon, 14 Oct 2024 16:33:57 -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 ujyP241R8jmR; Mon, 14 Oct 2024 16:33:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=keithp.com; s=mail; t=1728948834; bh=T8mpv0aWwGV9LdqKWdCvRax0HDNm0cu077ogUcr2kh0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lR6mIn1jq1xqaNdl8+jHDFck4fyQZZZI1JHQ9fSLThV/ryOQ7DU3uKy/wP8dkHDFj K9WzDFCMbEEFH7XI4wv1PLzAuVm+Js67rbO4n2KYBnIVrPwRjq0yTu/I1qXsFsUo5d sI/kaPCrVntzigOkuKbMfqiZ27ekY3AZCbkmdL/p39hfeIdUhls3TP6D4nc4sDqdBA izYVg69YuhPhNuudyQfWtxxQOGSDsXjYX0k3x7dKtStKVwagq+fIklMvtAUjhjASq1 tS0S6AFbo6rfhJa3VS9UqJWRD+RO2tSljPc2PClczqEKqhd+d1iOuXn0N8dC+uuQye RcCcFP/tJ4YBw== Received: from keithp.com (koto.keithp.com [192.168.11.2]) by elaine.keithp.com (Postfix) with ESMTPSA id D07C53F20817; Mon, 14 Oct 2024 16:33:54 -0700 (PDT) Received: by keithp.com (Postfix, from userid 1000) id 86A931E60238; Tue, 15 Oct 2024 01:33:54 +0200 (CEST) From: Keith Packard To: gcc-patches@gcc.gnu.org Cc: Keith Packard Subject: [PATCH 1/2] libgcc: Use -Os/-Oz from CC or CFLAGS Date: Mon, 14 Oct 2024 16:18:34 -0700 Message-ID: <20241014233350.1625639-2-keithp@keithp.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241014233350.1625639-1-keithp@keithp.com> References: <20241014233350.1625639-1-keithp@keithp.com> MIME-Version: 1.0 X-Spam-Status: No, score=-9.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, LIKELY_SPAM_BODY, 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 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 Override other optimization settings with any -Os or -Oz found in CC or CFLAGS. libgcc/ChangeLog: * Makefile.in: Use -Os or -Oz from CC or CFLAGS Signed-off-by: Keith Packard --- libgcc/Makefile.in | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in index ffc45f21267..25710636938 100644 --- a/libgcc/Makefile.in +++ b/libgcc/Makefile.in @@ -294,16 +294,20 @@ override CFLAGS := $(filter-out -fprofile-generate -fprofile-use,$(CFLAGS)) # CFLAGS first is not perfect; normally setting CFLAGS should override any # options in LIBGCC2_CFLAGS. But LIBGCC2_CFLAGS may contain -g0, and CFLAGS # will usually contain -g, so for the moment CFLAGS goes first. We must -# include CFLAGS - that's where multilib options live. +# include CFLAGS - that's where multilib options live. If CC or CFLAGS +# specify -Os or -Oz, we want that to override our local options as that +# could be a multilib flag. INTERNAL_CFLAGS = $(CFLAGS) $(LIBGCC2_CFLAGS) $(HOST_LIBGCC2_CFLAGS) \ - $(INCLUDES) @set_have_cc_tls@ @set_use_emutls@ + $(INCLUDES) @set_have_cc_tls@ @set_use_emutls@ \ + $(filter -Os -Oz,$(CC) $(CFLAGS)) # Options to use when compiling crtbegin/end. CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \ $(NO_PIE_CFLAGS) -finhibit-size-directive -fno-inline -fno-exceptions \ -fno-zero-initialized-in-bss -fno-toplevel-reorder -fno-tree-vectorize \ -fbuilding-libgcc -fno-stack-protector $(FORCE_EXPLICIT_EH_REGISTRY) \ - $(INHIBIT_LIBC_CFLAGS) $(USE_TM_CLONE_REGISTRY) + $(INHIBIT_LIBC_CFLAGS) $(USE_TM_CLONE_REGISTRY) \ + $(filter -Os -Oz,$(CC) $(CFLAGS)) # Extra flags to use when compiling crt{begin,end}.o. CRTSTUFF_T_CFLAGS =