On Thu, Mar 8, 2012 at 7:25 PM, William "Chops" Westfield <wes...@mac.com> wrote: > > On Mar 7, 2012, at 9:06 PM, David Relson wrote: > >> On the other hand, after changing the "int main(void)" statement to "int >> test(void)", compile, and disassemble then the expected "ret" >> statements appear. It seems that the "main" function gets special >> handling. > > Hmm. There was a very similar issue that I ran into recently with the AVR > gcc compiler, having to do with "naked" functions not having a proper > epilogue, resulting in bad code when jump reordering was done. Or something > like that. > > PR42240: http://gcc.gnu.org/ml/gcc-patches/2011-02/msg01441.html > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42240 > > It looks like the non-hosted main() in msp430-gcc is similar to "naked", so > the problem could be similar. > > I don't much like their patch, since it disables optimizations that could be > important in a function of any particular size. avr-gcc also has attribute > ((OS_Main)) which is similar and apparently didn't have the bug.
The original mspgcc started from the AVR port in the early 2000s, so much of the infrastructure and concepts of how things should be done were similar. Much of it has subsequently been replaced, in both mspgcc and avr. (I tried the TARGET_MODIFIES_JUMPS approach as my first attempt at solving the problem, and found it inadequate, though it's not particularly bad since it only affects naked functions and those are pretty rare.) > > BillW > > > ------------------------------------------------------------------------------ > Virtualization & Cloud Management Using Capacity Planning > Cloud computing makes use of virtualization - but cloud computing > also focuses on allowing computing to be delivered as a service. > http://www.accelacomm.com/jaw/sfnl/114/51521223/ > _______________________________________________ > Mspgcc-users mailing list > Mspgcc-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/mspgcc-users ------------------------------------------------------------------------------ Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ _______________________________________________ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users