Hi Michal,

 

It’s less about the toolchain dependency, and more about the fact that we currently do toolchain discovery, then toolchain configuration (of which setting the base CFLAGS is a part, including -flto), and _then_ the platform file gets loaded in, which means that if ENABLE_LTO has not been configured before the platform file has been loaded then it is already too late.

 

I did try enabling LTO by default last year (https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/20540) but it triggered a number of test failures and I ran out of time to investigate further. Perhaps we could revive that?

 

Chris

 

From: Michal Simek <michal.simek@amd.com>
Date: Monday, 5 February 2024 at 07:20
To: Chris Kay <Chris.Kay@arm.com>, Kummari, Prasad <Prasad.Kummari@amd.com>, tf-a@lists.trustedfirmware.org <tf-a@lists.trustedfirmware.org>
Cc: Nagal, Amit <amit.nagal@amd.com>, Belsare, Akshay <akshay.belsare@amd.com>
Subject: Re: ENABLE_LTO feature usage.

Hi Chris,

On 2/2/24 12:17, Chris Kay wrote:
> Hi Prasad,
>
> ENABLE_LTO places constraints on the toolchain (both the linker and the compiler
> must be aligned on the format of the generated object files), so it cannot
> therefore be configured from the platform makefile, which loads after the
> toolchain has already been set up.

I get it but on the other hand when we are running out of space. Over years
simply TF-A is growing and enabling LTO give us time and space to deprecate,
remove some parts to stay inside limits. I am talking about one specific
configuration when TF-A runs out of OCM.
I don't think toolchain dependency is really a big deal for me. If toolchain
doesn't support LTO what can go wrong?
I expect size is going to be bigger and it will fail to compile.
Or toolchain just failed with unknown flag.
For both we can simply simply document this limitation.

If LTO is supported for GCC version X.Y then it should be just fine to describe
this dependency and make it mandatory for this configuration only.

What do you think?

Thanks,
Michal