Content originally posted in LPCWare by Muis on Thu Feb 26 09:36:32 MST 2015
No, I am sure the HardFault is not being masked.
My code works on all optimization levels (O1 to OS) even with LTO enabled. Only when I switch from Redlib (Nohost) to Redlib (None) it becomes unstable with LTO. In release mode, the Hardfault handler isnt even executed, the firmware just freezes. In debug mode, I get Hardfaults on the weirdest places, usually VECTPT contains 'g_pfnVectors' and the line is calling 'memset' or 'memcpy'.
It just seems the LPCXpresso wasn't prepared for LTO very well. I already had to modify the startup files to add "__attribute__ ((used" or else your own examples won't even boot when compiled with LTO.