ardupilot icon indicating copy to clipboard operation
ardupilot copied to clipboard

Support LTO Builds

Open andyp1per opened this issue 1 year ago • 2 comments

Examples work, but not sure much else

andyp1per avatar Aug 21 '24 21:08 andyp1per

I had investigated this in the past and done some work to fix related compiler errors but I wasn't sure if it was possible. In particular I'm not sure wrapped functions are safe to use, even if they are marked as used? IIUC there is a GCC bug where it can resolve functions before they can get wrapped, although it looks like maybe there's a fix there?

I think we should kill the wrapped functions ultimately though. There's also the problem that -O2 boards now optimize too well and overflow the flash. We would probably want a global -Os policy first.

tpwrules avatar Aug 21 '24 22:08 tpwrules

@tpwrules great! Do you want to collaborate? The examples work for me, so clearly not all is broken - I am hoping its something simple. Apparently all the ChibiOS examples are built with LTO so there should be good underlying support.

andyp1per avatar Aug 22 '24 08:08 andyp1per