Use ${CONSTRUCTING...} to enclose constructors and destructors.

This commit is contained in:
Nick Clifton 2000-11-03 19:49:05 +00:00
parent 36b0c0e021
commit 40a633d5ca
12 changed files with 399 additions and 279 deletions

View file

@ -1,3 +1,18 @@
2000-11-03 Nick Clifton <nickc@redhat.com>
* scripttempl/h8300.sc: Use ${CONSTRUCTING...} to enclose
constructors and destructors.
* scripttempl/h8300h.sc: Ditto.
* scripttempl/h8300s.sc: Ditto.
* scripttempl/h8500.sc: Ditto.
* scripttempl/h8500b.sc: Ditto.
* scripttempl/h8500c.sc: Ditto.
* scripttempl/h8500m.sc: Ditto.
* scripttempl/h8500s.sc: Ditto.
* scripttempl/v850.sc: Ditto.
* scripttempl/w65.sc: Ditto.
* scripttempl/z8000.sc: Ditto.
2000-11-02 Per Lundberg <plundis@chaosdev.org>
* Makefile.in (e_i386_chaos.c): New rule.

View file

@ -1,3 +1,13 @@
TORS=".tors :
{
___ctors = . ;
*(.ctors)
___ctors_end = . ;
___dtors = . ;
*(.dtors)
___dtors_end = . ;
} > ram"
cat <<EOF
OUTPUT_FORMAT("${OUTPUT_FORMAT}")
OUTPUT_ARCH(${ARCH})
@ -18,51 +28,59 @@ MEMORY
SECTIONS
{
.vectors : {
/* Use something like this to place a specific function's address
into the vector table.
.vectors :
{
/* Use something like this to place a specific
function's address into the vector table.
SHORT(ABSOLUTE(_foobar)) */
SHORT (ABSOLUTE (_foobar)). */
*(.vectors)
} ${RELOCATING+ > vectors}
.text : {
.text :
{
*(.rodata)
*(.text)
*(.strings)
${RELOCATING+ _etext = . ; }
} ${RELOCATING+ > ram}
.tors : {
___ctors = . ;
*(.ctors)
___ctors_end = . ;
___dtors = . ;
*(.dtors)
___dtors_end = . ;
} ${RELOCATING+ > ram}
.data : {
${CONSTRUCTING+${TORS}}
.data :
{
*(.data)
*(.tiny)
${RELOCATING+ _edata = . ; }
} ${RELOCATING+ > ram}
.bss : {
.bss :
{
${RELOCATING+ _bss_start = . ;}
*(.bss)
*(COMMON)
${RELOCATING+ _end = . ; }
} ${RELOCATING+ >ram}
.stack : {
.stack :
{
${RELOCATING+ _stack = . ; }
*(.stack)
} ${RELOCATING+ > topram}
.eight : {
.eight :
{
*(.eight)
} ${RELOCATING+ > eight}
.stab 0 ${RELOCATING+(NOLOAD)} : {
.stab 0 ${RELOCATING+(NOLOAD)} :
{
[ .stab ]
}
.stabstr 0 ${RELOCATING+(NOLOAD)} : {
.stabstr 0 ${RELOCATING+(NOLOAD)} :
{
[ .stabstr ]
}
}

View file

@ -1,3 +1,13 @@
TORS=".tors :
{
___ctors = . ;
*(.ctors)
___ctors_end = . ;
___dtors = . ;
*(.dtors)
___dtors_end = . ;
} > ram"
cat <<EOF
OUTPUT_FORMAT("${OUTPUT_FORMAT}")
OUTPUT_ARCH(h8300h)
@ -24,52 +34,63 @@ MEMORY
SECTIONS
{
.vectors : {
/* Use something like this to place a specific function's address
into the vector table.
.vectors :
{
/* Use something like this to place a specific
function's address into the vector table.
LONG(ABSOLUTE(_foobar)) */
LONG (ABSOLUTE (_foobar)). */
*(.vectors)
} ${RELOCATING+ > vectors}
.text : {
.text :
{
*(.rodata)
*(.text)
*(.strings)
${RELOCATING+ _etext = . ; }
} ${RELOCATING+ > ram}
.tors : {
___ctors = . ;
*(.ctors)
___ctors_end = . ;
___dtors = . ;
*(.dtors)
___dtors_end = . ;
} ${RELOCATING+ > ram}
.data : {
${CONSTRUCTING+${TORS}}
.data :
{
*(.data)
${RELOCATING+ _edata = . ; }
} ${RELOCATING+ > ram}
.bss : {
.bss :
{
${RELOCATING+ _bss_start = . ;}
*(.bss)
*(COMMON)
${RELOCATING+ _end = . ; }
} ${RELOCATING+ >ram}
.stack : {
.stack :
{
${RELOCATING+ _stack = . ; }
*(.stack)
} ${RELOCATING+ > topram}
.tiny : {
.tiny :
{
*(.tiny)
} ${RELOCATING+ > tiny}
.eight : {
.eight :
{
*(.eight)
} ${RELOCATING+ > eight}
.stab 0 ${RELOCATING+(NOLOAD)} : {
.stab 0 ${RELOCATING+(NOLOAD)} :
{
[ .stab ]
}
.stabstr 0 ${RELOCATING+(NOLOAD)} : {
.stabstr 0 ${RELOCATING+(NOLOAD)} :
{
[ .stabstr ]
}
}

View file

@ -1,3 +1,13 @@
TORS=".tors :
{
___ctors = . ;
*(.ctors)
___ctors_end = . ;
___dtors = . ;
*(.dtors)
___dtors_end = . ;
} > ram"
cat <<EOF
OUTPUT_FORMAT("${OUTPUT_FORMAT}")
OUTPUT_ARCH(h8300s)
@ -24,52 +34,63 @@ MEMORY
SECTIONS
{
.vectors : {
.vectors :
{
/* Use something like this to place a specific function's address
into the vector table.
LONG(ABSOLUTE(_foobar)) */
LONG (ABSOLUTE (_foobar)). */
*(.vectors)
} ${RELOCATING+ > vectors}
.text : {
.text :
{
*(.rodata)
*(.text)
*(.strings)
${RELOCATING+ _etext = . ; }
} ${RELOCATING+ > ram}
.tors : {
___ctors = . ;
*(.ctors)
___ctors_end = . ;
___dtors = . ;
*(.dtors)
___dtors_end = . ;
} ${RELOCATING+ > ram}
.data : {
${CONSTRUCTING+${TORS}}
.data :
{
*(.data)
${RELOCATING+ _edata = . ; }
} ${RELOCATING+ > ram}
.bss : {
.bss :
{
${RELOCATING+ _bss_start = . ;}
*(.bss)
*(COMMON)
${RELOCATING+ _end = . ; }
} ${RELOCATING+ >ram}
.stack : {
.stack :
{
${RELOCATING+ _stack = . ; }
*(.stack)
} ${RELOCATING+ > topram}
.tiny : {
.tiny :
{
*(.tiny)
} ${RELOCATING+ > tiny}
.eight : {
.eight :
{
*(.eight)
} ${RELOCATING+ > eight}
.stab 0 ${RELOCATING+(NOLOAD)} : {
.stab 0 ${RELOCATING+(NOLOAD)} :
{
[ .stab ]
}
.stabstr 0 ${RELOCATING+(NOLOAD)} : {
.stabstr 0 ${RELOCATING+(NOLOAD)} :
{
[ .stabstr ]
}
}

View file

@ -1,3 +1,11 @@
TORS="
___ctors = . ;
*(.ctors)
___ctors_end = . ;
___dtors = . ;
*(.dtors)
___dtors_end = . ;"
cat <<EOF
OUTPUT_FORMAT("${OUTPUT_FORMAT}")
OUTPUT_ARCH(${ARCH})
@ -9,11 +17,9 @@ SECTIONS
.text ${RELOCATING+ 0x0000 } :
{
*(.text)
${RELOCATING+ _etext = . ; }
}
.data ${RELOCATING+ . } :
{
*(.data)
@ -24,13 +30,9 @@ SECTIONS
{
*(.rdata);
*(.strings)
___ctors = . ;
*(.ctors)
___ctors_end = . ;
___dtors = . ;
*(.dtors)
___dtors_end = . ;
}
${CONSTRUCTING+${TORS}}
}
.bss ${RELOCATING+ . } :
{
@ -46,11 +48,12 @@ SECTIONS
*(.stack)
}
.stab 0 ${RELOCATING+(NOLOAD)} :
.stab 0 ${RELOCATING+(NOLOAD)} :
{
[ .stab ]
}
.stabstr 0 ${RELOCATING+(NOLOAD)} :
.stabstr 0 ${RELOCATING+(NOLOAD)} :
{
[ .stabstr ]
}

View file

@ -1,3 +1,11 @@
TORS="
___ctors = . ;
*(.ctors)
___ctors_end = . ;
___dtors = . ;
*(.dtors)
___dtors_end = . ;"
cat <<EOF
OUTPUT_FORMAT("${OUTPUT_FORMAT}")
OUTPUT_ARCH(${ARCH})
@ -24,13 +32,9 @@ SECTIONS
{
*(.rdata);
*(.strings)
___ctors = . ;
*(.ctors)
___ctors_end = . ;
___dtors = . ;
*(.dtors)
___dtors_end = . ;
}
${CONSTRUCTING+${TORS}}
}
.bss ${RELOCATING+ 0x40000} :
{

View file

@ -1,3 +1,11 @@
TORS="
___ctors = . ;
*(.ctors)
___ctors_end = . ;
___dtors = . ;
*(.dtors)
___dtors_end = . ;"
cat <<EOF
OUTPUT_FORMAT("${OUTPUT_FORMAT}")
OUTPUT_ARCH(${ARCH})
@ -20,15 +28,12 @@ SECTIONS
${RELOCATING+ _edata = . ; }
} ${RELOCATING+ > ram}
.rdata 0x30000 : {
.rdata 0x30000 :
{
*(.rdata);
___ctors = . ;
*(.ctors)
___ctors_end = . ;
___dtors = . ;
*(.dtors)
___dtors_end = . ;
} ${RELOCATING+ > ram}
${CONSTRUCTING+${TORS}}
} ${RELOCATING+ > ram}
.bss 0x40000 :
{

View file

@ -1,3 +1,11 @@
TORS="
___ctors = . ;
*(.ctors)
___ctors_end = . ;
___dtors = . ;
*(.dtors)
___dtors_end = . ;"
cat <<EOF
OUTPUT_FORMAT("${OUTPUT_FORMAT}")
OUTPUT_ARCH(${ARCH})
@ -12,7 +20,6 @@ SECTIONS
${RELOCATING+ _etext = . ; }
}
.data ${RELOCATING+ 0x20000} :
{
*(.data)
@ -23,12 +30,8 @@ SECTIONS
{
*(.rdata);
*(.strings)
___ctors = . ;
*(.ctors)
___ctors_end = . ;
___dtors = . ;
*(.dtors)
___dtors_end = . ;
${CONSTRUCTING+${TORS}}
}
.bss ${RELOCATING+ . } :
@ -45,11 +48,12 @@ SECTIONS
*(.stack)
}
.stab 0 ${RELOCATING+(NOLOAD)} :
.stab 0 ${RELOCATING+(NOLOAD)} :
{
[ .stab ]
}
.stabstr 0 ${RELOCATING+(NOLOAD)} :
.stabstr 0 ${RELOCATING+(NOLOAD)} :
{
[ .stabstr ]
}

View file

@ -1,3 +1,11 @@
TORS="
___ctors = . ;
*(.ctors)
___ctors_end = . ;
___dtors = . ;
*(.dtors)
___dtors_end = . ;"
cat <<EOF
OUTPUT_FORMAT("${OUTPUT_FORMAT}")
OUTPUT_ARCH(${ARCH})
@ -16,12 +24,8 @@ SECTIONS
{
*(.rdata);
*(.strings)
___ctors = . ;
*(.ctors)
___ctors_end = . ;
___dtors = . ;
*(.dtors)
___dtors_end = . ;
${CONSTRUCTING+${TORS}}
}
.data ${RELOCATING+ . } :
@ -44,11 +48,12 @@ SECTIONS
*(.stack)
}
.stab 0 ${RELOCATING+(NOLOAD)} :
.stab 0 ${RELOCATING+(NOLOAD)} :
{
[ .stab ]
}
.stabstr 0 ${RELOCATING+(NOLOAD)} :
.stabstr 0 ${RELOCATING+(NOLOAD)} :
{
[ .stabstr ]
}

View file

@ -4,13 +4,13 @@ OUTPUT_FORMAT("elf32-v850", "elf32-v850",
OUTPUT_ARCH(v850)
ENTRY(_start)
SEARCH_DIR(.);
/*/critters/slug/grossman/install/sun4/v850-elf/lib*/
SECTIONS
{
/* This saves a little space in the ELF file, since the zda starts
at a higher location that the ELF headers take up. */
.zdata ${ZDATA_START_ADDR} : {
.zdata ${ZDATA_START_ADDR} :
{
*(.zdata)
*(.zbss)
*(reszdata)
@ -23,13 +23,14 @@ SECTIONS
section. Specifically it prevents the zdata
section from being marked READONLY. */
.rozdata ${ROZDATA_START_ADDR} : {
.rozdata ${ROZDATA_START_ADDR} :
{
*(.rozdata)
*(romzdata)
*(romzbss)
}
/* Read-only sections, merged into text segment: */
/* Read-only sections, merged into text segment. */
. = ${TEXT_START_ADDR};
.interp : { *(.interp) }
.hash : { *(.hash) }
@ -58,9 +59,11 @@ SECTIONS
.init : { KEEP (*(.init)) } =0
.plt : { *(.plt) }
.text : {
.text :
{
*(.text)
${RELOCATING+*(.text.*)}
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
*(.gnu.linkonce.t*)
@ -73,11 +76,14 @@ SECTIONS
It contains a small lookup table at the start followed by the
code pointed to by entries in the lookup table. */
.call_table_data ${CALL_TABLE_START_ADDR} : {
.call_table_data ${CALL_TABLE_START_ADDR} :
{
${RELOCATING+PROVIDE(__ctbp = .);}
*(.call_table_data)
} = 0xff /* fill gaps with 0xff */
.call_table_text : {
} = 0xff /* Fill gaps with 0xff. */
.call_table_text :
{
*(.call_table_text)
}
@ -85,33 +91,36 @@ SECTIONS
.rodata : { *(.rodata) ${RELOCATING+*(.rodata.*)} *(.gnu.linkonce.r*) }
.rodata1 : { *(.rodata1) }
.data : {
.data :
{
*(.data)
${RELOCATING+*(.data.*)}
*(.gnu.linkonce.d*)
CONSTRUCTORS
}
.data1 : { *(.data1) }
.ctors : {
${RELOCATING+___ctors = .;}
.ctors :
{
${CONSTRUCTING+___ctors = .;}
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*crtend(.ctors))
${RELOCATING+___ctors_end = .;}
${CONSTRUCTING+___ctors_end = .;}
}
.dtors : {
${RELOCATING+___dtors = .;}
.dtors :
{
${CONSTRUCTING+___dtors = .;}
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*crtend.o(.dtors))
${RELOCATING+___dtors_end = .;}
${CONSTRUCTING+___dtors_end = .;}
}
.got : { *(.got.plt) *(.got) }
.dynamic : { *(.dynamic) }
.tdata ${TDATA_START_ADDR} : {
.tdata ${TDATA_START_ADDR} :
{
${RELOCATING+PROVIDE (__ep = .);}
*(.tbyte)
*(.tcommon_byte)
@ -123,21 +132,26 @@ SECTIONS
/* We want the small data sections together, so single-instruction offsets
can access them all, and initialized data all before uninitialized, so
we can shorten the on-disk segment size. */
.sdata ${SDATA_START_ADDR} : {
.sdata ${SDATA_START_ADDR} :
{
${RELOCATING+PROVIDE (__gp = . + 0x8000);}
*(.sdata)
}
/* See comment about .rozdata. */
.rosdata ${ROSDATA_START_ADDR} : {
.rosdata ${ROSDATA_START_ADDR} :
{
*(.rosdata)
}
/* We place the .sbss data section AFTER the .rosdata section, so that
it can directly preceed the .bss section. This allows runtime startup
code to initialise all the zero-data sections by simply taking the
value of '_edata' and zeroing until it reaches '_end' */
.sbss : {
value of '_edata' and zeroing until it reaches '_end'. */
.sbss :
{
${RELOCATING+__sbss_start = .;}
*(.sbss)
*(.scommon)
@ -192,17 +206,17 @@ SECTIONS
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
/* SGI/MIPS DWARF 2 extensions */
/* SGI/MIPS DWARF 2 extensions. */
.debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
/* User stack */
.stack 0x200000 : {
/* User stack. */
.stack 0x200000 :
{
${RELOCATING+__stack = .;}
*(.stack)
}
/* These must appear regardless of . */
}
EOF

View file

@ -1,10 +1,21 @@
TORS=".tors :
{
___ctors = . ;
*(.ctors)
___ctors_end = . ;
___dtors = . ;
*(.dtors)
___dtors_end = . ;
} > ram"
cat <<EOF
OUTPUT_FORMAT("${OUTPUT_FORMAT}")
OUTPUT_ARCH(${ARCH})
MEMORY {
MEMORY
{
ram : o = 0x1000, l = 512k
}
}
SECTIONS
{
@ -15,21 +26,14 @@ SECTIONS
${RELOCATING+ _etext = . ; }
} ${RELOCATING+ > ram}
.tors : {
___ctors = . ;
*(.ctors)
___ctors_end = . ;
___dtors = . ;
*(.dtors)
___dtors_end = . ;
} ${RELOCATING+ > ram}
${CONSTRUCTING+${TORS}}
.data :
{
*(.data)
${RELOCATING+ _edata = . ; }
} ${RELOCATING+ > ram}
.bss :
{
${RELOCATING+ _bss_start = . ; }
@ -37,16 +41,19 @@ SECTIONS
*(COMMON)
${RELOCATING+ _end = . ; }
} ${RELOCATING+ >ram}
.stack ${RELOCATING+ 0x30000 } :
{
${RELOCATING+ _stack = . ; }
*(.stack)
} ${RELOCATING+ > ram}
.stab . (NOLOAD) :
.stab . (NOLOAD) :
{
[ .stab ]
}
.stabstr . (NOLOAD) :
.stabstr . (NOLOAD) :
{
[ .stabstr ]
}

View file

@ -5,7 +5,8 @@ ENTRY(_start)
SECTIONS
{
.text ${BIG+ ${RELOCATING+ 0x0000000}} : {
.text ${BIG+ ${RELOCATING+ 0x0000000}} :
{
*(.text)
*(.strings)
*(.rdata)
@ -13,15 +14,16 @@ SECTIONS
.ctors ${BIG+ ${RELOCATING+ 0x2000000}} :
{
${RELOCATING+ ___ctors = . ; }
${CONSTRUCTING+ ___ctors = . ; }
*(.ctors);
${RELOCATING+ ___ctors_end = . ; }
${CONSTRUCTING+ ___ctors_end = . ; }
___dtors = . ;
*(.dtors);
${RELOCATING+ ___dtors_end = . ; }
${CONSTRUCTING+ ___dtors_end = . ; }
}
.data ${BIG+ ${RELOCATING+ 0x3000000}} : {
.data ${BIG+ ${RELOCATING+ 0x3000000}} :
{
*(.data)
}
@ -33,7 +35,8 @@ SECTIONS
${RELOCATING+ __end_bss = . ; }
}
.heap ${BIG+ ${RELOCATING+ 0x5000000}} : {
.heap ${BIG+ ${RELOCATING+ 0x5000000}} :
{
${RELOCATING+ __start_heap = . ; }
${RELOCATING+ . = . + 20k ; }
${RELOCATING+ __end_heap = . ; }