1 diff -Naurp gcc/config/avr/libgcc.S gcc/config/avr/libgcc.S
2 --- gcc/config/avr/libgcc.S 2012-06-12 12:43:40.000000000 +0530
3 +++ gcc/config/avr/libgcc.S 2012-06-12 12:44:08.000000000 +0530
4 @@ -862,6 +862,12 @@ __do_copy_data:
6 brne .L__do_copy_data_loop
7 #endif /* !defined(__AVR_HAVE_ELPMX__) && !defined(__AVR_HAVE_ELPM__) */
9 +;Clear RAMPZ in case it was set during copy_data
10 +#if defined(__AVR_HAVE_ELPMX__ ) || defined(__AVR_HAVE_ELPM__)
11 + out __RAMPZ__, __zero_reg__
14 #endif /* L_copy_data */
17 @@ -941,6 +947,12 @@ __do_global_ctors:
19 brne .L__do_global_ctors_loop
20 #endif /* defined(__AVR_HAVE_RAMPZ__) */
22 +;Clear RAMPZ in case it was set
23 +#if defined(__AVR_HAVE_RAMPZ__)
24 + out __RAMPZ__, __zero_reg__
30 @@ -992,6 +1004,12 @@ __do_global_dtors:
32 brne .L__do_global_dtors_loop
33 #endif /* defined(__AVR_HAVE_RAMPZ__) */
35 +;Clear RAMPZ in case it was set
36 +#if defined(__AVR_HAVE_RAMPZ__)
37 + out __RAMPZ__, __zero_reg__
42 #if !defined (__AVR_TINY__)