Badger, Have a look at http://forum.chibios.org/phpbb/viewtopic.php?f=16&t=1867 There is a bug in gcc-arm-none-eabi-4_8. It can be used with LTO disabled. I have noticed that code compiled withgcc-arm-none-eabi-4_8-2014q1 and LTO turned off is almost as small as gcc-arm-none-eabi-4_7-2013q3 with LTO turned on.
Giovanni wrote:I tried the bleeding edge toolchain 4.8.3 and it work with LTO apparently. It is also faster than the other compiler from launchpad.
Giovanni
That's interesting I just tried gcc-arm-none-eabi-4_8-140405 (Bleading Edge) on Ubuntu (using OS kernel 3.5.0-49-generic) and it behaves the same as gcc-arm-none-eabi-4_8-2014q1. The build date of the BE version is a couple of days before the Launchpad version and the info file says 4.8.2 built on kernel "build system: Linux 3.13.8-1-ARCH", where as the website http://www.freddiechopin.info/en/download/category/11-bleeding-edge-toolchain indicates 4.8.3.
So it looks like it is still turn off LTO or stick with 4.7 on Linux at least. Giovanni, you are still on Windows? Perhaps there is a host compiler or OS difference? I really should upgrade, my OS, 3.5, is getting a bit old but I don't like upgrading just after a Ubuntu release. I perefer to give it a couple of months. Regards saraben
Windows XP, it works apparently. It is strange to have such a compiler failure on Linux, probably it would be a good idea to ask on the GCC mailing list or search in the bug tracker.
Giovanni, I had a bit more of a look at this and found that for one modified version of the F103 demo I could compile with gcc-arm-none-eabi-4_8-2014q1 and LTO enabled and another failed. The difference was that the failing version included the TestThread. Placing the TestThread back in the compiling modified version made it fail also.
I don't believe it is anything to do with the TestThread.
I also verified what alex31 stated in the other thread that removing the -ggdb (not -gddb) switch also appears to solve the problem. Not much good for development though
It is most likely that there is a code size issue as suggested in the above bug report.
reading the above link on the launchpad bug report, it seems that the bug is due to the multithreaded nature of final link. another workaround for this bug is to enforce mono thread linking using this option :
tested with last bleeding egde compiler (linux 64 bits) : it compiles now all the demos. i have tested linking time with and without -flto-partition=1to1, and using this option only make linking 10% slower on my 4 cpus 8 threads box