From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Behun Date: Thu, 11 Mar 2021 13:45:49 +0100 Subject: [PATCH u-boot 17/39] build: support building with Link Time Optimizations In-Reply-To: References: <20210307042538.21229-1-marek.behun@nic.cz> <20210307042538.21229-18-marek.behun@nic.cz> Message-ID: <20210311134549.194ea69d@nic.cz> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Tue, 9 Mar 2021 21:30:26 +0800 Bin Meng wrote: > > +config LTO > > + bool "Enable Link Time Optimizations" > > + depends on ARCH_SUPPORTS_LTO > > + default n > > nits: this line is not needed as the default value is n if omitted This is for consistency. The other options in this file also use "default n" > > +ifdef CONFIG_LTO > > + LTO_CFLAGS := -flto > > + LTO_FINAL_LDFLAGS := -fwhole-program > > This one should not be necessary per my read of the GCC doc. Also in > your patch, it is only used in the SPL build. I shall do some tests. > > +ifdef CONFIG_LTO > > +quiet_cmd_u-boot__ ?= LTO $@ > > + cmd_u-boot__ ?= \ > > + $(CC) -nostdlib -nostartfiles \ > > + $(LTO_FINAL_CFLAGS) $(c_flags) \ > > LTO_FINAL_CFLAGS is not defined anywhere. I guess you wanted to use > LTO_FINAL_LDFLAGS? THX, I forgot to change it here. We will see if this variable is needed (since it only contains -fwhole-program, which may be dropped) > > > + $(KBUILD_LDFLAGS:%=-Wl,%) $(LDFLAGS_u-boot:%=-Wl,%) -o $@ \ > > + -T u-boot.lds $(u-boot-init) \ > > + -Wl,--start-group -Wl,--whole-archive \ > > --start-group should be dropped Will test