From patchwork Tue Jan 2 08:36:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Petazzoni X-Patchwork-Id: 1881550 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=140.211.166.137; helo=smtp4.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=patchwork.ozlabs.org) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (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 4T45n102Bzz1ygb for ; Tue, 2 Jan 2024 19:36:52 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 341B840743; Tue, 2 Jan 2024 08:36:51 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 341B840743 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Ixryf_hmOuAC; Tue, 2 Jan 2024 08:36:50 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp4.osuosl.org (Postfix) with ESMTP id 727D1405D8; Tue, 2 Jan 2024 08:36:49 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 727D1405D8 X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 3C1EA1BF5A6 for ; Tue, 2 Jan 2024 08:36:48 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 064B540370 for ; Tue, 2 Jan 2024 08:36:48 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 064B540370 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KbQetUVeSV9L for ; Tue, 2 Jan 2024 08:36:47 +0000 (UTC) Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by smtp2.osuosl.org (Postfix) with ESMTPS id C490F4020B for ; Tue, 2 Jan 2024 08:36:46 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org C490F4020B Received: by mail.gandi.net (Postfix) with ESMTPA id 3E28D240006; Tue, 2 Jan 2024 08:36:45 +0000 (UTC) To: Buildroot List Date: Tue, 2 Jan 2024 09:36:42 +0100 Message-ID: <20240102083643.3055484-1-thomas.petazzoni@bootlin.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-GND-Sasl: thomas.petazzoni@bootlin.com X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1704184605; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=BLUgLKpaUOP2m19YSWe+alnkiUn7Xumx1EAZK1OGQBA=; b=RVljY5TAobyDsX9pQqCqT5suXEhB/MCqxWFk7hKMlFVBK0rTqOUAZaKdiD7daan1RZu2ue JM7DF7QGxt2AOmIEXlI8L1xm+iEuSd/WJiJVnEr5WIh1Pd+JelsyonP571W7Z/KHV225st dRvcxr5gAWmi8lNvCS2tQhVaFZ0b9/3bCEpdYflsdq2EJzd0xHvfuBAhNq0Xv6M5qX82Dh PzbgpVmh08frhA7GIckpbJPPsMwiDNqm6AK+TnZkMsBPPakEkT3j2Mo95W20vHe6Ej9Dbj pFNkuSn0mCsFijGuwqRnbRmZBr3D0Ap2WDNTaM2VzmbSnPuRapVcmejMsiZb7Q== X-Mailman-Original-Authentication-Results: smtp2.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=gm1 header.b=RVljY5TA Subject: [Buildroot] [PATCH v3] Config.in: change default optimization level from -Os to -O2 X-BeenThere: buildroot@buildroot.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Thomas Petazzoni via buildroot From: Thomas Petazzoni Reply-To: Thomas Petazzoni Cc: "Yann E. MORIN" , Thomas Petazzoni Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" Historically, Buildroot has defaulted to -Os as the gcc optimization flags. However, this default is probably not the most appropriate anymore, and this commit therefore changes the default to -O2. Here are some arguments in favor of this change: - Most Buildroot users use Buildroot for platforms that have a reasonable amount of storage, and the difference between -Os and -O2 in terms of code size is no longer as significant compared to the size of storage available on average embedded Linux devices typically found these days. - -Os can have a pretty bad performance impact, compared to -O2. - -Os is much less widely tested than -O2. For example, with recent versions of gcc, there are parts of Qt5 that segfault when compiled with -Os and work perfectly fine with -O2. Yes, it's a compiler bug that should be fixed, but in the mean time, having a default that's more widely used/tested makes sense. Signed-off-by: Thomas Petazzoni Acked-by: Yann E. MORIN --- Config.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Config.in b/Config.in index 554b4062eb..bd4bf872aa 100644 --- a/Config.in +++ b/Config.in @@ -474,7 +474,7 @@ config BR2_STRIP_EXCLUDE_DIRS choice prompt "gcc optimization level" - default BR2_OPTIMIZE_S + default BR2_OPTIMIZE_2 help Set the optimization level for gcc @@ -520,6 +520,7 @@ config BR2_OPTIMIZE_2 -falign-loops -falign-labels -ftree-vrp -ftree-pre. Please note the warning under -fgcse about invoking -O2 on programs that use computed gotos. + This is the default. config BR2_OPTIMIZE_3 bool "optimization level 3" @@ -548,7 +549,6 @@ config BR2_OPTIMIZE_S -falign-loops -falign-labels -freorder-blocks -freorder-blocks-and-partition -fprefetch-loop-arrays -ftree-vect-loop-version - This is the default. config BR2_OPTIMIZE_FAST bool "optimize for fast (may break packages!)"