This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils 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]: Fix HC11/HC12 linker scripts


Hi!

I've committed this patch to fix problems in HC11/HC12 linker scripts:
  - we must use KEEP to make sure ctor/dtor are not removed by --gc-sections
  - handle the .tramp sections.

Committed on 2_14 and mainline.

Stephane

2003-07-23 Stephane Carrez <stcarrez@nerim.fr>

	* scripttempl/elfm68hc11.sc: Keep ctor/dtor sections; Take into
	account .tramp sections;
	* scripttempl/elfm68hc12.sc: Likewise.
Index: scripttempl/elfm68hc11.sc
===================================================================
RCS file: /cvs/src/src/ld/scripttempl/elfm68hc11.sc,v
retrieving revision 1.10
diff -u -p -r1.10 elfm68hc11.sc
--- scripttempl/elfm68hc11.sc	13 Oct 2002 09:29:35 -0000	1.10
+++ scripttempl/elfm68hc11.sc	23 Jul 2003 19:28:41 -0000
@@ -28,15 +28,7 @@ CTOR=".ctors ${CONSTRUCTING-0} : 
   {
     ${CONSTRUCTING+ PROVIDE (__CTOR_LIST__ = .); }
     ${CONSTRUCTING+${CTOR_START}}
-    *(.ctors)
-    /* We don't want to include the .ctor section from
-       from the crtend.o file until after the sorted ctors.
-       The .ctor section from the crtend file contains the
-       end of ctors marker and it must be last
-
-    KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
-    KEEP (*(SORT(.ctors.*)))
-    KEEP (*(.ctors)) */
+    KEEP (*(.ctors))
 
     ${CONSTRUCTING+${CTOR_END}}
     ${CONSTRUCTING+ PROVIDE(__CTOR_END__ = .); }
@@ -45,12 +37,7 @@ CTOR=".ctors ${CONSTRUCTING-0} : 
 DTOR="  .dtors	${CONSTRUCTING-0} :
   {
     ${CONSTRUCTING+ PROVIDE(__DTOR_LIST__ = .); }
-    *(.dtors)
-    /*
-    KEEP (*crtbegin.o(.dtors))
-    KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
-    KEEP (*(SORT(.dtors.*)))
-    KEEP (*(.dtors)) */
+    KEEP (*(.dtors))
     ${CONSTRUCTING+ PROVIDE(__DTOR_END__ = .); }
   } ${RELOCATING+ > ${TEXT_MEMORY}}"
 
@@ -326,6 +313,8 @@ SECTIONS
     /* .gnu.warning sections are handled specially by elf32.em.  */
     *(.gnu.warning)
     ${RELOCATING+*(.gnu.linkonce.t.*)}
+    ${RELOCATING+*(.tramp)}
+    ${RELOCATING+*(.tramp.*)}
 
     ${RELOCATING+${FINISH_CODE}}
 
Index: scripttempl/elfm68hc12.sc
===================================================================
RCS file: /cvs/src/src/ld/scripttempl/elfm68hc12.sc,v
retrieving revision 1.10
diff -u -p -r1.10 elfm68hc12.sc
--- scripttempl/elfm68hc12.sc	13 Oct 2002 09:29:35 -0000	1.10
+++ scripttempl/elfm68hc12.sc	23 Jul 2003 19:28:41 -0000
@@ -28,15 +28,7 @@ CTOR=".ctors ${CONSTRUCTING-0} : 
   {
     ${CONSTRUCTING+ PROVIDE (__CTOR_LIST__ = .); }
     ${CONSTRUCTING+${CTOR_START}}
-    *(.ctors)
-    /* We don't want to include the .ctor section from
-       from the crtend.o file until after the sorted ctors.
-       The .ctor section from the crtend file contains the
-       end of ctors marker and it must be last
-
-    KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
-    KEEP (*(SORT(.ctors.*)))
-    KEEP (*(.ctors)) */
+    KEEP (*(.ctors))
 
     ${CONSTRUCTING+${CTOR_END}}
     ${CONSTRUCTING+ PROVIDE(__CTOR_END__ = .); }
@@ -45,12 +37,7 @@ CTOR=".ctors ${CONSTRUCTING-0} : 
 DTOR="  .dtors	${CONSTRUCTING-0} :
   {
     ${CONSTRUCTING+ PROVIDE(__DTOR_LIST__ = .); }
-    *(.dtors)
-    /*
-    KEEP (*crtbegin.o(.dtors))
-    KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
-    KEEP (*(SORT(.dtors.*)))
-    KEEP (*(.dtors)) */
+    KEEP (*(.dtors))
     ${CONSTRUCTING+ PROVIDE(__DTOR_END__ = .); }
   } ${RELOCATING+ > ${TEXT_MEMORY}}"
 
@@ -324,6 +311,8 @@ SECTIONS
     /* .gnu.warning sections are handled specially by elf32.em.  */
     *(.gnu.warning)
     ${RELOCATING+*(.gnu.linkonce.t.*)}
+    ${RELOCATING+*(.tramp)}
+    ${RELOCATING+*(.tramp.*)}
 
     ${RELOCATING+${FINISH_CODE}}
 

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