avr-libc-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-libc-commit] [2471] Fix bug #43044 - memory sections require __attr


From: Senthil Kumar Selvaraj
Subject: [avr-libc-commit] [2471] Fix bug #43044 - memory sections require __attribute__ ((used))
Date: Wed, 18 Mar 2015 06:44:49 +0000

Revision: 2471
          http://svn.sv.gnu.org/viewvc/?view=rev&root=avr-libc&revision=2471
Author:   saaadhu
Date:     2015-03-18 06:44:47 +0000 (Wed, 18 Mar 2015)
Log Message:
-----------
Fix bug #43044 - memory sections require __attribute__ ((used))

Ticket Links:
------------
    http://savannah.gnu.org/bugs/?43044

Modified Paths:
--------------
    trunk/avr-libc/ChangeLog
    trunk/avr-libc/NEWS
    trunk/avr-libc/doc/api/sections.dox

Modified: trunk/avr-libc/ChangeLog
===================================================================
--- trunk/avr-libc/ChangeLog    2015-03-09 09:25:49 UTC (rev 2470)
+++ trunk/avr-libc/ChangeLog    2015-03-18 06:44:47 UTC (rev 2471)
@@ -1,3 +1,9 @@
+2015-03-18  Senthil Kumar Selvaraj <address@hidden>
+
+       bug #43044: memory sections require __attribute__ ((used))
+       * doc/api/sections.dox: Add __attribute__ ((used)) and
+       a brief explanation of why it is needed.
+
 2015-03-09  Georg-Johann Lay <address@hidden>
 
        bug #34719: Check for right build compiler

Modified: trunk/avr-libc/NEWS
===================================================================
--- trunk/avr-libc/NEWS 2015-03-09 09:25:49 UTC (rev 2470)
+++ trunk/avr-libc/NEWS 2015-03-18 06:44:47 UTC (rev 2471)
@@ -2,6 +2,7 @@
 
 * Bugs fixed:
 
+  [#43044] memory sections require __attribute__ ((used))
   [#34719] Check for right build compiler
   [#44140] wdt_disable() macro clobbers prescaller bits 
   [no-id] TC_EVACT_FRQ_gc was misspelled as TC_EVACT_FRW_gc in some Xmega

Modified: trunk/avr-libc/doc/api/sections.dox
===================================================================
--- trunk/avr-libc/doc/api/sections.dox 2015-03-09 09:25:49 UTC (rev 2470)
+++ trunk/avr-libc/doc/api/sections.dox 2015-03-18 06:44:47 UTC (rev 2471)
@@ -278,7 +278,8 @@
 #include <avr/io.h>
 
 void my_init_portb (void) __attribute__ ((naked)) \
-    __attribute__ ((section (".init3")));
+    __attribute__ ((section (".init3")))
+    __attribute__ ((used));
 
 void
 my_init_portb (void)
@@ -291,7 +292,10 @@
 \note Section .init3 is used in this example, as this ensures the
 inernal <tt>__zero_reg__</tt> has already been set up.  The code
 generated by the compiler might blindly rely on <tt>__zero_reg__</tt>
-being really 0.
+being really 0. <tt>__attribute__ ((used))</tt> tells the compiler
+that code must be generated for this function even if it appears
+that the function is not referenced - this is necessary to prevent 
+compiler optimizations (like LTO) from eliminating the function.
 
 */
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]