1Fermer3
Lionel DebrouxLe 26/03/2010 à 07:58
To use -fwhole-program --combine with GCC4TI, or TIGCC, you need to call the appropriate programs one by one, and not forget to add a call to `patcher` in-between. If you're using TPRs, `tprbuilder -v` can show you the sequence of commands, which you need to adapt.
A while ago, I have done that on TI-Chess, and -fwhole-program --combine also produced a binary that was, IIRC, between 10% and 15% smaller. I don't remember ATM what I did exactly to overcome the "undefined reference to __main", but I know it was only two or three small changes, such as a one-liner change to one of the headers and/or renaming _main to __main.

There's one significant problem, though: reliability (rather, lack thereof). -fwhole-program --combine are buggy, i.e. you can see more Internal Compiler Errors than the usual with those modes, and invalid generated code happens once in a while.
Since it's unreliable, hardly anybody tries using Inter-Procedural Optimization with GCC, so it remains somewhat buggy... and therefore, hardly anybody uses it.

To sum up: you can do it, but beware.
If you're applying it to programs that have very few users, and you are willing to put up with occasional incorrect behaviour and crashes, go ahead.
If you're planning to distribute your programs on ticalc, be prepared to spend more time testing before releasing, and deal with hate mail, even if you explicitly write in the README (as pretty much everybody else is doing, anyway) that "as any ASM or BASIC program, this can crash your calculator"), because people don't read READMEs wink