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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 03FA7C64EC4 for ; Thu, 9 Mar 2023 16:23:30 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F32ED85EA5; Thu, 9 Mar 2023 17:22:42 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com 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=konsulko.com header.i=@konsulko.com header.b="lk4Js7M7"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4E3D385AB0; Thu, 9 Mar 2023 17:22:27 +0100 (CET) Received: from mail-qt1-x831.google.com (mail-qt1-x831.google.com [IPv6:2607:f8b0:4864:20::831]) (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 F1AB285C5A for ; Thu, 9 Mar 2023 17:22:18 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qt1-x831.google.com with SMTP id r16so2531713qtx.9 for ; Thu, 09 Mar 2023 08:22:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; t=1678378937; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Hl2LSJUmuk9UrlQSKYfYFrt8ALBJ+ODLZB4lzkXSJYE=; b=lk4Js7M7oX/xHF+1aVb6q6nHp30jjl+9hImEGoiRAm2ekn9ZJVLBbb4DVUjr2KkG8I H0M2ohY/sYpgchrZLPPQG95KpGoBSlE8rek2276Svdp9Zr+4w5kld7Wf6F09XLkKUONI R21Fc7984uc4VrpMudKF9bx2h5wZP1+AqolJw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678378937; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Hl2LSJUmuk9UrlQSKYfYFrt8ALBJ+ODLZB4lzkXSJYE=; b=dKY3z8lShqcmjhVPkdHtgmKyeE9EDPynpDrYDsbyeFysKRIuWTXfnFVt3RUQhwYtoK dQl6i3JudXngqldPMl5a6kXSK1J86Fl4qZCDk04ZONO9d2mnYj+BKSBeaEDZJFtfP6a6 4n/U+JgqAIHgfLnRpAoiNCkll7A9n1pDZCjNCtxs3zhZ8YKP8/PsKlnUn1yR2p2LUruj FZW85CyOk6/8e4pcBsd2Pcqbx0ySqPXk2Qn38qsMWiIjg9gqZbfanW9GuVQ/m5HcV3g6 He6cA//CNAYydKXOjbeOLMxYZRpMdYqS/vDTGJ3tx+lBM4czNUknTU0o88+2sPLEUaJt vAaw== X-Gm-Message-State: AO0yUKXbNFnxTb5FrEt7zAKR70vx8ylHman5sUkHhqK+CFFD5DB3uGgj IRLUDi80pkImz6CwYd68xPGLYIVdQKgTuNP0UUZuEA== X-Google-Smtp-Source: AK7set/pg9ycCxn2FD5ehRH78WJJJamh+tC5+sU4jjD0tLCTSNtcR/PtlndbAHVjroQOXcHZvM0RrA== X-Received: by 2002:a05:622a:1b9e:b0:3bd:db4:b967 with SMTP id bp30-20020a05622a1b9e00b003bd0db4b967mr39731955qtb.58.1678378937627; Thu, 09 Mar 2023 08:22:17 -0800 (PST) Received: from bill-the-cat.lan (2603-6081-7b00-6400-0000-0000-0000-036b.res6.spectrum.com. [2603:6081:7b00:6400::36b]) by smtp.gmail.com with ESMTPSA id r145-20020a37a897000000b0073b69922cfesm13828287qke.85.2023.03.09.08.22.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Mar 2023 08:22:17 -0800 (PST) From: Tom Rini To: u-boot@lists.denx.de Subject: [PATCH 6/6] RFC: arm: Enable LTO by default Date: Thu, 9 Mar 2023 11:22:12 -0500 Message-Id: <20230309162212.2096573-6-trini@konsulko.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230309162212.2096573-1-trini@konsulko.com> References: <20230309162212.2096573-1-trini@konsulko.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean At this point, we have had wide enough testing of LTO on ARM platforms that we hope to have covered all of the issues that linking in manner exposes in terms of run-time failures. Note that on 32bit ARM we must use our private libgcc in order to ensure that we do not have a size mismatch over wchar_t, and we're missing some thumb1 assembly functions for LTO to be usable in that case. Enable this by default, on ARM. Signed-off-by: Tom Rini --- This is not yet ready to go. As noted in this[0] thread there's some issues with weak functions. In addition, platforms such as socfpga_n5x_vab (and _atf) have their SPL grow and meesc_dataflash grows itself. This seems to be in part due to how the sha1_process_one/sha256_process_one abstractions interact with LTO. There might be more issues like this, but it's harder to spot just due to how LTO will essentially inline a large number of functions. Further, my pine64_plus fails to boot with LTO and loops on: U-Boot SPL 2023.04-rc3-00196-gbe79da84c30b-dirty (Mar 08 2023 - 16:10:56 -0500) DRAM: 1024 MiB Trying to boot from MMC1 Trying to boot from MMC1 (repeats) So this very much isn't ready for everyone, just yet. [0]: https://lore.kernel.org/u-boot/783cfab5-feb0-1148-f4be-125195275c98@gmx.de/ --- Kconfig | 2 ++ configs/qemu_arm_defconfig | 1 + 2 files changed, 3 insertions(+) diff --git a/Kconfig b/Kconfig index a75cce7e28fb..14693a92c1b3 100644 --- a/Kconfig +++ b/Kconfig @@ -121,6 +121,8 @@ config ARCH_SUPPORTS_LTO config LTO bool "Enable Link Time Optimizations" depends on ARCH_SUPPORTS_LTO + select USE_PRIVATE_LIBGCC if ARM && !ARM64 + default y if ARM && !(SYS_THUMB_BUILD || SPL_SYS_THUMB_BUILD) help This option enables Link Time Optimization (LTO), a mechanism which allows the compiler to optimize between different compilation units. diff --git a/configs/qemu_arm_defconfig b/configs/qemu_arm_defconfig index aa6bf931b5fd..820f78e76311 100644 --- a/configs/qemu_arm_defconfig +++ b/configs/qemu_arm_defconfig @@ -16,6 +16,7 @@ CONFIG_SYS_LOAD_ADDR=0x40200000 CONFIG_ENV_ADDR=0x4000000 CONFIG_DEBUG_UART=y CONFIG_AHCI=y +# CONFIG_LTO is not set CONFIG_FIT=y CONFIG_FIT_SIGNATURE=y CONFIG_FIT_VERBOSE=y -- 2.34.1