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

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

[avr-libc-dev] [patch #3593] Reassigned item: extend linker scripts to p


From: Rolf Ebert
Subject: [avr-libc-dev] [patch #3593] Reassigned item: extend linker scripts to permit -fdata-sections (gcc PR14064) and -ffunction-sections
Date: Fri, 07 Jan 2005 08:35:14 -0500
User-agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) Opera 7.54 [en]

This mail is an automated notification from the patch tracker
 of the project: AVR C Runtime Library.

/**************************************************************************/
[patch #3593] Latest Modifications:

Changes by: 
                Rolf Ebert <address@hidden>
'Date: 
                Fri 01/07/2005 at 13:17 (MET)

------------------ Additional Follow-up Comments ----------------------------
The ld.texi has some description of the purpose of the KEEP command:

Input Section and Garbage Collection
....................................

   When link-time garbage collection is in use (`--gc-sections'), it is often 
useful to mark sections that should not be eliminated.  This is accomplished by 
surrounding an input section's wildcard entry with `KEEP()', as in 
KEEP(*(.init))' or `KEEP(SORT(*)(.ctors))'.

---------------------------------------

See other sc scripts like xstormy16.sc, which has similar comments.  I am not 
sure about the correct placement for keeping the descrutors (.fini?). It seems 
to work OK.

Additionally we link all .data.* sections as well (for -fdata-sections), see 
line 119.

Here is a patch against avr.sc.  It is not really well tested, but at least 
preliminarily tested.  I don't have much AVR programs to test for regressions:

--- avr.sc~     2002-06-02 01:28:59.000000000 +0200
+++ avr.sc      2005-01-07 13:45:29.402862400 +0100
@@ -74,7 +74,7 @@
   /* Internal text space or external memory */
   .text :
   {
-    *(.vectors)
+    KEEP(*(.vectors))
 
     ${CONSTRUCTING+ __ctors_start = . ; }
     ${CONSTRUCTING+ *(.ctors) }
@@ -86,20 +86,21 @@
     *(.progmem.gcc*)
     *(.progmem*)
     ${RELOCATING+. = ALIGN(2);}
-    *(.init0)  /* Start here after reset.  */
-    *(.init1)
-    *(.init2)  /* Clear __zero_reg__, set up stack pointer.  */
-    *(.init3)
-    *(.init4)  /* Initialize data and BSS.  */
-    *(.init5)
-    *(.init6)  /* C++ constructors.  */
-    *(.init7)
-    *(.init8)
-    *(.init9)  /* Call main().  */
+    KEEP(*(.init0))  /* Start here after reset.  */
+    KEEP(*(.init1))
+    KEEP(*(.init2))  /* Clear __zero_reg__, set up stack pointer.  */
+    KEEP(*(.init3))
+    KEEP(*(.init4))  /* Initialize data and BSS.  */
+    KEEP(*(.init5))
+    KEEP(*(.init6))  /* C++ constructors.  */
+    KEEP(*(.init7))
+    KEEP(*(.init8))
+    KEEP(*(.init9))  /* Call main().  */
     *(.text)
     ${RELOCATING+. = ALIGN(2);}
     *(.text.*)
     ${RELOCATING+. = ALIGN(2);}
+    KEEP(*(.fini?))
     *(.fini9)  /* _exit() starts here.  */
     *(.fini8)
     *(.fini7)
@@ -117,6 +118,8 @@
   {
     ${RELOCATING+ PROVIDE (__data_start = .) ; }
     *(.data)
+    ${RELOCATING+. = ALIGN(2);}
+    *(.data.*)
     *(.gnu.linkonce.d*)
     ${RELOCATING+. = ALIGN(2);}
     ${RELOCATING+ _edata = . ; }







/**************************************************************************/
[patch #3593] Full Item Snapshot:

URL: <http://savannah.nongnu.org/patch/?func=detailitem&item_id=3593>
Project: AVR C Runtime Library
Submitted by: 0
On: Thu 12/23/2004 at 08:54

Category:  None
Priority:  5 - Normal
Resolution:  None
Privacy:  Public
Assigned to:  marekm
Originator Email:  address@hidden
Status:  Open


Summary:  Reassigned item: extend linker scripts to permit -fdata-sections (gcc 
PR14064) and  -ffunction-sections

Original Submission:  gcc-3.4.3 now fully supports -fdata-sections (PR14064) and
-ffunction-sections for AVR targets.  It needs, however, modified linker 
scripts. see the attached patch for avr2.x

Follow-up Comments
------------------


-------------------------------------------------------
Date: Fri 01/07/2005 at 13:17       By: Rolf Ebert <rolf_ebert>
The ld.texi has some description of the purpose of the KEEP command:

Input Section and Garbage Collection
....................................

   When link-time garbage collection is in use (`--gc-sections'), it is often 
useful to mark sections that should not be eliminated.  This is accomplished by 
surrounding an input section's wildcard entry with `KEEP()', as in 
KEEP(*(.init))' or `KEEP(SORT(*)(.ctors))'.

---------------------------------------

See other sc scripts like xstormy16.sc, which has similar comments.  I am not 
sure about the correct placement for keeping the descrutors (.fini?). It seems 
to work OK.

Additionally we link all .data.* sections as well (for -fdata-sections), see 
line 119.

Here is a patch against avr.sc.  It is not really well tested, but at least 
preliminarily tested.  I don't have much AVR programs to test for regressions:

--- avr.sc~     2002-06-02 01:28:59.000000000 +0200
+++ avr.sc      2005-01-07 13:45:29.402862400 +0100
@@ -74,7 +74,7 @@
   /* Internal text space or external memory */
   .text :
   {
-    *(.vectors)
+    KEEP(*(.vectors))
 
     ${CONSTRUCTING+ __ctors_start = . ; }
     ${CONSTRUCTING+ *(.ctors) }
@@ -86,20 +86,21 @@
     *(.progmem.gcc*)
     *(.progmem*)
     ${RELOCATING+. = ALIGN(2);}
-    *(.init0)  /* Start here after reset.  */
-    *(.init1)
-    *(.init2)  /* Clear __zero_reg__, set up stack pointer.  */
-    *(.init3)
-    *(.init4)  /* Initialize data and BSS.  */
-    *(.init5)
-    *(.init6)  /* C++ constructors.  */
-    *(.init7)
-    *(.init8)
-    *(.init9)  /* Call main().  */
+    KEEP(*(.init0))  /* Start here after reset.  */
+    KEEP(*(.init1))
+    KEEP(*(.init2))  /* Clear __zero_reg__, set up stack pointer.  */
+    KEEP(*(.init3))
+    KEEP(*(.init4))  /* Initialize data and BSS.  */
+    KEEP(*(.init5))
+    KEEP(*(.init6))  /* C++ constructors.  */
+    KEEP(*(.init7))
+    KEEP(*(.init8))
+    KEEP(*(.init9))  /* Call main().  */
     *(.text)
     ${RELOCATING+. = ALIGN(2);}
     *(.text.*)
     ${RELOCATING+. = ALIGN(2);}
+    KEEP(*(.fini?))
     *(.fini9)  /* _exit() starts here.  */
     *(.fini8)
     *(.fini7)
@@ -117,6 +118,8 @@
   {
     ${RELOCATING+ PROVIDE (__data_start = .) ; }
     *(.data)
+    ${RELOCATING+. = ALIGN(2);}
+    *(.data.*)
     *(.gnu.linkonce.d*)
     ${RELOCATING+. = ALIGN(2);}
     ${RELOCATING+ _edata = . ; }


-------------------------------------------------------
Date: Mon 12/27/2004 at 20:23       By: Marek Michalkiewicz <marekm>
Linker scripts like avr2.x are generated from ld/scripttempl/avr.sc - please 
submit a well tested patch for the latter.  I've never used --gc-sections, so 
I'm not sure how the scripts with other extensions (depending on $RELOCATING 
etc.) should be changed.


-------------------------------------------------------
Date: Mon 12/27/2004 at 19:03       By: Eric Weddington <arcanum>
Assigning to Marek as he has write permission in binutils (where this patch 
would go).

-------------------------------------------------------
Date: Thu 12/23/2004 at 08:54       By: Joerg Wunsch <joerg_wunsch>
This item has been reassigned from the project AVR C Runtime Library bugs 
tracker to your tracker.

The original report is still available at bugs #11383

Following are the information included in the original report:

[field #0] <font class="preinput"><font class="help" title="Unique item 
identifier">Item ID: </font></font> 11383<br>[field #1] <font 
class="preinput"><font class="help" title="Unique project identifier">Group ID: 
</font></font> 2140<br>[field #2] <font class="preinput"><font class="help" 
title="Current Status">Status: </font></font> Open<br>[field #3] <font 
class="preinput"><font class="help" title="Impact of the item on the system 
(Critical, Major,...)">Severity: </font></font> 5 - Average<br>[field #4] <font 
class="preinput"><font class="help" title="Determines whether the item can be 
seen by members of the project only or anybody.">Privacy: </font></font> 
Public<br>[field #5] <font class="preinput"><font class="help" title="Generally 
high level modules or functionalities of the software (e.g. User interface, 
Configuration Manager, etc)">Category: </font></font> Library<br>[field #6] 
<font class="preinput"><font class="help" title="User who originally submitted
the item">Submitted by: </font></font> None<br>[field #7] <font 
class="preinput"><font class="help" title="Who is in charge of handling this 
item">Assigned to: </font></font> None<br>[field #8] <font 
class="preinput"><font class="help" title="Date and time of the initial 
submission">Submitted on: </font></font> Thu 12/23/2004 at 08:21<br>[field #9] 
<font class="preinput"><font class="help" title="One line description of the 
item">Summary: </font></font> extend linker scripts to permit -fdata-sections 
(gcc PR14064) and  -ffunction-sections<br>[field #10] <font 
class="preinput"><font class="help" title="Full description of the 
item">Original Submission: </font></font> gcc-3.4.3 now fully supports 
-fdata-sections (PR14064) and<br />
-ffunction-sections for AVR targets.  It needs, however, modified linker 
scripts. see the attached patch for avr2.x<br>[field #12] <font 
class="preinput"><font class="help" title="Characterizes the nature of the item 
(e.g. Crash Error, Documentation Typo, Installation Problem, etc">Item Group: 
</font></font> None<br>[field #13] <font class="preinput"><font class="help" 
title="Current resolution of the item">Resolution: </font></font> 
None<br>[field #14] <font class="preinput"><font class="help" title="Version of 
the System Component (aka Item Category) impacted by the item">Component 
Version: </font></font> None<br>[field #15] <font class="preinput"><font 
class="help" title="Name and version of the platform impacted by the item 
(GNU/Linux with kernel 2.4, FreeBSD 5.1,...)">Platform Version: </font></font> 
None<br>[field #16] <font class="preinput"><font class="help" title="How easy 
it is to reproduce the item">Reproducibility: </font></font> None<br>[field #17]
<font class="preinput"><font class="help" title="Estimated size of the code to 
be developed or reworked to fix the item">Size (loc): </font></font> 
None<br>[field #18] <font class="preinput"><font class="help" title="Release in 
which the item was actually fixed">Fixed Release: </font></font> None<br>[field 
#19] <font class="preinput"><font class="help" title="Release in which it is 
planned to have the item fixed">Planned Release: </font></font> None<br>[field 
#20] <font class="preinput"><font class="help" title="Number of hours of work 
needed to fix the item">Effort: </font></font> 0.00<br>[field #24] <font 
class="preinput"><font class="help" title="How quickly the item should be 
handled">Priority: </font></font> 5 - Normal<br>[field #27] <font 
class="preinput"><font class="help" title="">Percent Complete: </font></font> 
0%<br>[field #29] <font class="preinput"><font class="help" title="Release 
(global version number) impacted by the item">Release: </font></font>
None<br>[field #32] <font class="preinput"><font class="help" title="Email 
address of the person who submitted the item (if different from the submitter 
field, add address to CC list)">Originator Email: </font></font> 
address@hidden<br>[field #54] <font class="preinput"><font class="help" 
title="Customizable Select Box (pull down menu with predefined values)">Custom 
Select Box #1: </font></font> None<br>[field #55] <font class="preinput"><font 
class="help" title="Customizable Select Box (pull down menu with predefined 
values)">Custom Select Box #2: </font></font> None<br>[field #56] <font 
class="preinput"><font class="help" title="Customizable Select Box (pull down 
menu with predefined values)">Custom Select Box #3: </font></font> 
None<br>[field #57] <font class="preinput"><font class="help" 
title="Customizable Select Box (pull down menu with predefined values)">Custom 
Select Box #4: </font></font> None<br>[field #58] <font class="preinput"><font 
class="help"
title="Customizable Select Box (pull down menu with predefined values)">Custom 
Select Box #5: </font></font> None<br>[field #59] <font class="preinput"><font 
class="help" title="Customizable Select Box (pull down menu with predefined 
values)">Custom Select Box #6: </font></font> None<br>[field #60] <font 
class="preinput"><font class="help" title="Customizable Select Box (pull down 
menu with predefined values)">Custom Select Box #7: </font></font> 
None<br>[field #61] <font class="preinput"><font class="help" 
title="Customizable Select Box (pull down menu with predefined values)">Custom 
Select Box #8: </font></font> None<br>[field #62] <font class="preinput"><font 
class="help" title="Customizable Select Box (pull down menu with predefined 
values)">Custom Select Box #9: </font></font> None<br>[field #63] <font 
class="preinput"><font class="help" title="Customizable Select Box (pull down 
menu with predefined values)">Custom Select Box #10: </font></font> None<br>

-------------------------------------------------------
Date: Thu 12/23/2004 at 08:54       By: Joerg Wunsch <joerg_wunsch>
Move to the patch tracker, as it is a feature request rather
than a bug, and a patch is supplied as well.




CC List
-------

CC Address                          | Comment
------------------------------------+-----------------------------
rolf_ebert --AT-- web --DOT-- de    | 



File Attachments
-------------------

-------------------------------------------------------
Date: Fri 01/07/2005 at 13:17  Name: avr.sc.udiff  Size: 1.51KB   By: rolf_ebert
Patch against avr.sc
http://savannah.nongnu.org/patch/download.php?item_id=3593&amp;item_file_id=4005

-------------------------------------------------------
Date: Thu 12/23/2004 at 08:21  Name: avr-libc-1.0-avr2.x.diff  Size: 1.73KB   
By: None
patch to linker script to make --gc-sections work correctly
http://savannah.nongnu.org/patch/download.php?item_id=3593&amp;item_file_id=3971






For detailed info, follow this link:
<http://savannah.nongnu.org/patch/?func=detailitem&item_id=3593>

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







reply via email to

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