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 BD107C433F5 for ; Sun, 31 Oct 2021 23:47:06 +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 0BEEC60E9C for ; Sun, 31 Oct 2021 23:47:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0BEEC60E9C 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 D382C83475; Mon, 1 Nov 2021 00:47:03 +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="YwyM+BaX"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D7BE9833B5; Mon, 1 Nov 2021 00:47:00 +0100 (CET) Received: from mail-ua1-x92e.google.com (mail-ua1-x92e.google.com [IPv6:2607:f8b0:4864:20::92e]) (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 E4E7482982 for ; Mon, 1 Nov 2021 00:46:55 +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-ua1-x92e.google.com with SMTP id o26so28837545uab.5 for ; Sun, 31 Oct 2021 16:46:55 -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=+xzITDQOz9xLMNx9BKwU3bu2wIsZHMrhrHJJRw866kk=; b=YwyM+BaXhKsd73o0A2PjWEN8gvFf/XGwNdZefqeu6pgLgCk8CHBF/E2hox7+I1HBvA jLOlcnXs03XYUMHZfV4F3lqjrwRND0ueoBa5WTs+8vR/UlpOLvPTBUaNAI1EYQR2SM3m pEnG/sB1RMenHRy7aVCdiV0LX2AUegyxOwq2g= 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=+xzITDQOz9xLMNx9BKwU3bu2wIsZHMrhrHJJRw866kk=; b=8GlzJiGMRLf0S8CxYJZy6fnRnsK3totfGBNKGYy+0uWzVSbNoJRimHrO7bTkc7Hy+C /s7iR7T4tqswpoeVSlJJYNURkUAgYdpgoz1ht8KTctHLdNrY3Lh6yW6yk3XWuNn8ETy/ 2UDdrlWUugCkvowvLHUfnbZcFvVY6Mkldn4yjZKqxnpn3O/VXG56M04epsG6BvdaqODU jDnyh9MVFnZqnJlVv1nb7UhmGzle29+rNO0f3I1Dhap4nRxPuUVuRhHSXDuxH8sI4weX 1WgAEhgb9zf3rSuvxt5/9n+auDmuKtiWjTaFCmFvUUCfBCe0S2XpmBKkEsEl2f6iuOuC Vicw== X-Gm-Message-State: AOAM53204ombGh97qP4bbOpca9DIzDQQ7fl1yr00Fs5Ivz7TqVpihIgM /AkpLufJDHJoeQfeSKzShYEJ1Mn7Ks/lY/IrYTVUog== X-Google-Smtp-Source: ABdhPJxwXqEFCxIN8jAYZjFTD5XNdKGv2dRUSIV/sC/P0/lcWSYeGA4B1VEmNAfPbJ+K3IvuFQNwwzckxrBCg86P0SU= X-Received: by 2002:a67:3087:: with SMTP id w129mr24897293vsw.15.1635724014334; Sun, 31 Oct 2021 16:46:54 -0700 (PDT) MIME-Version: 1.0 References: <20211023232635.9195-1-sjg@chromium.org> <20211023232635.9195-3-sjg@chromium.org> <20211027131340.GT8284@bill-the-cat> In-Reply-To: <20211027131340.GT8284@bill-the-cat> From: Simon Glass Date: Sun, 31 Oct 2021 17:46:43 -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 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. Regards, Simon