Follow-up Comment #2, bug #19050 (project avr-libc):

In oficial GCC 4.x main() do not converted to a normal function. 'atmega256'
patch does it. 

For fast correction of a bug it is necessary to restore special handling of
main() funcion in 'patch-zz-atmega256x' patch.

These changes should be reverted: 

-  if (main_p)
-    {
-      fprintf (file, ("\t" 
-                     AS1 (ldi,r28) ",lo8(%s - " HOST_WIDE_INT_PRINT_DEC ")" 
CR_TAB
-                     AS1 (ldi,r29) ",hi8(%s - " HOST_WIDE_INT_PRINT_DEC ")" 
CR_TAB
-                     AS2 (out,__SP_H__,r29)     CR_TAB
-                     AS2 (out,__SP_L__,r28) "\n"),
-              avr_init_stack, size, avr_init_stack, size);
-      
-      prologue_size += 4;
-    }
-  else if (minimize && (frame_pointer_needed || live_seq > 6)) 
+  if (minimize && (frame_pointer_needed || live_seq > 6)) 

and:

-  if (main_p)
-    {
-      /* Return value from main() is already in the correct registers
-        (r25:r24) as the exit() argument.  */
-      if (AVR_MEGA)
-       {
-         fputs ("\t" AS1 (jmp,exit) "\n", file);
-         epilogue_size += 2;
-       }
-      else
-       {
-         fputs ("\t" AS1 (rjmp,exit) "\n", file);
-         ++epilogue_size;
-       }
-    }
-  else if (minimize && (frame_pointer_needed || live_seq > 4))
+  if (minimize && (frame_pointer_needed || live_seq > 4))

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?19050>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/



_______________________________________________
AVR-libc-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/avr-libc-dev

Reply via email to