From 7e93422534d3c9e3b5ba50af96b14e1c9eaf39c4 Mon Sep 17 00:00:00 2001 From: nickc Date: Wed, 9 Apr 2003 11:07:50 +0000 Subject: [PATCH] Add initX, finiX, ctors, dtors sections to respect C++ constructor/destructor. Add ctors/dtors start/stop definitions. --- ld/ChangeLog | 7 +++++++ ld/scripttempl/elf32msp430.sc | 31 +++++++++++++++++++++++++++++++ ld/scripttempl/elf32msp430_3.sc | 31 +++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+) diff --git a/ld/ChangeLog b/ld/ChangeLog index 642f41af0e..848853fb22 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,10 @@ +2003-04-09 Dmitry Diky + + * scripttempl/elf32msp430.sc: Add initX, finiX, ctors, dtors + sections to respect C++ constructor/destructor. Add ctors/dtors + start/stop definitions. + * scripttempl/elf32msp430_3.sc: Likewise. + 2003-04-06 Nick Clifton * ld.texinfo (Options): Add a reminder of the target specific diff --git a/ld/scripttempl/elf32msp430.sc b/ld/scripttempl/elf32msp430.sc index ba6e03f77e..c3e78d32e6 100644 --- a/ld/scripttempl/elf32msp430.sc +++ b/ld/scripttempl/elf32msp430.sc @@ -77,13 +77,44 @@ SECTIONS /* 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 = . ; } + ${RELOCATING+. = ALIGN(2);} *(.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} diff --git a/ld/scripttempl/elf32msp430_3.sc b/ld/scripttempl/elf32msp430_3.sc index 40259bfa1f..15eb517230 100644 --- a/ld/scripttempl/elf32msp430_3.sc +++ b/ld/scripttempl/elf32msp430_3.sc @@ -74,13 +74,44 @@ SECTIONS /* Internal text space. */ .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 = . ; } + ${RELOCATING+. = ALIGN(2);} *(.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} -- 2.11.0