Hi Brian,

Worth just saying that GCC does not enable any optimizations by default. LTO needs to be explicitly enabled on the command line using -flto - see the GCC docs here - https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html

CMake also has a way to enable LTO using a specific CMake flag which you can set - details here - https://stackoverflow.com/questions/31355692/how-do-i-enable-link-time-optimization-lto-with-cmake
But we do not currently do that in TF-M 


Thanks,
Jackson

From: Antonio De Angelis via TF-M <tf-m@lists.trustedfirmware.org>
Sent: 01 April 2025 22:44
To: tf-m@lists.trustedfirmware.org <tf-m@lists.trustedfirmware.org>; Quach, Brian <brian@ti.com>
Subject: [TF-M] Re: Link Time Optimization
 
Hi Brian,

no, TF-M does not use it (on purpose), i.e. if GCC enables it by default, the impact of LTO has not been assessed.

Thanks, Antonio

From: Quach, Brian via TF-M <tf-m@lists.trustedfirmware.org>
Sent: Tuesday, April 1, 2025 16:01
To: tf-m@lists.trustedfirmware.org <tf-m@lists.trustedfirmware.org>
Subject: [TF-M] Link Time Optimization
 

Hi, does TF-M use LTO?   I didn’t see any flags to disable it in toolchain_GNUARM.cmake.   I think for GCC, it’s enabled by default if no flag is set. 

 

Regards,

 

Brian Quach

SimpleLink MCU

Texas Instruments Inc.

12500 TI Blvd, MS F-4000

Dallas, TX 75243

214-479-4076