
Hi Michael,
HI Tom
On Sat, Mar 19, 2022 at 6:51 PM Tom Rini trini@konsulko.com wrote:
On Sat, Mar 19, 2022 at 06:49:25PM +0100, Michael Nazzareno Trimarchi wrote:
HI Tom
On Sat, Mar 19, 2022 at 6:44 PM Tom Rini trini@konsulko.com wrote:
On Sat, Mar 19, 2022 at 06:37:18PM +0100, Michael Nazzareno Trimarchi wrote:
Hi Tom
On Sat, Mar 19, 2022 at 6:30 PM Tom Rini trini@konsulko.com wrote:
On Sat, Mar 19, 2022 at 06:27:38PM +0100, Michael Nazzareno Trimarchi wrote: > Hi > > On Sat, Mar 19, 2022 at 6:25 PM Tom Rini trini@konsulko.com wrote: > > > > On Sat, Mar 19, 2022 at 06:08:18PM +0100, Michael Nazzareno Trimarchi wrote: > > > Hi Tom > > > > > > > > On Sat, Mar 19, 2022 at 6:03 PM Tom Rini trini@konsulko.com wrote: > > > > > > > > > > > On Sat, Mar 19, 2022 at 05:48:59PM +0100, Michael Nazzareno Trimarchi wrote: > > > > > > > Hi Tom > > > > > > > > > > > > On Sat, Mar 19, 2022 at 5:05 PM Tom Rini trini@konsulko.com wrote: > > > > > > > > > > > > On Sat, Mar 19, 2022 at 02:51:01PM +0100, Michael Nazzareno Trimarchi wrote: > > > > > > > Hi > > > > > > > > > > > > > > On Sat, Mar 19, 2022 at 2:25 PM Fabio Estevam festevam@gmail.com wrote: > > > > > > > > > > > > > > > > Hi Michael, > > > > > > > > > > > > > > > > On Sat, Mar 19, 2022 at 6:47 AM Michael Nazzareno Trimarchi > > > > > > > > michael@amarulasolutions.com wrote: > > > > > > > > > > > > > > > > > > HI > > > > > > > > > > > > > > > > > > Please send me a link to apply your series > > > > > > > > > > > > > > > > You can get the series from patchwork (just click in the 'series' button) > > > > > > > > https://eur01.safelinks.protection.outlook.com/?%3Eurl=https%3A%2F%2Fpatchwo...https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatchwork.ozlabs.org%2Fproject%2Fuboot%2Fpatch%2F20220112133127.16880-2-gaurav.jain%40nxp.com%2F&data=04%7C01%7Craffaele.recalcati%40bticino.it%7Cd7b8598315144860262808da09d260da%7C199686b5bef4496087867a6b1888fee3%7C1%7C0%7C637833096424290979%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=cLvLVUDGQzJ7VTyzBrTqOeobl0lgBOxJtmhV2RMjvB0%3D&reserved=0> > > > > > > > > > > > > > > Done, well, I have tried remove DM_GPIO in SPL. Seems that I need to > > > > > > > remove a lot of features. I have tested LTO build but size > > > > > > > of SPL increase. Is that strange? > > > > > > > > > > > > That is very strange. Can you post your patches somewhere? > > > > > > > > > > > > -- > > > > > > Tom > > > > > > > > > > Start from here 9776c4e9d00ac49d6388ffe9e084ff03b37ae479 > > > > > export ARCH=arm > > > > > export CROSS_COMPILE=arm-linux-gnueabihf- > > > > > > > > > > make imx6dl_mamoj_defconfig > > > > > build it > > > > > > > > > > Try then to enable LTO and build it again > > > > > > > > > > spl/u-boot-spl.bin exceeds file size limit: > > > > > limit: 0xefa0 bytes > > > > > actual: 0xf071 bytes > > > > > excess: 0xd1 bytes > > > > > > > > > > So LTO does not help even on beginning on this board. You don't need > > > > > to apply any patch for this test > > > > > > > > I think that's some artifact of mixing LTO/non-LTO and the world not > > > > getting rebuilt? Just enabling LTO after the defconfig works fine and > > > > is smaller than before. > > > > > > In order to save space I did not change what we have. Every build starts from > > > a mrproper and new configuration. I can not mix LTO/non-LTO in this case. I'm > > > using upstream defconfig and upstream defconfig + LTO enabled and the result is > > > that spl increase in size for LTO building. I'm working to keep out > > > part that are not really needed but > > > I was hoping that LTO give me some help here > > > > Yes, LTO saves about 5KiB on the SPL binary. You just need to enable it > > in the config before you start building, not after you've built > > everything once. > > Offcourse ;) but this not the case. I don't drink enough to think that > change a config, decrease the build size ;)
LTO is an entirely different way of the compiler / linker optimizing the binary. So yes, in this case enabling a single option decreases the size.
I think we are in a circle. Let's have the result with LTO
spl/keep-syms-lto.c ( cd spl && arm-linux-gnueabihf-gcc -nostdlib -nostartfiles -fuse-linker-plugin -flto=8 -Wall -Wstrict-prototypes -Wno-format-security -fno-builtin -ffreestanding -std=gnu11 -fshort-wchar -fno-strict-aliasing -fno-PIE -Os -flto=8 -fno-stack-protector -fno-delete-null-pointer-checks -Wno-pointer-sign -Wno-stringop-truncation -Wno-array-bounds -Wno-stringop-overflow -Wno-maybe-uninitialized -fmacro-prefix-map=./= -g -fstack-usage -Wno-format-nonliteral -Wno-address-of-packed-member -Wno-unused-but-set-variable -Werror=date-time -Wno-packed-not-aligned -ffunction-sections -fdata-sections -fno-stack-protector -D__KERNEL__ -D__UBOOT__ -DCONFIG_SPL_BUILD -D__ARM__ -Wa,-mimplicit-it=always -mthumb -mthumb-interwork -mabi=aapcs-linux -mno-unaligned-access -fno-common -ffixed-r9 -msoft-float -mgeneral-regs-only -pipe -march=armv7-a -D__LINUX_ARM_ARCH__=7 -mtune=generic-armv7-a -Ispl/include -Iinclude -I./arch/arm/include -include ./include/linux/kconfig.h -nostdinc -isystem /usr/lib/gcc-cross/arm-linux-gnueabihf/9/include -Wl,-T -Wl,u-boot-spl.lds -Wl,-Bstatic -Wl,--gc-sections -Wl,--no-dynamic-linker -Wl,--build-id=none -Wl,-Ttext -Wl,0x00908000 arch/arm/cpu/armv7/start.o -Wl,--whole-archive arch/arm/cpu/armv7/built-in.o arch/arm/cpu/built-in.o arch/arm/lib/built-in.o arch/arm/mach-imx/built-in.o board/bticino/mamoj/built-in.o common/spl/built-in.o common/init/built-in.o boot/built-in.o common/built-in.o cmd/built-in.o env/built-in.o lib/built-in.o disk/built-in.o drivers/built-in.o drivers/usb/dwc3/built-in.o drivers/usb/cdns3/built-in.o dts/built-in.o fs/built-in.o keep-syms-lto.o arch/arm/lib/eabi_compat.o arch/arm/lib/lib.a -Wl,--no-whole-archive -Wl,-Map,u-boot-spl.map -o u-boot-spl ) arm-linux-gnueabihf-objcopy -j .text -j .secure_text -j .secure_data -j .rodata -j .hash -j .data -j .got -j .got.plt -j .u_boot_list -j .rel.dyn -j .binman_sym_table -j .text_rest -j .dtb.init.rodata -j .efi_runtime -j .efi_runtime_rel -O binary spl/u-boot-spl spl/u-boot-spl-nodtb.bin arm-linux-gnueabihf-objdump -t spl/u-boot-spl > spl/u-boot-spl.sym cat spl/u-boot-spl-nodtb.bin spl/u-boot-spl.dtb > spl/u-boot-spl-dtb.bin cp spl/u-boot-spl-dtb.bin spl/u-boot-spl.bin spl/u-boot-spl.bin exceeds file size limit: limit: 0xefa0 bytes actual: 0xf079 bytes excess: 0xd9 bytes make: *** [Makefile:2082: spl/u-boot-spl.bin] Error 1 make: *** Deleting file 'spl/u-boot-spl.bin'
and without
NUX_ARM_ARCH__=7 -mtune=generic-armv7-a -D__ASSEMBLY__ -x c -o spl/u-boot-spl.cfgout arch/arm/mach-imx/spl_sd.cfg ./tools/mkimage -n spl/u-boot-spl.cfgout -T imximage -e 0x00908000 -d spl/u-boot-spl.bin SPL >SPL.log && cat SPL.log Image Type: Freescale IMX Boot Image Image Ver: 2 (i.MX53/6/7 compatible) Mode: DCD Data Size: 73824 Bytes = 72.09 KiB = 0.07 MiB Load Address: 00907420 Entry Point: 00908000 HAB Blocks: 0x00907400 0x00000000 0x0000fc00 DCD Blocks: 0x00910000 0x0000002c 0x00000004 make -f ./scripts/Makefile.build obj=arch/arm/mach-imx u-boot-with-spl.imx mkdir -p spl/ ./tools/mkimage -n spl/u-boot-spl.cfgout -T imximage -e 0x00908000 -d spl/u-boot-spl.bin SPL >SPL.log && cat SPL.log Image Type: Freescale IMX Boot Image Image Ver: 2 (i.MX53/6/7 compatible) Mode: DCD Data Size: 73824 Bytes = 72.09 KiB = 0.07 MiB Load Address: 00907420 Entry Point: 00908000 HAB Blocks: 0x00907400 0x00000000 0x0000fc00 DCD Blocks: 0x00910000 0x0000002c 0x00000004 arm-linux-gnueabihf-objcopy -j .text -j .secure_text -j .secure_data -j .rodata -j .hash -j .data -j .got -j .got.plt -j .u_boot_list -j .rel.dyn -j .binman_sym_table -j .text_rest -j .dtb.init.rodata -j .efi_runtime -j .efi_runtime_rel -I binary -O binary --pad-to=0x11000 SPL u-boot-with-spl.imx && cat u-boot.img >> u-boot-with-spl.imx || rm -f u-boot-with-spl.imx
What I'm trying to say is that I have followed the correct steps and this is the LTO change
git diff diff --git a/configs/imx6dl_mamoj_defconfig b/configs/imx6dl_mamoj_defconfig index ae27857e6f..4a535012b2 100644 --- a/configs/imx6dl_mamoj_defconfig +++ b/configs/imx6dl_mamoj_defconfig @@ -14,6 +14,7 @@ CONFIG_SPL_TEXT_BASE=0x00908000 CONFIG_SPL_DRIVERS_MISC=y CONFIG_IMX_HAB=y # CONFIG_CMD_BMODE is not set +CONFIG_LTO=y CONFIG_DISTRO_DEFAULTS=y CONFIG_BOOTDELAY=3 CONFIG_SPL_OS_BOOT=y
Here's what I see: $ git describe HEAD v2022.04-rc4-50-g9776c4e9d00a $ make imx6dl_mamoj_defconfig HOSTCC scripts/basic/fixdep HOSTCC scripts/kconfig/conf.o YACC scripts/kconfig/zconf.tab.c LEX scripts/kconfig/zconf.lex.c HOSTCC scripts/kconfig/zconf.tab.o HOSTLD scripts/kconfig/conf # # configuration written to .config # $ sed -i -e 's/# CONFIG_LTO is not set/CONFIG_LTO=y/' .config $ grep LTO .config CONFIG_ARCH_SUPPORTS_LTO=y CONFIG_LTO=y $ make CROSS_COMPILE=~/.buildman-toolchains/gcc-11.1.0-nolibc/arm-linux-gnueabi/bin/arm-l>
linux-gnueabi- -sj12
===================== WARNING ====================== This board does not use CONFIG_DM_SERIAL (Driver Model for Serial drivers). Please update the board to use CONFIG_DM_SERIAL before the v2023.04 release. Failure to update by the deadline may result in board removal. See doc/driver-model/migration.rst for more info. ==================================================== arch/arm/dts/imx6dl-dhcom-pdk2.dtb: Warning (pwms_property): /display-bl:pwms: cell 3 is not a >phandle reference arch/arm/dts/imx6dl-dhcom-pdk2.dtb: Warning (pwms_property): /display-bl: Missing property '#pwm-cells' in node /soc/bus@2000000/gpc@20dc000 or bad phandle (referred from pwms[3]) arch/arm/dts/imx6q-dhcom-pdk2.dtb: Warning (pwms_property): /display-bl:pwms: cell 3 is not a phandle reference arch/arm/dts/imx6q-dhcom-pdk2.dtb: Warning (pwms_property): /display-bl: Missing property '>#pwm-cells' in node /soc/bus@2000000/gpc@20dc000 or bad phandle (referred from pwms[3]) $ ls -lh spl/u-boot-spl* -rwxrwxr-x 1 trini trini 944K Mar 19 13:40 spl/u-boot-spl -rw-rw-r-- 1 trini trini 54K Mar 19 13:40 spl/u-boot-spl.bin -rw-rw-r-- 1 trini trini 1.6K Mar 19 13:40 spl/u-boot-spl.cfgout -rw-rw-r-- 1 trini trini 2.2K Mar 19 13:40 spl/u-boot-spl.dtb -rw-rw-r-- 1 trini trini 54K Mar 19 13:40 spl/u-boot-spl-dtb.bin -rw-rw-r-- 1 trini trini 728 Mar 19 13:40 spl/u-boot-spl.lds -rw-rw-r-- 1 trini trini 5.9K Mar 19 13:40 spl/u-boot-spl.ltrans0.ltrans.su -rw-rw-r-- 1 trini trini 7.2K Mar 19 13:40 spl/u-boot-spl.ltrans1.ltrans.su -rw-rw-r-- 1 trini trini 182K Mar 19 13:40 spl/u-boot-spl.map -rwxrwxr-x 1 trini trini 51K Mar 19 13:40 spl/u-boot-spl-nodtb.bin -rw-rw-r-- 1 trini trini 135K Mar 19 13:40 spl/u-boot-spl.sym
The only difference is the toolchain gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04) and for the result you get I'm agree with you.
Yeah, that's too old of a toolchain for LTO to be usable. A patch to catch and error out in that case would be good :)
Let's do it this way. I will test with the newer gcc version and decrease the size and send a patch. This can be done on Monday, because I don't have access to it.
Michael
I can test on the board if needed. Let me know.
-- Tom
-- Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 michael@amarulasolutions.com __________________________________
Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 info@amarulasolutions.com https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.amarula...
________________________________
Ce message, ainsi que tous les fichiers joints à ce message, peuvent contenir des informations sensibles et/ ou confidentielles ne devant pas être divulguées. Si vous n'êtes pas le destinataire de ce message (ou que vous recevez ce message par erreur), nous vous remercions de le notifier immédiatement à son expéditeur, et de détruire ce message. Toute copie, divulgation, modification, utilisation ou diffusion, non autorisée, directe ou indirecte, de tout ou partie de ce message, est strictement interdite.
This e-mail, and any document attached hereby, may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized, direct or indirect, copying, disclosure, distribution or other use of the material or parts thereof is strictly forbidden.