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] msp430 target. ld subdir. Add some section defenitions to respect C++ ctors/dtors.


Fellows,

The patch below introduces init0-init9 and fini0-fini9 sections where startup 
code and C++ constructors/destructors reside. Also, __ctors_start, 
__ctors_end, __dtors_start, __dtors_end added. Backward compatible with 
previous startup versions.

Cheers,
Dmitry


2003-04-08   Dmitry Diky  <diwil at mail dot ru>
	* scripttempl/elf32msp430.sc: Add initX, finiX, ctors, dtors sections to 	
	respect C++  constructor/destructor. Add ctors/dtors start/stop 
	defenitions.
	* scripttempl/elf32msp430_3.sc: Likewise.

Index: scripttempl/elf32msp430.sc
===================================================================
RCS file: /cvs/src/src/ld/scripttempl/elf32msp430.sc,v
retrieving revision 1.2
diff -c -3 -p -r1.2 elf32msp430.sc
*** scripttempl/elf32msp430.sc	11 Feb 2003 18:02:55 -0000	1.2
--- scripttempl/elf32msp430.sc	8 Apr 2003 15:36:42 -0000
*************** SECTIONS
*** 77,89 ****
    /* Internal text space.  */
    .text :
    {
-     *(.init)
      ${RELOCATING+. = ALIGN(2);}
      *(.text)
      ${RELOCATING+. = ALIGN(2);}
      *(.text.*)
      ${RELOCATING+. = ALIGN(2);}
      *(.fini)
      ${RELOCATING+ _etext = . ; }
    } ${RELOCATING+ > text}
  
--- 77,119 ----
    /* Internal text space.  */
    .text :
    {
      ${RELOCATING+. = ALIGN(2);}
+     *(.init)
+     *(.init0)  /* Start here after reset.  */
+     *(.init1)
+     *(.init2)  /* Copy data loop  */
+     *(.init3)
+     *(.init4)  /* Clear bss  */
+     *(.init5)
+     *(.init6)  /* C++ constructors.  */
+     *(.init7)
+     *(.init8)
+     *(.init9)  /* Call main().  */
+ 
+     
+     ${CONSTRUCTING+ __ctors_start = . ; }
+     ${CONSTRUCTING+ *(.ctors) }
+     ${CONSTRUCTING+ __ctors_end = . ; }
+     ${CONSTRUCTING+ __dtors_start = . ; }
+     ${CONSTRUCTING+ *(.dtors) }
+     ${CONSTRUCTING+ __dtors_end = . ; }
+     
      *(.text)
      ${RELOCATING+. = ALIGN(2);}
      *(.text.*)
      ${RELOCATING+. = ALIGN(2);}
+     *(.fini9)  /*   */
+     *(.fini8)
+     *(.fini7)
+     *(.fini6)  /* C++ destructors.  */
+     *(.fini5)
+     *(.fini4)
+     *(.fini3)
+     *(.fini2)
+     *(.fini1)
+     *(.fini0)  /* Infinite loop after program termination.  */
      *(.fini)
+       
      ${RELOCATING+ _etext = . ; }
    } ${RELOCATING+ > text}
  
Index: scripttempl/elf32msp430_3.sc
===================================================================
RCS file: /cvs/src/src/ld/scripttempl/elf32msp430_3.sc,v
retrieving revision 1.2
diff -c -3 -p -r1.2 elf32msp430_3.sc
*** scripttempl/elf32msp430_3.sc	11 Feb 2003 18:02:55 -0000	1.2
--- scripttempl/elf32msp430_3.sc	8 Apr 2003 15:36:42 -0000
*************** SECTIONS
*** 71,86 ****
    .rel.plt     ${RELOCATING-0} : { *(.rel.plt)          }
    .rela.plt    ${RELOCATING-0} : { *(.rela.plt)         }
  
-   /* Internal text space.  */
    .text :
    {
-     *(.init)
      ${RELOCATING+. = ALIGN(2);}
      *(.text)
      ${RELOCATING+. = ALIGN(2);}
      *(.text.*)
      ${RELOCATING+. = ALIGN(2);}
      *(.fini)
      ${RELOCATING+ _etext = . ; }
    } ${RELOCATING+ > text}
  
--- 71,114 ----
    .rel.plt     ${RELOCATING-0} : { *(.rel.plt)          }
    .rela.plt    ${RELOCATING-0} : { *(.rela.plt)         }
  
    .text :
    {
      ${RELOCATING+. = ALIGN(2);}
+     *(.init)
+     *(.init0)  /* Start here after reset.  */
+     *(.init1)
+     *(.init2)  /*   */
+     *(.init3)
+     *(.init4)  /*   */
+     *(.init5)
+     *(.init6)  /* C++ constructors.  */
+     *(.init7)
+     *(.init8)
+     *(.init9)  /* Call main().  */
+ 
+       ${CONSTRUCTING+ __ctors_start = . ; }
+     ${CONSTRUCTING+ *(.ctors) }
+     ${CONSTRUCTING+ __ctors_end = . ; }
+     ${CONSTRUCTING+ __dtors_start = . ; }
+     ${CONSTRUCTING+ *(.dtors) }
+     ${CONSTRUCTING+ __dtors_end = . ; }
+ 
      *(.text)
      ${RELOCATING+. = ALIGN(2);}
      *(.text.*)
      ${RELOCATING+. = ALIGN(2);}
+     *(.fini9)  /*   */
+     *(.fini8)
+     *(.fini7)
+     *(.fini6)  /* C++ destructors.  */
+     *(.fini5)
+     *(.fini4)
+     *(.fini3)
+     *(.fini2)
+     *(.fini1)
+     *(.fini0)  /* Infinite loop after program termination.  */
      *(.fini)
+ 
      ${RELOCATING+ _etext = . ; }
    } ${RELOCATING+ > text}
  

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