Support LTO Builds
Examples work, but not sure much else
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 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.