From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE129C433EF for ; Thu, 4 Nov 2021 02:49:23 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1EB0861059 for ; Thu, 4 Nov 2021 02:49:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1EB0861059 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 64D848363F; Thu, 4 Nov 2021 03:49:20 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="ejKDrzuo"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 498848364D; Thu, 4 Nov 2021 03:49:18 +0100 (CET) Received: from mail-vk1-xa2c.google.com (mail-vk1-xa2c.google.com [IPv6:2607:f8b0:4864:20::a2c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 09F18807D7 for ; Thu, 4 Nov 2021 03:49:13 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@google.com Received: by mail-vk1-xa2c.google.com with SMTP id p22so608640vke.7 for ; Wed, 03 Nov 2021 19:49:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=gofaD5jcEAVHEtLbd4OvZ8iuVQX/JyeFjaRpwzv8his=; b=ejKDrzuoRE/tAySufl/Rld4YyT8QhOONl55BBxs3HweKmueaFfxSf2HAynEr1Fu8gN C/mcPR69y3jCO0OiUiUU5PLtB2FVNhw9AHEsw550kqbVVLYtpEg8qQgP2mSC9H2E2jqn iYMLknyM9FbChDeCQ4tNE5nW5RG2pg0G/xTbE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=gofaD5jcEAVHEtLbd4OvZ8iuVQX/JyeFjaRpwzv8his=; b=BWPWtnLmnMFVhmO4Hn1seYvJmEy4m8OpFOEBSPTJa9EQ0xnO2j1NYeQCEakQY0yZx1 0RVc7V6TsqFhJEsTQ51j95sIxV8S4voONUEQh2TUeHc5ox28gE6U2VJHlob7PcVkALaD ng9573Gt9WmnWRPUlIgdM/9HxbLg9ZJnTMpM4NIx9QD6ZMwmBg/G2fxLFXRsHab5DI98 0/0+QAHq90eJkGAF4/dXD7D2QeKW6jLip6LMctLyXh7bHWbzRSjogDzwOH0LEQ+7BQKA yPk54/Y23kO+Sau0Tdx1PGXevtpArbzcJfFPcMcEGbNi6w8prIFleXZphYVfPKJp/VZi PK6Q== X-Gm-Message-State: AOAM5316nrwxqx+fBBi/OxP2B4HJuhqO9kIVb6aHF5qH92BwcLUvzCIK /t0BVQU20S8aI1NTG6FKN/U2PSJd1b6bVFra7qCKOg== X-Google-Smtp-Source: ABdhPJxbb03dtWAsp1SrykydISw/shotT1zpIi2nVDkjEBEtLmlukyFasE2siM71nLdkzfW3tD9AtNG1FDCNpUPcDJ0= X-Received: by 2002:a05:6122:78a:: with SMTP id k10mr54811858vkr.24.1635994152473; Wed, 03 Nov 2021 19:49:12 -0700 (PDT) MIME-Version: 1.0 References: <20211023232635.9195-1-sjg@chromium.org> <20211023232635.9195-3-sjg@chromium.org> <20211027131340.GT8284@bill-the-cat> <20211101215805.GN24579@bill-the-cat> In-Reply-To: <20211101215805.GN24579@bill-the-cat> From: Simon Glass Date: Wed, 3 Nov 2021 20:49:01 -0600 Message-ID: Subject: Re: [PATCH v2 02/41] Makefile: Allow LTO to be disabled for a build To: Tom Rini Cc: Heinrich Schuchardt , U-Boot Mailing List , Michal Simek , Daniel Schwierzeck , Steffen Jaeckel , =?UTF-8?B?TWFyZWsgQmVow7pu?= , Lukas Auer , Dennis Gilmore , Masahiro Yamada , Ilias Apalodimas , Heinrich Schuchardt Content-Type: text/plain; charset="UTF-8" X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Hi Tom, On Mon, 1 Nov 2021 at 15:58, Tom Rini wrote: > > On Sun, Oct 31, 2021 at 05:46:43PM -0600, Simon Glass wrote: > > Hi Tom, > > > > On Wed, 27 Oct 2021 at 07:13, Tom Rini wrote: > > > > > > On Wed, Oct 27, 2021 at 02:21:17PM +0200, Heinrich Schuchardt wrote: > > > > > > > > > > > > On 10/27/21 10:50, Ilias Apalodimas wrote: > > > > > Hi Simon > > > > > > > > > > How does this patch related to the standard boot series? Shouldn't > > > > > this be a completely separate patch? > > > > > > > > > > Thanks > > > > > /Ilias > > > > > > > > > > On Sun, 24 Oct 2021 at 02:26, Simon Glass wrote: > > > > > > > > > > > > LTO (Link-Time Optimisation) is an very useful feature which can > > > > > > significantly reduce the size of U-Boot binaries. So far it has been > > > > > > made available for selected ARM boards and sandbox. > > > > > > > > > > > > However, incremental builds are much slower when LTO is used. For example, > > > > > > an incremental build of sandbox takes 2.1 seconds on my machine, but 6.7 > > > > > > seconds with LTO enabled. > > > > > > > > > > > > Add a LTO_BUILD=n parameter to the build, so it can be disabled during > > > > > > development if needed, for faster builds. > > > > > > > > > > > > Add some documentation about LTO while we are here. > > > > > > > > > > > > Signed-off-by: Simon Glass > > > > > > --- > > > > > > > > > > > > (no changes since v1) > > > > > > > > > > > > Makefile | 18 +++++++++++++----- > > > > > > arch/arm/config.mk | 4 ++-- > > > > > > arch/arm/include/asm/global_data.h | 2 +- > > > > > > doc/build/gcc.rst | 17 +++++++++++++++++ > > > > > > 4 files changed, 33 insertions(+), 8 deletions(-) > > > > > > > > > > > > diff --git a/Makefile b/Makefile > > > > > > index b79b2319ff6..7057723e046 100644 > > > > > > --- a/Makefile > > > > > > +++ b/Makefile > > > > > > @@ -434,6 +434,9 @@ KBUILD_CFLAGS += -fshort-wchar -fno-strict-aliasing > > > > > > KBUILD_AFLAGS := -D__ASSEMBLY__ > > > > > > KBUILD_LDFLAGS := > > > > > > > > > > > > +# Set this to "n" use of LTO for this build, e.g. LTO_BUILD=n > > > > > > +LTO_BUILD ?= y > > > > > > > > This does not allow LTO_BUILD=y to enable LTO for CONFIG_LTO=n. > > > > > > I don't understand why we need this patch at all. If you want to > > > disable LTO, disable LTO. Yes, LTO makes linking take longer which can > > > be annoying on iterative development. I have a few different "HACK: DO > > > NOT PUSH: ..." things I git am at the start of a branch, depending on > > > needs. You can just do that to drop "imply LTO" from the SANDBOX stanza > > > in arch/Kconfig. We do not need a whole thing around a CONFIG option > > > that can be disabled in the defconfig, or local .config file even. > > > > > > > Cranky time. > > > > Of course we don't *need* it. I could just buy a slower build machine > > and type with two fingers. There are lots of ways to slow things down > > and LTO is one of them. I change branches at least a dozen times a day > > and am always trying things out from patchwork. I am sure others do > > too. LTO dramatically slows down builds. Having a way to easily do > > this from the build system saves time. > > Maybe the answer is that LTO just isn't appropriate for sandbox. We're > not doing any specific tests for LTO anywhere (nor does that seem > appropriate), and we do have platforms in CI that run tests other than > building, with LTO. It has value as a test, I presume, and a demo of how it works. Also it runs most of the tests. But I'm happy to disable it if that helps. Still, it doesn't really solve the issue. The same thing happens when building real boards. Regards, Simon