This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch,avr,committed]: Fix __do_global_dtors


This patch fixed the wrong pre-increment of .dtors addresses to a post-increment. The first .dtor was bypassed and the last access read beyond __dtors_end.

Installed as obvious: http://gcc.gnu.org/r216550


Johann

	* config/avr/lib1funcs.S (__do_global_dtors): Fix wrong code
	introduced with 2014-10-21 trunk r216525.
Index: config/avr/lib1funcs.S
===================================================================
--- config/avr/lib1funcs.S	(revision 216549)
+++ config/avr/lib1funcs.S	(revision 216550)
@@ -2502,14 +2502,16 @@ DEFUN __do_global_dtors
 #endif /* HAVE_EIJMP */
     rjmp    .L__do_global_dtors_start
 .L__do_global_dtors_loop:
-    waddi   28, 1
 #ifdef __AVR_HAVE_EIJMP_EICALL__
-    adc     r16, __zero_reg__
     mov     r24, r16
 #endif /* HAVE_EIJMP */
     mov_h   r31, r29
     mov_l   r30, r28
     XCALL   __tablejump2__
+    waddi   28, 1
+#ifdef __AVR_HAVE_EIJMP_EICALL__
+    adc     r16, __zero_reg__
+#endif /* HAVE_EIJMP */
 .L__do_global_dtors_start:
     cpi     r28, pm_lo8(__dtors_end)
     cpc     r29, cdtors_tst_reg
@@ -2521,6 +2523,8 @@ DEFUN __do_global_dtors
 ENDF __do_global_dtors
 #endif /* L_dtors */
 
+#undef cdtors_tst_reg
+
 .section .text.libgcc, "ax", @progbits
 
 #if !defined (__AVR_TINY__)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]