On Tue, Jun 01, 2021 at 06:55:52PM +0200, Heinrich Schuchardt wrote: > On 6/1/21 6:22 PM, Marek Behún wrote: > > On Tue, 1 Jun 2021 16:59:52 +0200 > > Patrick DELAUNAY wrote: > > > > > Hi Marek, > > > > > > I am trying to activate CONFIG_LTO for STMicroelectronics stm32mp15 > > > platform > > > > > > (stm32mp15_trusted_defconfig and stm32mp15_basic_defconfig). > > > > > > > > > The config stm32mp15_basic_defconfig, with SPL supported failed to > > > boot > > > > > > with gcc-arm-9.2-2019.12. > > > > > > because a weak function is not correctly handle between > > > > > > 1/ ./arch/arm/lib/cache-cp15.c: 96 > > > > > >     __weak void dram_bank_mmu_setup(int bank); > > > > > > 2/ the stm32mp implementation in > > > > > >    arch/arm/mach-stm32mp/cpu.c:62 > > > > > >    void dram_bank_mmu_setup(int bank) > > > > > > => The used function in SPL is the cache library, not the stm32mp > > > function. > > > > > >       and SPL boot it OK when I remove the function in the cache > > > library... > > > > > > > > > And the issue is also solved with I use a more recent version > > > > > > gcc-arm-10.2-2020.11 on my PC. > > > > > > > > > Do you see the same kind of issue for old version of gcc ? > > > > > > > > > Do you think CONFIG_LTO require a more recent version of gcc that > > > > > > the minimal version required by U-Boot  because I don't see this > > > information > > > > > > in the serie? > > > > I only tried compiling with older versions in the CI. > > > > On the devices for which I tested it I only compiled with newer gcc > > (10.2.0) since it is the stable version on my system. > > > > But yeah, I suggest to use newer GCC for LTO. > > > > Marek > > > > gcc (Debian 11-20210327-1) 11.0.1 compiles stm32mp15_basic_defconfig > with CONFIG_LTO=y. It's run-time not compile time that shows the problem however as gcc-9.x sounds like it has a problem with LTO and weak functions. -- Tom