Georg-Johann Lay schrieb: > Georg-Johann Lay schrieb: >> Weddington, Eric schrieb: >>>> -----Original Message----- >>>> From: Georg-Johann Lay [mailto:a...@gjlay.de] >>>> Sent: Friday, April 01, 2011 4:01 PM >>>> To: Georg-Johann Lay >>>> Cc: gcc-patches@gcc.gnu.org; Denis Chertykov; Anatoly Sokolov; Weddington, >>>> Eric >>>> Subject: Re: [Patch,AVR]: Fix PR45263 >>>> >>>> This is a better fix that does not need push/pop and does not increase >>>> numer of instructions. >>>> >>>> r16 takes the role of r20, and the value formerly in r16, >>>> i.e. hh8(__dtors_end resp. __ctors_start) is recreated as needed. >>>> >>> Hi Johann, >>> >>> Have you tested this patch against the test case in bug #45263? > > Tested patch v2 from 2010-04-02 now for atmega2560 on avrtest > simulator. In main, var1 and var2 are initialized as expected and > anObject.getVal() is 30. > > Without patch the program hangs.
2011-04-11 Georg-Johann Lay <a...@gjlay.de> PR target/45263 * config/avr/libgcc.S (__do_global_ctors, __do_global_dtors): Don't use r20 around calls of __tablejump_elpm__
Index: config/avr/libgcc.S =================================================================== --- config/avr/libgcc.S (Revision 172258) +++ config/avr/libgcc.S (Arbeitskopie) @@ -791,22 +791,22 @@ __do_clear_bss: #if defined(__AVR_HAVE_RAMPZ__) __do_global_ctors: ldi r17, hi8(__ctors_start) - ldi r16, hh8(__ctors_start) ldi r28, lo8(__ctors_end) ldi r29, hi8(__ctors_end) - ldi r20, hh8(__ctors_end) + ldi r16, hh8(__ctors_end) rjmp .L__do_global_ctors_start .L__do_global_ctors_loop: sbiw r28, 2 - sbc r20, __zero_reg__ + sbc r16, __zero_reg__ mov_h r31, r29 mov_l r30, r28 - out __RAMPZ__, r20 + out __RAMPZ__, r16 XCALL __tablejump_elpm__ .L__do_global_ctors_start: cpi r28, lo8(__ctors_start) cpc r29, r17 - cpc r20, r16 + ldi r24, hh8(__ctors_start) + cpc r16, r24 brne .L__do_global_ctors_loop #else __do_global_ctors: @@ -832,22 +832,22 @@ __do_global_ctors: #if defined(__AVR_HAVE_RAMPZ__) __do_global_dtors: ldi r17, hi8(__dtors_end) - ldi r16, hh8(__dtors_end) ldi r28, lo8(__dtors_start) ldi r29, hi8(__dtors_start) - ldi r20, hh8(__dtors_start) + ldi r16, hh8(__dtors_start) rjmp .L__do_global_dtors_start .L__do_global_dtors_loop: sbiw r28, 2 - sbc r20, __zero_reg__ + sbc r16, __zero_reg__ mov_h r31, r29 mov_l r30, r28 - out __RAMPZ__, r20 + out __RAMPZ__, r16 XCALL __tablejump_elpm__ .L__do_global_dtors_start: cpi r28, lo8(__dtors_end) cpc r29, r17 - cpc r20, r16 + ldi r24, hh8(__dtors_end) + cpc r16, r24 brne .L__do_global_dtors_loop #else __do_global_dtors: