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 X-Spam-Level: X-Spam-Status: No, score=-17.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC30EC4708F for ; Tue, 1 Jun 2021 15:05:52 +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 D25D160E0B for ; Tue, 1 Jun 2021 15:05:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D25D160E0B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8403982EA5; Tue, 1 Jun 2021 17:05:49 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (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="NePye5DR"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 237C182EC9; Tue, 1 Jun 2021 17:05:48 +0200 (CEST) Received: from mail-qk1-x72f.google.com (mail-qk1-x72f.google.com [IPv6:2607:f8b0:4864:20::72f]) (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 212BE82EA5 for ; Tue, 1 Jun 2021 17:05:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qk1-x72f.google.com with SMTP id u30so1056530qke.7 for ; Tue, 01 Jun 2021 08:05:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=3PEybfbGFVROrbFmyy2nOL5mCbZc/cVgIyIuYkjqcG0=; b=NePye5DRMsStnnJnykSRZuDYVS47P6FwaMD3SGvhtPT30++e/vddhrZBKcmw8NBczM tyoTv9my+RvXB71i8+rVRYWd6oidAyGu8AeC3zfDbXpqjBG5kmnIrh7VPc5UfqpkdaOu Xi+VNR8E5Yrc/laQAuKnNBm6+Hw7lwLtykLes= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=3PEybfbGFVROrbFmyy2nOL5mCbZc/cVgIyIuYkjqcG0=; b=TFVNXdgTQpu+CtC6WAa+ZgGlSzAFTLYCGjlwvhVV+HFufGNpYG7JNqnbnIHXHkPfQe 4DMcy+QkrGqWW81pgUTgbyO12//QDRkk0oxR040sVxwexrRkl7LuUbVNu7qRMJtIIomh qoga/QNBhTHDNOSD4oZjL4qAOb0f+xHFs8r+n5SfokTHzf/2e9d9gpsZXxnUrzW9OXSK 6uD/zu0oRdwa4hf+JOkRNKWn7tyvOFyaswPQvZMoOOKamS7vf6WvlUp6bLw3pDc4CRaE J2JJAuqYBh0LIRw403d9Q3ZklnWS2Yjmic9I0vxfcCAC53eyAFsx3SRs+93RALOYSig0 am5g== X-Gm-Message-State: AOAM530FHqCHSCH7kuUMW9b4EW+4MtifMwOfjPJdbhA0K9dfk3XXchKg givEIgJmMA5TFTfEz0eU1xL1uA== X-Google-Smtp-Source: ABdhPJyjwxUywjQTSkjwaq+l+EUpwvR7Ac/4D6EgOJopBH7tuenvrTiYHBPxBjpc8jdW65sE1YzmeA== X-Received: by 2002:a37:638e:: with SMTP id x136mr22253643qkb.109.1622559940834; Tue, 01 Jun 2021 08:05:40 -0700 (PDT) Received: from bill-the-cat (2603-6081-7b01-cbda-98df-de31-e21d-e1a1.res6.spectrum.com. [2603:6081:7b01:cbda:98df:de31:e21d:e1a1]) by smtp.gmail.com with ESMTPSA id a10sm10153287qtg.40.2021.06.01.08.05.38 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 01 Jun 2021 08:05:39 -0700 (PDT) Date: Tue, 1 Jun 2021 11:05:36 -0400 From: Tom Rini To: Patrick DELAUNAY Cc: Marek =?iso-8859-1?Q?Beh=FAn?= , u-boot@lists.denx.de, Simon Glass , Heiko Schocher , Patrick Delaunay , Patrice CHOTARD , Miquel Raynal , Pali =?iso-8859-1?Q?Roh=E1r?= , Stefan Roese , Heinrich Schuchardt , Alexander Graf , Marek Vasut , Neil Armstrong , Ryder Lee , Adam Ford , Bin Meng , Harald Seiler , Tim Harvey Subject: Re: [PATCH u-boot v4 00/36] U-Boot LTO (Sandbox + Some ARM boards) Message-ID: <20210601150536.GH14385@bill-the-cat> References: <20210520112425.25166-1-marek.behun@nic.cz> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="q9KOos5vDmpwPx9o" Content-Disposition: inline In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.9.4 (2018-02-28) 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.102.4 at phobos.denx.de X-Virus-Status: Clean --q9KOos5vDmpwPx9o Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jun 01, 2021 at 04:59:52PM +0200, Patrick DELAUNAY wrote: > Hi Marek, >=20 > On 5/20/21 1:23 PM, Marek Beh=FAn wrote: > > Hello, > >=20 > > this is version 4 of patches adding support for LTO to U-Boot. > >=20 > > This series is being tested by Github/Azure CI at > > https://github.com/u-boot/u-boot/pull/57 > >=20 > > There is a problem with sandbox_clang test scenario, which I was > > unable to resolve yet, or even determine correctly whether the > > problem is with my patches or was there before. (One of the > > problems is with testing stack protector test_stackprotector.py, > > but for some reason I could not make this work even with GCC on > > my local machine.) > > Nevertheless I am sending these patches now so that at least you > > can review them. In the meantime I will try to resolve the issue > > with sandbox_clang test scenario. > >=20 > > Changes since v3: > > - for some reason the mvneta driver does not work correctly when > > U-Boot is compiled with LTO. I have not debugged this issue yet, so > > for now I have removed Turris Omnia and Turris MOX from devices with > > enabled LTO > > - linker list entry symbols are now forced to emit by using the > > __ADDRESSABLE macro in a generated C file (keep-syms-lto.c). > > Previously this was done in the ll_entry_declare() macro, but this > > was not flexible, since, for example, trying to declare an entry as > > extern could not work that way. This came to attention now after > > Simon's patches for dtoc were merged, and ll_entry_declare() is > > being used with the extern keyword in include/generated/dt-decl.h > > - when compiling LTO with Clang, use llvm-ar and llvm-nm for AR and NM > > - several patches rebased > > - removed patch "api: fix a potential serious bug caused by undef > > CONFIG_SYS_64BIT_LBA" > > - updated patch converting __attribute__((section(...))) to > > __section(...) > >=20 > > Changes sinve v2: > > - now linking with --build-id=3Dnone in order to avoid link failures wi= th > > some toolchains (thanks Herald Seiler) > > - we don't use -flto=3Djobserver anymore, since it causes build errors = for > > some people. Instead we link with -flto=3DNPROC > > - removed LTO exception for arch/arm/mach-omap2/omap3/clock.o, Adam Ford > > says it is not needed > > - added some Reviewed-by tags > >=20 > > Changes since v1: > > - remove patches applied into u-boot-marvell > > - added Reviewed-by tags > > - addressed some issues discovered by Bin Meng, Marek Vasut, > > Heinrich Schuchardt > > - added more ARM boards (thanks to Adam Ford, Tim Harvey and Bin Meng) > > - removed --gc-sections for ARM if internal libgcc is used > > - remove -fwhole-program in final LTO LDFLAGS > > - declared all 4 functions (memcpy, memset, memcmp, memmove) __used, > > (these are mentioned in GCC man page for option -nodefaultlibs that > > the compiler may generate; this seems to be a bug in GCC that linki= ng > > fails with LTO even if these functions are present, because the > > symbols can be renamed on some targets by optimization) > >=20 > > Marek > >=20 > > Marek Beh=FAn (36): > > regmap: fix a serious pointer casting bug > > checkpatch: require quotes around section name in the __section() > > macro > > treewide: Convert macro and uses of __section(foo) to __section("foo= ") > > compiler.h: align the __ADDRESSABLE macro with Linux' version > > test/py: improve regular expression for ut subtest symbol matcher > > string: make memcpy(), memset(), memcmp() and memmove() visible for > > LTO > > efi_loader: fix warning when linking with LTO > > efi_loader: add Sphinx doc for __efi_runtime and __efi_runtime_data > > efi_loader: add macro for const EFI runtime data > > efi_selftest: compiler flags for efi_selftest_miniapp_exception.o > > lib: crc32: put the crc_table variable into efi_runtime_rodata secti= on > > Makefile, Makefile.spl: cosmetic change > > build: use thin archives instead of incremental linking > > build: support building with Link Time Optimizations > > build: link with --build-id=3Dnone > > sandbox: errno: avoid conflict with libc's errno > > sandbox: use sections instead of symbols for getopt array boundaries > > sandbox: make LTO available > > sandbox: enable LTO by default > > ARM: global_data: make set_gd() work for armv5 and armv6 > > ARM: make gd a function call for LTO and set via set_gd() > > ARM: fix LTO build for some thumb-interwork cases > > ARM: fix LTO for imx28_xea > > ARM: fix LTO for apf27 > > ARM: fix LTO for keystone > > ARM: kona: fix clk_bsc_enable() type mismatch for LTO > > ARM: imx8m: fix imx_eqos_txclk_set_rate() type mismatch for LTO > > ARM: fix LTO for seaboard > > ARM: fix LTO for rockchip and samsung > > ARM: omap3: fix LTO for DM3730 (and possibly other omap3 boards) > > armv8: SPL: discard relocation information > > ata: ahci: fix ahci_link_up() type mismatch for LTO > > ARM: make LTO available > > ARM: don't use -ffunction-sections/-fdata-sections with LTO build > > ARM: don't use --gc-sections with LTO when using private libgcc > > ARM: enable LTO for some boards > >=20 > > Kbuild | 2 + > > Kconfig | 24 +++++++ > > Makefile | 81 ++++++++++++++++++++-- > > arch/Kconfig | 3 + > > arch/arm/config.mk | 10 ++- > > arch/arm/cpu/arm926ejs/Makefile | 2 + > > arch/arm/cpu/arm926ejs/mxs/mxs.c | 2 +- > > arch/arm/cpu/arm926ejs/mxs/spl_boot.c | 4 +- > > arch/arm/cpu/arm926ejs/spear/spl.c | 2 +- > > arch/arm/cpu/armv7/kona-common/clk-stubs.c | 2 +- > > arch/arm/cpu/armv7/ls102xa/ls102xa_psci.c | 2 +- > > arch/arm/cpu/armv8/spl_data.c | 4 +- > > arch/arm/cpu/armv8/u-boot-spl.lds | 1 + > > arch/arm/include/asm/global_data.h | 6 +- > > arch/arm/include/asm/secure.h | 6 +- > > arch/arm/include/asm/setup.h | 2 +- > > arch/arm/lib/Makefile | 3 + > > arch/arm/lib/sections.c | 31 +++++---- > > arch/arm/lib/spl.c | 2 +- > > arch/arm/mach-at91/spl.c | 2 +- > > arch/arm/mach-exynos/spl_boot.c | 2 +- > > arch/arm/mach-imx/imx8m/clock_imx8mm.c | 2 +- > > arch/arm/mach-imx/imx8m/soc.c | 2 +- > > arch/arm/mach-imx/spl_imx_romapi.c | 16 ++--- > > arch/arm/mach-k3/am642_init.c | 2 +- > > arch/arm/mach-k3/am6_init.c | 2 +- > > arch/arm/mach-k3/j721e_init.c | 4 +- > > arch/arm/mach-keystone/Makefile | 1 + > > arch/arm/mach-mvebu/mbus.c | 4 +- > > arch/arm/mach-mvebu/timer.c | 2 +- > > arch/arm/mach-nexell/clock.c | 6 +- > > arch/arm/mach-nexell/timer.c | 6 +- > > arch/arm/mach-omap2/omap3/Makefile | 1 + > > arch/arm/mach-rockchip/board.c | 2 +- > > arch/arm/mach-socfpga/spl_a10.c | 2 +- > > arch/arm/mach-sunxi/board.c | 2 +- > > arch/arm/mach-tegra/board.c | 2 +- > > arch/arm/mach-tegra/cboot.c | 8 +-- > > arch/arm/mach-tegra/tegra20/Makefile | 1 + > > arch/mips/mach-jz47xx/jz4780/jz4780.c | 2 +- > > arch/nds32/include/asm/setup.h | 6 +- > > arch/powerpc/include/asm/cache.h | 4 +- > > arch/riscv/cpu/cpu.c | 4 +- > > arch/sandbox/config.mk | 14 +++- > > arch/sandbox/cpu/os.c | 3 +- > > arch/sandbox/cpu/start.c | 3 +- > > arch/sandbox/cpu/u-boot-spl.lds | 8 ++- > > arch/sandbox/cpu/u-boot.lds | 8 ++- > > arch/sandbox/include/asm/getopt.h | 2 +- > > arch/sandbox/include/asm/sections.h | 21 +++++- > > arch/sandbox/lib/sections.c | 9 +-- > > arch/x86/cpu/coreboot/timestamp.c | 2 +- > > arch/x86/lib/coreboot/cb_sysinfo.c | 2 +- > > arch/x86/lib/sections.c | 9 +-- > > arch/xtensa/cpu/cpu.c | 2 +- > > board/bosch/shc/board.c | 2 +- > > board/broadcom/bcmstb/bcmstb.c | 2 +- > > board/samsung/arndale/arndale_spl.c | 2 +- > > board/samsung/common/exynos5-dt.c | 2 +- > > board/samsung/smdk5250/smdk5250_spl.c | 2 +- > > board/samsung/smdk5420/smdk5420_spl.c | 2 +- > > board/siemens/draco/board.c | 2 +- > > board/xilinx/common/fru_ops.c | 2 +- > > configs/am3517_evm_defconfig | 1 + > > configs/da850evm_defconfig | 1 + > > configs/da850evm_direct_nor_defconfig | 1 + > > configs/da850evm_nand_defconfig | 1 + > > configs/imx6q_logic_defconfig | 1 + > > configs/imx8mm_beacon_defconfig | 1 + > > configs/imx8mm_venice_defconfig | 1 + > > configs/imx8mn_beacon_2g_defconfig | 1 + > > configs/imx8mn_beacon_defconfig | 1 + > > configs/nokia_rx51_defconfig | 1 + > > configs/omap3_logic_defconfig | 1 + > > configs/r8a774a1_beacon_defconfig | 1 + > > configs/r8a774b1_beacon_defconfig | 1 + > > configs/r8a774e1_beacon_defconfig | 1 + > > drivers/ata/ahci.c | 2 +- > > drivers/bios_emulator/biosemu.c | 4 +- > > drivers/clk/kendryte/clk.c | 4 +- > > drivers/core/regmap.c | 59 +++++++++++++++- > > drivers/firmware/psci.c | 2 +- > > drivers/mtd/nand/raw/mxc_nand_spl.c | 2 +- > > drivers/pinctrl/nxp/pinctrl-imx5.c | 2 +- > > drivers/pinctrl/nxp/pinctrl-imx7.c | 2 +- > > drivers/pinctrl/nxp/pinctrl-imx8m.c | 2 +- > > drivers/power/pmic/pmic_tps62362.c | 2 +- > > drivers/power/pmic/pmic_tps65217.c | 2 +- > > drivers/power/pmic/pmic_tps65218.c | 2 +- > > drivers/power/pmic/pmic_tps65910.c | 2 +- > > drivers/serial/serial_pl01x.c | 4 +- > > include/efi_loader.h | 54 +++++++++++++-- > > include/errno.h | 8 ++- > > include/linker_lists.h | 24 +++---- > > include/linux/compiler.h | 10 +-- > > include/linux/compiler_attributes.h | 2 +- > > lib/crc32.c | 3 +- > > lib/efi_selftest/Makefile | 2 + > > lib/errno.c | 4 +- > > lib/string.c | 9 +-- > > lib/trace.c | 4 +- > > scripts/Makefile.build | 16 ++--- > > scripts/Makefile.lib | 3 + > > scripts/Makefile.spl | 63 +++++++++++++++-- > > scripts/checkpatch.pl | 2 +- > > scripts/gen_ll_addressable_symbols.sh | 12 ++++ > > test/py/conftest.py | 2 +- > > 107 files changed, 513 insertions(+), 183 deletions(-) > > create mode 100755 scripts/gen_ll_addressable_symbols.sh > >=20 >=20 > I am trying to activate CONFIG_LTO for STMicroelectronics stm32mp15 platf= orm >=20 > (stm32mp15_trusted_defconfig and stm32mp15_basic_defconfig). >=20 >=20 > The config stm32mp15_basic_defconfig, with SPL supported failed to boot >=20 > with gcc-arm-9.2-2019.12. >=20 > because a weak function is not correctly handle between >=20 > 1/ ./arch/arm/lib/cache-cp15.c: 96 >=20 > =A0=A0=A0 __weak void dram_bank_mmu_setup(int bank); >=20 > 2/ the stm32mp implementation in >=20 > =A0=A0 arch/arm/mach-stm32mp/cpu.c:62 >=20 > =A0=A0 void dram_bank_mmu_setup(int bank) >=20 > =3D> The used function in SPL is the cache library, not the stm32mp funct= ion. >=20 > =A0=A0=A0=A0=A0 and SPL boot it OK when I remove the function in the cach= e library... Good work figuring that out. It might help lead to people figuring out some other problems with LTO off/on. FWIW, I found using buildman's size display options can also be useful. > And the issue is also solved with I use a more recent version >=20 > gcc-arm-10.2-2020.11 on my PC. >=20 >=20 > Do you see the same kind of issue for old version of gcc ? >=20 >=20 > Do you think CONFIG_LTO require a more recent version of gcc that >=20 > the minimal version required by U-Boot=A0 because I don't see this inform= ation >=20 > in the serie? Note that we only test with gcc-9.2.x right now, moving up to gcc-11. But that had its own problems I didn't get feedback on (grub+riscv32 just doesn't build, and that's an upstream problem that's been ignored as of when I posted my patches at least). --=20 Tom --q9KOos5vDmpwPx9o Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmC2TL0ACgkQFHw5/5Y0 tywkTgwAkJBKThDYhTXt1TucajXmP8zJnRHlK3tgMOcZLydAwJLB8iehqclkTw6U aAH+yEz2xkvOxpJsfMzn/F1o6xLsrM3HvFjAi88uqulIehjtit5YuOymNmNp6HrZ XCh3Y7QtV6LV+z85F+a4B7G5vr3nH0ob1UeTYSnh5LO1g05denV0tgulOV9C2j/s HQAEL695jDEBH+u2niuQNuqHTVBzv5wLfYf0z277elxpbHVCfo8XOBsC5aXO8tIM 1dH0/8Rb9bBh3J76i1A2hxw4yKDBoLL/NY3YID78nczHKXe59Ear21Jk1XP02sRk eAfnwm/D/ujab3B71K++WiHE3xHE03elOAV4TQZ8Pj8jnR8y0OxWKf0kK7og/aBx cFLFk9GfiY/NaCc1bFfLfk2tv9SLv42DAGd87SVdo3bAflBuyFSY7pZtuDSqSg7R Wa7UsrKBOv3zT7lp0cBjizEXtjBvlkDe3sH2k+5LjwrTBERd3VE6mLia/Y1kDGck +i9Zkqne =X8xE -----END PGP SIGNATURE----- --q9KOos5vDmpwPx9o--