diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1996-01-08 11:10:27 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1996-01-08 11:10:27 +0000 |
commit | 8b46c09925a80623c289e346c12921bc09fd1678 (patch) | |
tree | 01507d0da339cc7e5e6f5d16dfa625f94910b091 /gnu/usr.bin/binutils/ld/scripttempl | |
parent | 5d56227f9458a53138642c1b4488b4a30f85f334 (diff) |
Initial GNU binutils 2.6 import
Diffstat (limited to 'gnu/usr.bin/binutils/ld/scripttempl')
42 files changed, 2439 insertions, 0 deletions
diff --git a/gnu/usr.bin/binutils/ld/scripttempl/README b/gnu/usr.bin/binutils/ld/scripttempl/README new file mode 100644 index 00000000000..26ad2e934e2 --- /dev/null +++ b/gnu/usr.bin/binutils/ld/scripttempl/README @@ -0,0 +1,4 @@ +The files in this directory are linker script templates. +genscripts.sh sets some shell variables, then sources +EMULATION.sc, to generate EMULATION.{x,xr,xu,xn,xbn} -- the script +files for default, -r, -Ur, -n, -N. diff --git a/gnu/usr.bin/binutils/ld/scripttempl/a29k.sc b/gnu/usr.bin/binutils/ld/scripttempl/a29k.sc new file mode 100644 index 00000000000..2825b1e83ea --- /dev/null +++ b/gnu/usr.bin/binutils/ld/scripttempl/a29k.sc @@ -0,0 +1,37 @@ +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +${LIB_SEARCH_DIRS} + +SECTIONS +{ + .text : { + *(.text) + ${RELOCATING+ __etext = .}; + ${CONSTRUCTING+ __CTOR_LIST__ = .;} + ${CONSTRUCTING+ LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)} + ${CONSTRUCTING+ *(.ctors)} + ${CONSTRUCTING+ LONG(0)} + ${CONSTRUCTING+ __CTOR_END__ = .;} + ${CONSTRUCTING+ __DTOR_LIST__ = .;} + ${CONSTRUCTING+ LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)} + ${CONSTRUCTING+ *(.dtors)} + ${CONSTRUCTING+ LONG(0)} + ${CONSTRUCTING+ __DTOR_END__ = .;} + *(.lit) + *(.shdata) + } + .shbss SIZEOF(.text) + ADDR(.text) : { + *(.shbss) + } + .data : { + *(.data) + ${RELOCATING+ __edata = .}; + } + .bss SIZEOF(.data) + ADDR(.data) : + { + *(.bss) + *(COMMON) + ${RELOCATING+ __end = ALIGN(0x8)}; + } +} +EOF diff --git a/gnu/usr.bin/binutils/ld/scripttempl/aix.sc b/gnu/usr.bin/binutils/ld/scripttempl/aix.sc new file mode 100644 index 00000000000..29fc3547260 --- /dev/null +++ b/gnu/usr.bin/binutils/ld/scripttempl/aix.sc @@ -0,0 +1,54 @@ +# AIX linker script. +# AIX always uses shared libraries. The section VMA appears to be +# unimportant. The native linker aligns the sections on boundaries +# specified by the -H option. +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +OUTPUT_ARCH(${ARCH}) +${RELOCATING+${LIB_SEARCH_DIRS}} +ENTRY(__start) +SECTIONS +{ + .pad 0 : { *(.pad) } + .text ${RELOCATING-0} : { + ${RELOCATING+PROVIDE (_text = .);} + *(.text) + *(.pr) + *(.ro) + *(.db) + *(.gl) + *(.xo) + *(.ti) + *(.tb) + ${RELOCATING+PROVIDE (_etext = .);} + } + .data 0 : { + ${RELOCATING+PROVIDE (_data = .);} + *(.data) + *(.rw) + *(.sv) + *(.ua) + . = ALIGN(4); + ${CONSTRUCTING+CONSTRUCTORS} + *(.ds) + *(.tc0) + *(.tc) + *(.td) + ${RELOCATING+PROVIDE (_edata = .);} + } + .bss : { + *(.bss) + *(.bs) + *(.uc) + *(COMMON) + ${RELOCATING+PROVIDE (_end = .);} + ${RELOCATING+PROVIDE (end = .);} + } + .loader 0 : { + *(.loader) + } + .debug 0 : { + *(.debug) + } +} +EOF diff --git a/gnu/usr.bin/binutils/ld/scripttempl/alpha.sc b/gnu/usr.bin/binutils/ld/scripttempl/alpha.sc new file mode 100644 index 00000000000..3b0c921a45c --- /dev/null +++ b/gnu/usr.bin/binutils/ld/scripttempl/alpha.sc @@ -0,0 +1,71 @@ +# Linker script for Alpha systems. +# Ian Lance Taylor <ian@cygnus.com>. +# These variables may be overridden by the emulation file. The +# defaults are appropriate for an Alpha running OSF/1. +test -z "$ENTRY" && ENTRY=__start +test -z "$TEXT_START_ADDR" && TEXT_START_ADDR="0x120000000 + SIZEOF_HEADERS" +if test "x$LD_FLAG" = "xn" -o "x$LD_FLAG" = "xN"; then + DATA_ADDR=. +else + test -z "$DATA_ADDR" && DATA_ADDR=0x140000000 +fi +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +${LIB_SEARCH_DIRS} + +ENTRY(${ENTRY}) + +SECTIONS +{ + ${RELOCATING+. = ${TEXT_START_ADDR};} + .text : { + ${RELOCATING+ _ftext = . }; + ${RELOCATING+ __istart = . }; + ${RELOCATING+ *(.init) } + ${RELOCATING+ LONG (0x6bfa8001)} + ${RELOCATING+ eprol = .}; + *(.text) + ${RELOCATING+ __fstart = . }; + ${RELOCATING+ *(.fini)} + ${RELOCATING+ LONG (0x6bfa8001)} + ${RELOCATING+ _etext = .}; + } + .rdata : { + *(.rdata) + } + .pdata : { + ${RELOCATING+ _fpdata = .;} + *(.pdata) + } + ${RELOCATING+. = ${DATA_ADDR};} + .data : { + ${RELOCATING+ _fdata = .;} + *(.data) + ${CONSTRUCTING+CONSTRUCTORS} + } + .xdata : { + *(.xdata) + } + ${RELOCATING+ _gp = ALIGN (16) + 0x8000;} + .lit8 : { + *(.lit8) + } + .lita : { + *(.lita) + } + .sdata : { + *(.sdata) + } + ${RELOCATING+ _EDATA = .;} + ${RELOCATING+ _FBSS = .;} + .sbss : { + *(.sbss) + *(.scommon) + } + .bss : { + *(.bss) + *(COMMON) + } + ${RELOCATING+ _end = .;} +} +EOF diff --git a/gnu/usr.bin/binutils/ld/scripttempl/aout.sc b/gnu/usr.bin/binutils/ld/scripttempl/aout.sc new file mode 100644 index 00000000000..1898badf252 --- /dev/null +++ b/gnu/usr.bin/binutils/ld/scripttempl/aout.sc @@ -0,0 +1,50 @@ +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +OUTPUT_ARCH(${ARCH}) + +${RELOCATING+${LIB_SEARCH_DIRS}} +${STACKZERO+${RELOCATING+${STACKZERO}}} +${SHLIB_PATH+${RELOCATING+${SHLIB_PATH}}} +${RELOCATING+${EXECUTABLE_SYMBOLS}} +SECTIONS +{ + ${RELOCATING+. = ${TEXT_START_ADDR};} + .text : + { + CREATE_OBJECT_SYMBOLS + *(.text) + /* The next six sections are for SunOS dynamic linking. The order + is important. */ + *(.dynrel) + *(.hash) + *(.dynsym) + *(.dynstr) + *(.rules) + *(.need) + ${RELOCATING+_etext = .;} + ${RELOCATING+__etext = .;} + ${PAD_TEXT+${RELOCATING+. = ${DATA_ALIGNMENT};}} + } + ${RELOCATING+. = ${DATA_ALIGNMENT};} + .data : + { + /* The first three sections are for SunOS dynamic linking. */ + *(.dynamic) + *(.got) + *(.plt) + *(.data) + *(.linux-dynamic) /* For Linux dynamic linking. */ + ${CONSTRUCTING+CONSTRUCTORS} + ${RELOCATING+_edata = .;} + ${RELOCATING+__edata = .;} + } + .bss : + { + ${RELOCATING+ __bss_start = .}; + *(.bss) + *(COMMON) + ${RELOCATING+_end = ALIGN(4) }; + ${RELOCATING+__end = ALIGN(4) }; + } +} +EOF diff --git a/gnu/usr.bin/binutils/ld/scripttempl/armaout.sc b/gnu/usr.bin/binutils/ld/scripttempl/armaout.sc new file mode 100644 index 00000000000..e9276a877e1 --- /dev/null +++ b/gnu/usr.bin/binutils/ld/scripttempl/armaout.sc @@ -0,0 +1,35 @@ +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +OUTPUT_ARCH(${ARCH}) + +${RELOCATING+${LIB_SEARCH_DIRS}} +${STACKZERO+${RELOCATING+${STACKZERO}}} +SECTIONS +{ + .text ${RELOCATING+${TEXT_START_ADDR}} : + { + CREATE_OBJECT_SYMBOLS + ${RELOCATING+__stext_ = .;} + *(.text) + ${PAD_TEXT+${RELOCATING+. = ${DATA_ALIGNMENT};}} + ${RELOCATING+_etext = ${DATA_ALIGNMENT};} + ${RELOCATING+__etext = ${DATA_ALIGNMENT};} + } + .data ${RELOCATING+${DATA_ALIGNMENT}} : + { + ${RELOCATING+__sdata_ = .;} + *(.data) + ${CONSTRUCTING+CONSTRUCTORS} + ${RELOCATING+_edata = .;} + ${RELOCATING+__edata = .;} + } + .bss ${RELOCATING+ SIZEOF(.data) + ADDR (.data)} : + { + ${RELOCATING+ __bss_start = .}; + *(.bss) + *(COMMON) + ${RELOCATING+_end = ALIGN(4) }; + ${RELOCATING+__end = ALIGN(4) }; + } +} +EOF diff --git a/gnu/usr.bin/binutils/ld/scripttempl/armcoff.sc b/gnu/usr.bin/binutils/ld/scripttempl/armcoff.sc new file mode 100644 index 00000000000..3314d8141bb --- /dev/null +++ b/gnu/usr.bin/binutils/ld/scripttempl/armcoff.sc @@ -0,0 +1,39 @@ +# Linker script for ARM COFF. +# Based on i386coff.sc by Ian Taylor <ian@cygnus.com>. +test -z "$ENTRY" && ENTRY=_start +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +${LIB_SEARCH_DIRS} + +ENTRY(${ENTRY}) + +SECTIONS +{ + /* We start at 0x8000 because gdb assumes it (see FRAME_CHAIN). + The bottom part of memory is reserved anyway (but 32k?). */ + .text ${RELOCATING+ 0x8000} : { + *(.init) + *(.text) + *(.fini) + ${RELOCATING+ etext = .}; + } + .data ${RELOCATING+ 0x40000 + (. & 0xffc00fff)} : { + *(.data) + ${RELOCATING+ edata = .}; + } + .bss ${RELOCATING+ SIZEOF(.data) + ADDR(.data)} : + { + *(.bss) + *(COMMON) + ${RELOCATING+ end = .}; + } + .stab 0 ${RELOCATING+(NOLOAD)} : + { + [ .stab ] + } + .stabstr 0 ${RELOCATING+(NOLOAD)} : + { + [ .stabstr ] + } +} +EOF diff --git a/gnu/usr.bin/binutils/ld/scripttempl/delta68.sc b/gnu/usr.bin/binutils/ld/scripttempl/delta68.sc new file mode 100644 index 00000000000..d9963054e76 --- /dev/null +++ b/gnu/usr.bin/binutils/ld/scripttempl/delta68.sc @@ -0,0 +1,49 @@ +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +OUTPUT_ARCH(${ARCH}) +ENTRY(_start) +${RELOCATING+${LIB_SEARCH_DIRS}} + +SECTIONS +{ + .text ${RELOCATING+ 0x2000 + SIZEOF_HEADERS} : + { + ${RELOCATING+ __.text.start = .}; + *(.text) + ${RELOCATING+ etext = .;} + ${RELOCATING+ _etext = .;} + ${RELOCATING+ __.text.end = .}; + ${CONSTRUCTING+ __CTOR_LIST__ = .;} + ${CONSTRUCTING+ LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)} + ${CONSTRUCTING+ *(.ctors)} + ${CONSTRUCTING+ LONG(0)} + ${CONSTRUCTING+ __CTOR_END__ = .;} + ${CONSTRUCTING+ __DTOR_LIST__ = .;} + ${CONSTRUCTING+ LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)} + ${CONSTRUCTING+ *(.dtors)} + ${CONSTRUCTING+ LONG(0)} + ${CONSTRUCTING+ __DTOR_END__ = .;} + } + .data ${RELOCATING+ SIZEOF(.text) + ADDR(.text) + 0x400000} : + { + ${RELOCATING+ __.data.start = .}; + *(.data) + ${RELOCATING+ edata = .}; + ${RELOCATING+ _edata = .}; + ${RELOCATING+ __.data.end = .}; + } + .bss ${RELOCATING+ SIZEOF(.data) + ADDR(.data)} : + { + ${RELOCATING+ __.bss.start = .}; + *(.bss) + *(COMMON) + ${RELOCATING+ __.bss.end = .}; + ${RELOCATING+ end = ALIGN(0x8)}; + ${RELOCATING+ _end = ALIGN(0x8)}; + } + .comment ${RELOCATING+ 0} : + { + *(.comment) + } +} +EOF diff --git a/gnu/usr.bin/binutils/ld/scripttempl/ebmon29k.sc b/gnu/usr.bin/binutils/ld/scripttempl/ebmon29k.sc new file mode 100644 index 00000000000..62050ee2170 --- /dev/null +++ b/gnu/usr.bin/binutils/ld/scripttempl/ebmon29k.sc @@ -0,0 +1,27 @@ +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +ENTRY(start) + +SECTIONS { + .text ${RELOCATING+${TEXT_START_ADDR}} : + { + *(.text); + ${RELOCATING+_etext = .}; + } + data ${RELOCATING+0x80002000} : + { + *(.data); + *(.mstack); + *(.shbss); + *(.rstack); + *(.mstack); + ${CONSTRUCTING+CONSTRUCTORS} + } + .bss . : + { + *(COMMON) + *(.bss); + ${RELOCATING+_end = .}; + } +} +EOF diff --git a/gnu/usr.bin/binutils/ld/scripttempl/elf.sc b/gnu/usr.bin/binutils/ld/scripttempl/elf.sc new file mode 100644 index 00000000000..ea7c4c3ba93 --- /dev/null +++ b/gnu/usr.bin/binutils/ld/scripttempl/elf.sc @@ -0,0 +1,156 @@ +# +# Unusual variables checked by this code: +# NOP - two byte opcode for no-op (defaults to 0) +# DATA_ADDR - if end-of-text-plus-one-page isn't right for data start +# OTHER_READONLY_SECTIONS - other than .text .init .rodata ... +# (e.g., .PARISC.milli) +# OTHER_READWRITE_SECTIONS - other than .data .bss .ctors .sdata ... +# (e.g., .PARISC.global) +# OTHER_SECTIONS - at the end +# EXECUTABLE_SYMBOLS - symbols that must be defined for an +# executable (e.g., _DYNAMIC_LINK) +# TEXT_START_SYMBOLS - symbols that appear at the start of the +# .text section. +# DATA_START_SYMBOLS - symbols that appear at the start of the +# .data section. +# OTHER_BSS_SYMBOLS - symbols that appear at the start of the +# .bss section besides __bss_start. +# DATA_PLT - .plt should be in data segment, not text segment. +# +# When adding sections, do note that the names of some sections are used +# when specifying the start address of the next. +# +test -z "$ENTRY" && ENTRY=_start +test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT} +test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT} +test "$LD_FLAG" = "N" && DATA_ADDR=. +INTERP=".interp ${RELOCATING-0} : { *(.interp) }" +PLT=".plt ${RELOCATING-0} : { *(.plt) }" +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}", + "${LITTLE_OUTPUT_FORMAT}") +OUTPUT_ARCH(${ARCH}) +ENTRY(${ENTRY}) + +${RELOCATING+${LIB_SEARCH_DIRS}} +${RELOCATING+/* Do we need any of these for elf? + __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}} */} +${RELOCATING+${EXECUTABLE_SYMBOLS}} +${RELOCATING- /* For some reason, the Solaris linker makes bad executables + if gld -r is used and the intermediate file has sections starting + at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld + bug. But for now assigning the zero vmas works. */} +SECTIONS +{ + /* Read-only sections, merged into text segment: */ + ${CREATE_SHLIB-${RELOCATING+. = ${TEXT_START_ADDR} + SIZEOF_HEADERS;}} + ${CREATE_SHLIB+${RELOCATING+. = SIZEOF_HEADERS;}} + ${CREATE_SHLIB-${INTERP}} + .hash ${RELOCATING-0} : { *(.hash) } + .dynsym ${RELOCATING-0} : { *(.dynsym) } + .dynstr ${RELOCATING-0} : { *(.dynstr) } + .rel.text ${RELOCATING-0} : { *(.rel.text) } + .rela.text ${RELOCATING-0} : { *(.rela.text) } + .rel.data ${RELOCATING-0} : { *(.rel.data) } + .rela.data ${RELOCATING-0} : { *(.rela.data) } + .rel.rodata ${RELOCATING-0} : { *(.rel.rodata) } + .rela.rodata ${RELOCATING-0} : { *(.rela.rodata) } + .rel.got ${RELOCATING-0} : { *(.rel.got) } + .rela.got ${RELOCATING-0} : { *(.rela.got) } + .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) } + .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) } + .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) } + .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) } + .rel.init ${RELOCATING-0} : { *(.rel.init) } + .rela.init ${RELOCATING-0} : { *(.rela.init) } + .rel.fini ${RELOCATING-0} : { *(.rel.fini) } + .rela.fini ${RELOCATING-0} : { *(.rela.fini) } + .rel.bss ${RELOCATING-0} : { *(.rel.bss) } + .rela.bss ${RELOCATING-0} : { *(.rela.bss) } + .rel.plt ${RELOCATING-0} : { *(.rel.plt) } + .rela.plt ${RELOCATING-0} : { *(.rela.plt) } + .init ${RELOCATING-0} : { *(.init) } =${NOP-0} + ${DATA_PLT-${PLT}} + .text ${RELOCATING-0} : + { + ${RELOCATING+${TEXT_START_SYMBOLS}} + *(.text) + /* .gnu.warning sections are handled specially by elf32.em. */ + *(.gnu.warning) + } =${NOP-0} + ${RELOCATING+_etext = .;} + ${RELOCATING+PROVIDE (etext = .);} + .fini ${RELOCATING-0} : { *(.fini) } =${NOP-0} + .rodata ${RELOCATING-0} : { *(.rodata) } + .rodata1 ${RELOCATING-0} : { *(.rodata1) } + ${RELOCATING+${OTHER_READONLY_SECTIONS}} + + /* Adjust the address for the data segment. We want to adjust up to + the same address within the page on the next page up. It would + be more correct to do this: + ${RELOCATING+. = ${DATA_ADDR-ALIGN(${MAXPAGESIZE}) + + ((ALIGN(8) + ${MAXPAGESIZE} - ALIGN(${MAXPAGESIZE})) + & (${MAXPAGESIZE} - 1)};} + The current expression does not correctly handle the case of a + text segment ending precisely at the end of a page; it causes the + data segment to skip a page. The above expression does not have + this problem, but it will currently (2/95) cause BFD to allocate + a single segment, combining both text and data, for this case. + This will prevent the text segment from being shared among + multiple executions of the program; I think that is more + important than losing a page of the virtual address space (note + that no actual memory is lost; the page which is skipped can not + be referenced). */ + ${RELOCATING+. = ${DATA_ADDR- ALIGN(8) + ${MAXPAGESIZE}};} + + .data ${RELOCATING-0} : + { + ${RELOCATING+${DATA_START_SYMBOLS}} + *(.data) + ${CONSTRUCTING+CONSTRUCTORS} + } + .data1 ${RELOCATING-0} : { *(.data1) } + ${RELOCATING+${OTHER_READWRITE_SECTIONS}} + .ctors ${RELOCATING-0} : { *(.ctors) } + .dtors ${RELOCATING-0} : { *(.dtors) } + .got ${RELOCATING-0} : { *(.got.plt) *(.got) } + .dynamic ${RELOCATING-0} : { *(.dynamic) } + ${DATA_PLT+${PLT}} + /* 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 ${RELOCATING-0} : { *(.sdata) } + ${RELOCATING+_edata = .;} + ${RELOCATING+PROVIDE (edata = .);} + ${RELOCATING+__bss_start = .;} + ${RELOCATING+${OTHER_BSS_SYMBOLS}} + .sbss ${RELOCATING-0} : { *(.sbss) *(.scommon) } + .bss ${RELOCATING-0} : + { + *(.dynbss) + *(.bss) + *(COMMON) + } + ${RELOCATING+_end = . ;} + ${RELOCATING+PROVIDE (end = .);} + + /* These are needed for ELF backends which have not yet been + converted to the new style linker. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + + /* DWARF debug sections. + Symbols in the .debug DWARF section are relative to the beginning of the + section so we begin .debug at 0. It's not clear yet what needs to happen + for the others. */ + .debug 0 : { *(.debug) } + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + .debug_sfnames 0 : { *(.debug_sfnames) } + .line 0 : { *(.line) } + + /* These must appear regardless of ${RELOCATING}. */ + ${OTHER_SECTIONS} +} +EOF diff --git a/gnu/usr.bin/binutils/ld/scripttempl/elfppc.sc b/gnu/usr.bin/binutils/ld/scripttempl/elfppc.sc new file mode 100644 index 00000000000..13704659303 --- /dev/null +++ b/gnu/usr.bin/binutils/ld/scripttempl/elfppc.sc @@ -0,0 +1,166 @@ +# +# Unusual variables checked by this code: +# NOP - two byte opcode for no-op (defaults to 0) +# DATA_ADDR - if end-of-text-plus-one-page isn't right for data start +# OTHER_READONLY_SECTIONS - other than .text .init .ctors .rodata ... +# (e.g., .PARISC.milli) +# OTHER_READWRITE_SECTIONS - other than .data .bss .sdata ... +# (e.g., .PARISC.global) +# OTHER_SECTIONS - at the end +# EXECUTABLE_SYMBOLS - symbols that must be defined for an +# executable (e.g., _DYNAMIC_LINK) +# TEXT_START_SYMBOLS - symbols that appear at the start of the +# .text section. +# DATA_START_SYMBOLS - symbols that appear at the start of the +# .data section. +# OTHER_BSS_SYMBOLS - symbols that appear at the start of the +# .bss section besides __bss_start. +# DATA_PLT - .plt should be in data segment, not text segment. +# +# When adding sections, do note that the names of some sections are used +# when specifying the start address of the next. +# +test -z "$ENTRY" && ENTRY=_start +test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT} +test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT} +test "$LD_FLAG" = "N" && DATA_ADDR=. +INTERP=".interp ${RELOCATING-0} : { *(.interp) }" +PLT=".plt ${RELOCATING-0} : { *(.plt) }" +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}", + "${LITTLE_OUTPUT_FORMAT}") +OUTPUT_ARCH(${ARCH}) +ENTRY(${ENTRY}) + +${RELOCATING+${LIB_SEARCH_DIRS}} +${RELOCATING+/* Do we need any of these for elf? + __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}} */} +${RELOCATING+${EXECUTABLE_SYMBOLS}} +${RELOCATING- /* For some reason, the Solaris linker makes bad executables + if gld -r is used and the intermediate file has sections starting + at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld + bug. But for now assigning the zero vmas works. */} +SECTIONS +{ + /* Read-only sections, merged into text segment: */ + ${CREATE_SHLIB-${RELOCATING+. = ${TEXT_START_ADDR} + SIZEOF_HEADERS;}} + ${CREATE_SHLIB+${RELOCATING+. = SIZEOF_HEADERS;}} + ${CREATE_SHLIB-${INTERP}} + .hash ${RELOCATING-0} : { *(.hash) } + .dynsym ${RELOCATING-0} : { *(.dynsym) } + .dynstr ${RELOCATING-0} : { *(.dynstr) } + .rel.text ${RELOCATING-0} : { *(.rel.text) } + .rela.text ${RELOCATING-0} : { *(.rela.text) } + .rel.data ${RELOCATING-0} : { *(.rel.data) } + .rela.data ${RELOCATING-0} : { *(.rela.data) } + .rel.rodata ${RELOCATING-0} : { *(.rel.rodata) } + .rela.rodata ${RELOCATING-0} : { *(.rela.rodata) } + .rel.got ${RELOCATING-0} : { *(.rel.got) } + .rela.got ${RELOCATING-0} : { *(.rela.got) } + .rel.got1 ${RELOCATING-0} : { *(.rel.got1) } + .rela.got1 ${RELOCATING-0} : { *(.rela.got1) } + .rel.got2 ${RELOCATING-0} : { *(.rel.got2) } + .rela.got2 ${RELOCATING-0} : { *(.rela.got2) } + .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) } + .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) } + .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) } + .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) } + .rel.init ${RELOCATING-0} : { *(.rel.init) } + .rela.init ${RELOCATING-0} : { *(.rela.init) } + .rel.fini ${RELOCATING-0} : { *(.rel.fini) } + .rela.fini ${RELOCATING-0} : { *(.rela.fini) } + .rel.bss ${RELOCATING-0} : { *(.rel.bss) } + .rela.bss ${RELOCATING-0} : { *(.rela.bss) } + .rel.plt ${RELOCATING-0} : { *(.rel.plt) } + .rela.plt ${RELOCATING-0} : { *(.rela.plt) } + .init ${RELOCATING-0} : { *(.init) } =${NOP-0} + ${DATA_PLT-${PLT}} + .text ${RELOCATING-0} : + { + ${RELOCATING+${TEXT_START_SYMBOLS}} + *(.text) + /* .gnu.warning sections are handled specially by elf32.em. */ + *(.gnu.warning) + } =${NOP-0} + ${RELOCATING+_etext = .;} + ${RELOCATING+PROVIDE (etext = .);} + .fini ${RELOCATING-0} : { *(.fini) } =${NOP-0} + .rodata ${RELOCATING-0} : { *(.rodata) } + .rodata1 ${RELOCATING-0} : { *(.rodata1) } + ${RELOCATING+${OTHER_READONLY_SECTIONS}} + + /* Read-write section, merged into data segment: */ + ${RELOCATING+. = ${DATA_ADDR- ALIGN(8) + ${MAXPAGESIZE}};} + .data ${RELOCATING-0} : + { + ${RELOCATING+${DATA_START_SYMBOLS}} + *(.data) + ${CONSTRUCTING+CONSTRUCTORS} + } + .data1 ${RELOCATING-0} : { *(.data1) } + ${RELOCATING+${OTHER_READWRITE_SECTIONS}} + + ${RELOCATING+_GOT1_START_ = .;} + .got1 ${RELOCATING-0} : { *(.got1) } + ${RELOCATING+_GOT1_END_ = .;} + + .dynamic ${RELOCATING-0} : { *(.dynamic) } + + /* Put .ctors and .dtors next to the .got2 section, so that the pointers + get relocated with -mrelocatable. Also put in the .fixup pointers. */ + + ${RELOCATING+_GOT2_START_ = .;} + .got2 ${RELOCATING-0} : { *(.got2) } + + ${RELOCATING+__CTOR_LIST__ = .;} + .ctors ${RELOCATING-0} : { *(.ctors) } + ${RELOCATING+__CTOR_END__ = .;} + + ${RELOCATING+__DTOR_LIST__ = .;} + .dtors ${RELOCATING-0} : { *(.dtors) } + ${RELOCATING+__DTOR_END__ = .;} + + ${RELOCATING+_FIXUP_START_ = .;} + .fixup ${RELOCATING-0} : { *(.fixup) } + ${RELOCATING+_FIXUP_END_ = .;} + ${RELOCATING+_GOT2_END_ = .;} + + ${RELOCATING+_GOT_START_ = .;} + ${RELOCATING+_GLOBAL_OFFSET_TABLE_ = . + 32768;} + ${RELOCATING+_SDA_BASE_ = . + 32768;} + .got ${RELOCATING-0} : { *(.got.plt) *(.got) } + ${DATA_PLT+${PLT}} + /* 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 ${RELOCATING-0} : { *(.sdata) } + ${RELOCATING+_edata = .;} + ${RELOCATING+PROVIDE (edata = .);} + .sbss ${RELOCATING-0} : + { + ${RELOCATING+__sbss_start = .;} + *(.sbss) + *(.scommon) + ${RELOCATING+__sbss_end = .;} + } + ${RELOCATING+_GOT_END_ = .;} + .bss ${RELOCATING-0} : + { + ${RELOCATING+${OTHER_BSS_SYMBOLS}} + ${RELOCATING+__bss_start = .;} + *(.dynbss) + *(.bss) + *(COMMON) + } + ${RELOCATING+_end = . ;} + ${RELOCATING+PROVIDE (end = .);} + + /* These are needed for ELF backends which have not yet been + converted to the new style linker. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + + /* These must appear regardless of ${RELOCATING}. */ + ${OTHER_SECTIONS} +} +EOF diff --git a/gnu/usr.bin/binutils/ld/scripttempl/go32coff.sc b/gnu/usr.bin/binutils/ld/scripttempl/go32coff.sc new file mode 100644 index 00000000000..40f6076345a --- /dev/null +++ b/gnu/usr.bin/binutils/ld/scripttempl/go32coff.sc @@ -0,0 +1,33 @@ +# Linker script for 386 go32 +# DJ Delorie (dj@ctron.com) + +test -z "$ENTRY" && ENTRY=start +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +${LIB_SEARCH_DIRS} + +ENTRY(${ENTRY}) + +SECTIONS +{ + .text ${RELOCATING+ 0x1000+SIZEOF_HEADERS} : { + *(.text) + ${RELOCATING+ etext = . ; _etext = .}; + ${RELOCATING+ . = ALIGN(0x200);} + } + .data ${RELOCATING+ ${DATA_ALIGNMENT}} : { + ${RELOCATING+ *(.ctor)} + ${RELOCATING+ *(.dtor)} + *(.data) + ${RELOCATING+ edata = . ; _edata = .}; + ${RELOCATING+ . = ALIGN(0x200);} + } + .bss ${RELOCATING+ SIZEOF(.data) + ADDR(.data)} : + { + *(.bss) + *(COMMON) + ${RELOCATING+ end = . ; _end = .}; + ${RELOCATING+ . = ALIGN(0x200);} + } +} +EOF diff --git a/gnu/usr.bin/binutils/ld/scripttempl/h8300.sc b/gnu/usr.bin/binutils/ld/scripttempl/h8300.sc new file mode 100644 index 00000000000..ca90af7f144 --- /dev/null +++ b/gnu/usr.bin/binutils/ld/scripttempl/h8300.sc @@ -0,0 +1,59 @@ +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +OUTPUT_ARCH(${ARCH}) + +MEMORY { + rom : o = 0x0000, l = 0x7fe0 + duart : o = 0x7fe0, l = 16 + ram : o = 0x8000, l = 28k + topram : o = 0x8000+28k, l = 1k + hmsram : o = 0xfb80, l = 512 + } + +SECTIONS +{ +.text : + { + *(.text) + *(.strings) + ${RELOCATING+ _etext = . ; } + } ${RELOCATING+ > ram} +.tors : { + ___ctors = . ; + *(.ctors) + ___ctors_end = . ; + ___dtors = . ; + *(.dtors) + ___dtors_end = . ; +} ${RELOCATING+ > ram} +.data : + { + *(.data) + ${RELOCATING+ _edata = . ; } + } ${RELOCATING+ > ram} +.bss : + { + ${RELOCATING+ _bss_start = . ;} + *(.bss) + *(COMMON) + ${RELOCATING+ _end = . ; } + } ${RELOCATING+ >ram} +.stack : + { + ${RELOCATING+ _stack = . ; } + *(.stack) + } ${RELOCATING+ > topram} + .stab 0 ${RELOCATING+(NOLOAD)} : + { + [ .stab ] + } + .stabstr 0 ${RELOCATING+(NOLOAD)} : + { + [ .stabstr ] + } +} +EOF + + + + diff --git a/gnu/usr.bin/binutils/ld/scripttempl/h8300h.sc b/gnu/usr.bin/binutils/ld/scripttempl/h8300h.sc new file mode 100644 index 00000000000..3ecdce083bd --- /dev/null +++ b/gnu/usr.bin/binutils/ld/scripttempl/h8300h.sc @@ -0,0 +1,51 @@ +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +OUTPUT_ARCH(h8300h) + +MEMORY { + rom : o = 0x0000, l = 0x7fe0 + duart : o = 0x7fe0, l = 16 + ram : o = 0x8000, l = 28k + topram : o = 0x8000+28k, l = 1k + hmsram : o = 0xfb80, l = 512 + } + +SECTIONS +{ +.text : + { + *(.text) + *(.strings) + ${RELOCATING+ _etext = . ; } + } ${RELOCATING+ > ram} +.tors : { + ___ctors = . ; + *(.ctors) + ___ctors_end = . ; + ___dtors = . ; + *(.dtors) + ___dtors_end = . ; +} ${RELOCATING+ > ram} +.data : + { + *(.data) + ${RELOCATING+ _edata = . ; } + } ${RELOCATING+ > ram} +.bss : + { + ${RELOCATING+ _bss_start = . ;} + *(.bss) + *(COMMON) + ${RELOCATING+ _end = . ; } + } ${RELOCATING+ >ram} +.stack : + { + ${RELOCATING+ _stack = . ; } + *(.stack) + } ${RELOCATING+ > topram} +} +EOF + + + + diff --git a/gnu/usr.bin/binutils/ld/scripttempl/h8500.sc b/gnu/usr.bin/binutils/ld/scripttempl/h8500.sc new file mode 100644 index 00000000000..d6a39eec38c --- /dev/null +++ b/gnu/usr.bin/binutils/ld/scripttempl/h8500.sc @@ -0,0 +1,62 @@ +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +OUTPUT_ARCH(${ARCH}) + +/* Code and data 64k total */ + +SECTIONS +{ +.text ${RELOCATING+ 0x0000 } : + { + *(.text) + + ${RELOCATING+ _etext = . ; } + } + + +.data ${RELOCATING+ . } : + { + *(.data) + ${RELOCATING+ _edata = . ; } + } + +.rdata ${RELOCATING+ . } : + { + *(.rdata); + *(.strings) + ___ctors = . ; + *(.ctors) + ___ctors_end = . ; + ___dtors = . ; + *(.dtors) + ___dtors_end = . ; +} + +.bss ${RELOCATING+ . } : + { + ${RELOCATING+ __start_bss = . ; } + *(.bss) + *(COMMON) + ${RELOCATING+ _end = . ; } + } + +.stack ${RELOCATING+ 0xfff0} : + { + ${RELOCATING+ _stack = . ; } + *(.stack) + } + + .stab 0 ${RELOCATING+(NOLOAD)} : + { + [ .stab ] + } + .stabstr 0 ${RELOCATING+(NOLOAD)} : + { + [ .stabstr ] + } +} +EOF + + + + diff --git a/gnu/usr.bin/binutils/ld/scripttempl/h8500b.sc b/gnu/usr.bin/binutils/ld/scripttempl/h8500b.sc new file mode 100644 index 00000000000..ef5fa2c488a --- /dev/null +++ b/gnu/usr.bin/binutils/ld/scripttempl/h8500b.sc @@ -0,0 +1,62 @@ +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +OUTPUT_ARCH(${ARCH}) + +/* Code and data, both larger than 64k */ + +SECTIONS +{ +.text ${RELOCATING+ 0x10000} : + { + *(.text) + + ${RELOCATING+ _etext = . ; } + } + + +.data ${RELOCATING+ 0x20000} : + { + *(.data) + ${RELOCATING+ _edata = . ; } + } + +.rdata ${RELOCATING+ 0x30000} : + { + *(.rdata); + *(.strings) + ___ctors = . ; + *(.ctors) + ___ctors_end = . ; + ___dtors = . ; + *(.dtors) + ___dtors_end = . ; +} + +.bss ${RELOCATING+ 0x40000} : + { + ${RELOCATING+ __start_bss = . ; } + *(.bss) + *(COMMON) + ${RELOCATING+ _end = . ; } + } + +.stack ${RELOCATING+ 0x50000} : + { + ${RELOCATING+ _stack = . ; } + *(.stack) + } + + .stab 0 ${RELOCATING+(NOLOAD)} : + { + [ .stab ] + } + .stabstr 0 ${RELOCATING+(NOLOAD)} : + { + [ .stabstr ] + } +} +EOF + + + + diff --git a/gnu/usr.bin/binutils/ld/scripttempl/h8500c.sc b/gnu/usr.bin/binutils/ld/scripttempl/h8500c.sc new file mode 100644 index 00000000000..03880e3f068 --- /dev/null +++ b/gnu/usr.bin/binutils/ld/scripttempl/h8500c.sc @@ -0,0 +1,59 @@ +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +OUTPUT_ARCH(${ARCH}) + +/* Compact model - code < 64k, data > 64k */ + +SECTIONS +{ +.text 0x10000 : + { + *(.text) + *(.strings) + ${RELOCATING+ _etext = . ; } + } ${RELOCATING+ > ram} + + +.data 0x20000 : + { + *(.data) + ${RELOCATING+ _edata = . ; } + } ${RELOCATING+ > ram} + +.rdata 0x30000 : { + *(.rdata); + ___ctors = . ; + *(.ctors) + ___ctors_end = . ; + ___dtors = . ; + *(.dtors) + ___dtors_end = . ; +} ${RELOCATING+ > ram} + +.bss 0x40000 : + { + ${RELOCATING+ __start_bss = . ; } + *(.bss) + *(COMMON) + ${RELOCATING+ _end = . ; } + } ${RELOCATING+ >ram} +.stack 0x5fff0 : + { + ${RELOCATING+ _stack = . ; } + *(.stack) + } ${RELOCATING+ > topram} + + .stab 0 ${RELOCATING+(NOLOAD)} : + { + [ .stab ] + } + .stabstr 0 ${RELOCATING+(NOLOAD)} : + { + [ .stabstr ] + } +} +EOF + + + + diff --git a/gnu/usr.bin/binutils/ld/scripttempl/h8500m.sc b/gnu/usr.bin/binutils/ld/scripttempl/h8500m.sc new file mode 100644 index 00000000000..040a4a7c637 --- /dev/null +++ b/gnu/usr.bin/binutils/ld/scripttempl/h8500m.sc @@ -0,0 +1,61 @@ +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +OUTPUT_ARCH(${ARCH}) + +/* Code and data, both larger than 64k */ + +SECTIONS +{ +.text ${RELOCATING+ 0x10000} : + { + *(.text) + ${RELOCATING+ _etext = . ; } + } + + +.data ${RELOCATING+ 0x20000} : + { + *(.data) + ${RELOCATING+ _edata = . ; } + } + +.rdata ${RELOCATING+ . } : + { + *(.rdata); + *(.strings) + ___ctors = . ; + *(.ctors) + ___ctors_end = . ; + ___dtors = . ; + *(.dtors) + ___dtors_end = . ; + } + +.bss ${RELOCATING+ . } : + { + ${RELOCATING+ __start_bss = . ; } + *(.bss) + *(COMMON) + ${RELOCATING+ _end = . ; } + } + +.stack ${RELOCATING+ 0x2fff0} : + { + ${RELOCATING+ _stack = . ; } + *(.stack) + } + + .stab 0 ${RELOCATING+(NOLOAD)} : + { + [ .stab ] + } + .stabstr 0 ${RELOCATING+(NOLOAD)} : + { + [ .stabstr ] + } +} +EOF + + + + diff --git a/gnu/usr.bin/binutils/ld/scripttempl/h8500s.sc b/gnu/usr.bin/binutils/ld/scripttempl/h8500s.sc new file mode 100644 index 00000000000..11615d8afe9 --- /dev/null +++ b/gnu/usr.bin/binutils/ld/scripttempl/h8500s.sc @@ -0,0 +1,60 @@ +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +OUTPUT_ARCH(${ARCH}) + +/* Code and data, both 64k */ + +SECTIONS +{ +.text ${RELOCATING+ 0x10000 } : + { + *(.text) + ${RELOCATING+ _etext = . ; } + } + +.rdata ${RELOCATING+ 0x20000 } : + { + *(.rdata); + *(.strings) + ___ctors = . ; + *(.ctors) + ___ctors_end = . ; + ___dtors = . ; + *(.dtors) + ___dtors_end = . ; + } + +.data ${RELOCATING+ . } : + { + *(.data) + ${RELOCATING+ _edata = . ; } + } + +.bss ${RELOCATING+ .} : + { + ${RELOCATING+ __start_bss = . ; } + *(.bss) + *(COMMON) + ${RELOCATING+ _end = . ; } + } + +.stack ${RELOCATING+ 0x2fff0} : + { + ${RELOCATING+ _stack = . ; } + *(.stack) + } + + .stab 0 ${RELOCATING+(NOLOAD)} : + { + [ .stab ] + } + .stabstr 0 ${RELOCATING+(NOLOAD)} : + { + [ .stabstr ] + } +} +EOF + + + + diff --git a/gnu/usr.bin/binutils/ld/scripttempl/hppaelf.sc b/gnu/usr.bin/binutils/ld/scripttempl/hppaelf.sc new file mode 100644 index 00000000000..941ce08998c --- /dev/null +++ b/gnu/usr.bin/binutils/ld/scripttempl/hppaelf.sc @@ -0,0 +1,38 @@ +DATA_ADDR=0x40000000 +test "$LD_FLAG" = "N" && DATA_ADDR=. +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +OUTPUT_ARCH(${ARCH}) +ENTRY("\$START\$") +${RELOCATING+${LIB_SEARCH_DIRS}} +SECTIONS +{ + .text 0x1000 ${RELOCATING++${TEXT_START_ADDR}}: + { + ${RELOCATING+__text_start = .}; + CREATE_OBJECT_SYMBOLS + *(.PARISC.stubs) + *(.text) + ${RELOCATING+etext = .}; + ${RELOCATING+_etext = .}; + } + ${RELOCATING+. = ${DATA_ADDR};} + .data : + { + ${RELOCATING+ . = . + 0x1000 }; + ${RELOCATING+__data_start = .}; + *(.data) + ${CONSTRUCTING+CONSTRUCTORS} + ${RELOCATING+edata = .}; + ${RELOCATING+_edata = .}; + } + ${RELOCATING+. = ${DATA_ADDR} + SIZEOF(.data);} + .bss : + { + *(.bss) + *(COMMON) + ${RELOCATING+end = . }; + ${RELOCATING+_end = . }; + } +} +EOF diff --git a/gnu/usr.bin/binutils/ld/scripttempl/i386coff.sc b/gnu/usr.bin/binutils/ld/scripttempl/i386coff.sc new file mode 100644 index 00000000000..fbb1b7918c7 --- /dev/null +++ b/gnu/usr.bin/binutils/ld/scripttempl/i386coff.sc @@ -0,0 +1,43 @@ +# Linker script for 386 COFF. This works on SVR3.2 and SCO Unix 3.2.2. +# Ian Taylor <ian@cygnus.com>. +test -z "$ENTRY" && ENTRY=_start +# These are substituted in as variables in order to get '}' in a shell +# conditional expansion. +INIT='.init : { *(.init) }' +FINI='.fini : { *(.fini) }' +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +${LIB_SEARCH_DIRS} + +ENTRY(${ENTRY}) + +SECTIONS +{ + .text ${RELOCATING+ SIZEOF_HEADERS} : { + ${RELOCATING+ *(.init)} + *(.text) + ${RELOCATING+ *(.fini)} + ${RELOCATING+ etext = .}; + } + .data ${RELOCATING+ 0x400000 + (. & 0xffc00fff)} : { + *(.data) + ${RELOCATING+ edata = .}; + } + .bss ${RELOCATING+ SIZEOF(.data) + ADDR(.data)} : + { + *(.bss) + *(COMMON) + ${RELOCATING+ end = .}; + } + ${RELOCATING- ${INIT}} + ${RELOCATING- ${FINI}} + .stab 0 ${RELOCATING+(NOLOAD)} : + { + [ .stab ] + } + .stabstr 0 ${RELOCATING+(NOLOAD)} : + { + [ .stabstr ] + } +} +EOF diff --git a/gnu/usr.bin/binutils/ld/scripttempl/i386go32.sc b/gnu/usr.bin/binutils/ld/scripttempl/i386go32.sc new file mode 100644 index 00000000000..827198bc931 --- /dev/null +++ b/gnu/usr.bin/binutils/ld/scripttempl/i386go32.sc @@ -0,0 +1,45 @@ +# Linker script for i386 go32 COFF. +# stolen from ian +test -z "$ENTRY" && ENTRY=_start +# These are substituted in as variables in order to get '}' in a shell +# conditional expansion. +INIT='.init : { *(.init) }' +FINI='.fini : { *(.fini) }' +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +${LIB_SEARCH_DIRS} + +ENTRY(${ENTRY}) + +SECTIONS +{ + .text ${RELOCATING+ 0x10a8} : { + ${RELOCATING+ *(.init)} + *(.text) + ${RELOCATING+ *(.fini)} + ${RELOCATING+ etext = .}; + } + .data ALIGN (0x1000) : { + *(.data .data2) + *(.ctor) + *(.dtor) + ${RELOCATING+ _edata = .}; + } + .bss ${RELOCATING+ SIZEOF(.data) + ADDR(.data)} : + { + *(.bss) + *(COMMON) + ${RELOCATING+ end = .}; + } + ${RELOCATING- ${INIT}} + ${RELOCATING- ${FINI}} + .stab 0 ${RELOCATING+(NOLOAD)} : + { + [ .stab ] + } + .stabstr 0 ${RELOCATING+(NOLOAD)} : + { + [ .stabstr ] + } +} +EOF diff --git a/gnu/usr.bin/binutils/ld/scripttempl/i386lynx.sc b/gnu/usr.bin/binutils/ld/scripttempl/i386lynx.sc new file mode 100644 index 00000000000..16b72a43c75 --- /dev/null +++ b/gnu/usr.bin/binutils/ld/scripttempl/i386lynx.sc @@ -0,0 +1,46 @@ +test -z "$ENTRY" && ENTRY=_start +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +${LIB_SEARCH_DIRS} + +ENTRY(${ENTRY}) + +SECTIONS +{ + .text ${RELOCATING+ SIZEOF_HEADERS} : { + *(.init) + *(.text) + ${RELOCATING+ etext = .;} + ${CONSTRUCTING+ __CTOR_LIST__ = .;} + ${CONSTRUCTING+ LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)} + ${CONSTRUCTING+ *(.ctors)} + ${CONSTRUCTING+ LONG(0)} + ${CONSTRUCTING+ __CTOR_END__ = .;} + ${CONSTRUCTING+ __DTOR_LIST__ = .;} + ${CONSTRUCTING+ LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)} + ${CONSTRUCTING+ *(.dtors)} + ${CONSTRUCTING+ LONG(0)} + ${CONSTRUCTING+ __DTOR_END__ = .;} + *(.fini) + ${RELOCATING+ etext = .}; + } + .data ${RELOCATING+ 0x400000 + (. & 0xffc00fff)} : { + *(.data) + ${RELOCATING+ edata = .}; + } + .bss ${RELOCATING+ SIZEOF(.data) + ADDR(.data)} : + { + *(.bss) + *(COMMON) + ${RELOCATING+ end = .}; + } + .stab 0 ${RELOCATING+(NOLOAD)} : + { + [ .stab ] + } + .stabstr 0 ${RELOCATING+(NOLOAD)} : + { + [ .stabstr ] + } +} +EOF diff --git a/gnu/usr.bin/binutils/ld/scripttempl/i386msdos.sc b/gnu/usr.bin/binutils/ld/scripttempl/i386msdos.sc new file mode 100644 index 00000000000..783f2d9f913 --- /dev/null +++ b/gnu/usr.bin/binutils/ld/scripttempl/i386msdos.sc @@ -0,0 +1,40 @@ +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +OUTPUT_ARCH(${ARCH}) + +${RELOCATING+${LIB_SEARCH_DIRS}} +${STACKZERO+${RELOCATING+${STACKZERO}}} +SECTIONS +{ + ${RELOCATING+. = ${TEXT_START_ADDR};} + .text : + { + CREATE_OBJECT_SYMBOLS + *(.text) + ${RELOCATING+etext = .;} + ${RELOCATING+_etext = .;} + ${RELOCATING+__etext = .;} + ${PAD_TEXT+${RELOCATING+. = ${DATA_ALIGNMENT};}} + } + ${RELOCATING+. = ${DATA_ALIGNMENT};} + .rodata ${RELOCATING-0} : { *(.rodata) } + .data : + { + *(.data) + ${CONSTRUCTING+CONSTRUCTORS} + ${RELOCATING+edata = .;} + ${RELOCATING+_edata = .;} + ${RELOCATING+__edata = .;} + } + .bss : + { + ${RELOCATING+ _bss_start = .}; + ${RELOCATING+ __bss_start = .}; + *(.bss) + *(COMMON) + ${RELOCATING+end = ALIGN(4) }; + ${RELOCATING+_end = ALIGN(4) }; + ${RELOCATING+__end = ALIGN(4) }; + } +} +EOF diff --git a/gnu/usr.bin/binutils/ld/scripttempl/i960.sc b/gnu/usr.bin/binutils/ld/scripttempl/i960.sc new file mode 100644 index 00000000000..039e1af947f --- /dev/null +++ b/gnu/usr.bin/binutils/ld/scripttempl/i960.sc @@ -0,0 +1,25 @@ +cat <<EOF +SECTIONS +{ + .text : + { + ${GLD_STYLE+ CREATE_OBJECT_SYMBOLS} + *(.text) + ${RELOCATING+ _etext = .}; + ${CONSTRUCTING+${COFF_CTORS}} + } + .data SIZEOF(.text) + ADDR(.text): + { + *(.data) + ${CONSTRUCTING+CONSTRUCTORS} + ${RELOCATING+ _edata = .}; + } + .bss SIZEOF(.data) + ADDR(.data): + { + ${RELOCATING+ _bss_start = .}; + *(.bss) + *(COMMON) + ${RELOCATING+ _end = .}; + } +} +EOF diff --git a/gnu/usr.bin/binutils/ld/scripttempl/m68kcoff.sc b/gnu/usr.bin/binutils/ld/scripttempl/m68kcoff.sc new file mode 100644 index 00000000000..fa9379d81f5 --- /dev/null +++ b/gnu/usr.bin/binutils/ld/scripttempl/m68kcoff.sc @@ -0,0 +1,59 @@ +# This is totally made up, from the a29k stuff. If you know better, +# tell us about it. +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +${LIB_SEARCH_DIRS} + +MEMORY { + text : ORIGIN = 0x1000000, LENGTH = 0x1000000 + talias : ORIGIN = 0x2000000, LENGTH = 0x1000000 + data : ORIGIN = 0x3000000, LENGTH = 0x1000000 + mstack : ORIGIN = 0x4000000, LENGTH = 0x1000000 + rstack : ORIGIN = 0x5000000, LENGTH = 0x1000000 +} +SECTIONS +{ + .text : { + *(.text) + ${RELOCATING+ etext = .;} + ${CONSTRUCTING+ __CTOR_LIST__ = .;} + ${CONSTRUCTING+ LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)} + ${CONSTRUCTING+ *(.ctors)} + ${CONSTRUCTING+ LONG(0)} + ${CONSTRUCTING+ __CTOR_END__ = .;} + ${CONSTRUCTING+ __DTOR_LIST__ = .;} + ${CONSTRUCTING+ LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)} + ${CONSTRUCTING+ *(.dtors)} + ${CONSTRUCTING+ LONG(0)} + ${CONSTRUCTING+ __DTOR_END__ = .;} + *(.lit) + *(.shdata) + } ${RELOCATING+ > text} + .shbss SIZEOF(.text) + ADDR(.text) : { + *(.shbss) + } + .talias : { } ${RELOCATING+ > talias} + .data : { + *(.data) + ${RELOCATING+ edata = .}; + } ${RELOCATING+ > data} + .bss SIZEOF(.data) + ADDR(.data) : + { + ${RELOCATING+ __bss_start = .}; + *(.bss) + *(COMMON) + ${RELOCATING+ end = ALIGN(0x8)}; + ${RELOCATING+ _end = ALIGN(0x8)}; + } ${RELOCATING+ > data} + .mstack : { } ${RELOCATING+ > mstack} + .rstack : { } ${RELOCATING+ > rstack} + .stab 0 ${RELOCATING+(NOLOAD)} : + { + [ .stab ] + } + .stabstr 0 ${RELOCATING+(NOLOAD)} : + { + [ .stabstr ] + } +} +EOF diff --git a/gnu/usr.bin/binutils/ld/scripttempl/m68klynx.sc b/gnu/usr.bin/binutils/ld/scripttempl/m68klynx.sc new file mode 100644 index 00000000000..81d2245885a --- /dev/null +++ b/gnu/usr.bin/binutils/ld/scripttempl/m68klynx.sc @@ -0,0 +1,46 @@ +test -z "$ENTRY" && ENTRY=_start +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +${LIB_SEARCH_DIRS} + +ENTRY(${ENTRY}) + +SECTIONS +{ + .text ${RELOCATING+ SIZEOF_HEADERS} : { + *(.init) + *(.text) + ${RELOCATING+ etext = .;} + ${CONSTRUCTING+ ___CTOR_LIST__ = .;} + ${CONSTRUCTING+ LONG((___CTOR_END__ - ___CTOR_LIST__) / 4 - 2)} + ${CONSTRUCTING+ *(.ctors)} + ${CONSTRUCTING+ LONG(0)} + ${CONSTRUCTING+ ___CTOR_END__ = .;} + ${CONSTRUCTING+ ___DTOR_LIST__ = .;} + ${CONSTRUCTING+ LONG((___DTOR_END__ - ___DTOR_LIST__) / 4 - 2)} + ${CONSTRUCTING+ *(.dtors)} + ${CONSTRUCTING+ LONG(0)} + ${CONSTRUCTING+ ___DTOR_END__ = .;} + *(.fini) + ${RELOCATING+ etext = .}; + } + .data ${RELOCATING+ 0x400000 + (. & 0xffc00fff)} : { + *(.data .data2) + ${RELOCATING+ edata = .}; + } + .bss ${RELOCATING+ SIZEOF(.data) + ADDR(.data)} : + { + *(.bss) + *(COMMON) + ${RELOCATING+ end = .}; + } + .stab 0 ${RELOCATING+(NOLOAD)} : + { + [ .stab ] + } + .stabstr 0 ${RELOCATING+(NOLOAD)} : + { + [ .stabstr ] + } +} +EOF diff --git a/gnu/usr.bin/binutils/ld/scripttempl/m88kbcs.sc b/gnu/usr.bin/binutils/ld/scripttempl/m88kbcs.sc new file mode 100644 index 00000000000..8e6027660b5 --- /dev/null +++ b/gnu/usr.bin/binutils/ld/scripttempl/m88kbcs.sc @@ -0,0 +1,49 @@ +# These are substituted in as variables in order to get '}' in a shell +# conditional expansion. +INIT='.init : { *(.init) }' +FINI='.fini : { *(.fini) }' +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +OUTPUT_ARCH(${ARCH}) +ENTRY(__start) +${RELOCATING+${LIB_SEARCH_DIRS}} + +SECTIONS +{ + .text ${RELOCATING+ (0x20007 + SIZEOF_HEADERS) &~ 7} : + { + ${RELOCATING+ __.text.start = .}; + ${RELOCATING+ __.init.start = .}; + ${RELOCATING+ *(.init)} + ${RELOCATING+ __.init.end = .}; + *(.text) + ${RELOCATING+ __.tdesc_start = .}; + ${RELOCATING+ *(.tdesc)} + ${RELOCATING+ __.text_end = .} ; + ${RELOCATING+ __.initp.start = .}; + ${RELOCATING+ __.initp.end =.}; + ${RELOCATING+ __.fini_start = .}; + ${RELOCATING+ *(.fini) } + ${RELOCATING+ __.fini_end = .}; + ${RELOCATING+_etext =.}; + } + .data ${RELOCATING+ NEXT (0x400000) + ((SIZEOF(.text) + ADDR(.text)) % 0x2000)} : + { + *(.data) + ${RELOCATING+_edata = .}; + } + .bss ${RELOCATING+ SIZEOF(.data) + ADDR(.data)} : + { + *(.bss) + *(COMMON) + ${RELOCATING+ _end = .}; + ${RELOCATING+ __end = .}; + } + ${RELOCATING- ${INIT}} + ${RELOCATING- ${FINI}} + .comment 0 ${RELOCATING+(NOLOAD)} : + { + *(.comment) + } +} +EOF diff --git a/gnu/usr.bin/binutils/ld/scripttempl/mips.sc b/gnu/usr.bin/binutils/ld/scripttempl/mips.sc new file mode 100644 index 00000000000..41e824d9a57 --- /dev/null +++ b/gnu/usr.bin/binutils/ld/scripttempl/mips.sc @@ -0,0 +1,67 @@ +# Linker script for MIPS systems. +# Ian Lance Taylor <ian@cygnus.com>. +# These variables may be overridden by the emulation file. The +# defaults are appropriate for a DECstation running Ultrix. +test -z "$ENTRY" && ENTRY=__start +test -z "$TEXT_START_ADDR" && TEXT_START_ADDR="0x400000 + SIZEOF_HEADERS" +if test "x$LD_FLAG" = "xn" -o "x$LD_FLAG" = "xN"; then + DATA_ADDR=. +else + test -z "$DATA_ADDR" && DATA_ADDR=0x10000000 +fi +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}", + "${LITTLE_OUTPUT_FORMAT}") +${LIB_SEARCH_DIRS} + +ENTRY(${ENTRY}) + +SECTIONS +{ + ${RELOCATING+. = ${TEXT_START_ADDR};} + .text : { + ${RELOCATING+ _ftext = . }; + *(.init) + ${RELOCATING+ eprol = .}; + *(.text) + ${RELOCATING+PROVIDE (__runtime_reloc_start = .);} + *(.rel.sdata) + ${RELOCATING+PROVIDE (__runtime_reloc_stop = .);} + *(.fini) + ${RELOCATING+ etext = .}; + ${RELOCATING+ _etext = .}; + } + ${RELOCATING+. = ${DATA_ADDR};} + .rdata : { + *(.rdata) + } + ${RELOCATING+ _fdata = ALIGN(16);} + .data : { + *(.data) + ${CONSTRUCTING+CONSTRUCTORS} + } + ${RELOCATING+ _gp = ALIGN(16) + 0x8000;} + .lit8 : { + *(.lit8) + } + .lit4 : { + *(.lit4) + } + .sdata : { + *(.sdata) + } + ${RELOCATING+ edata = .;} + ${RELOCATING+ _edata = .;} + ${RELOCATING+ _fbss = .;} + .sbss : { + *(.sbss) + *(.scommon) + } + .bss : { + *(.bss) + *(COMMON) + } + ${RELOCATING+ end = .;} + ${RELOCATING+ _end = .;} +} +EOF diff --git a/gnu/usr.bin/binutils/ld/scripttempl/mipsbsd.sc b/gnu/usr.bin/binutils/ld/scripttempl/mipsbsd.sc new file mode 100644 index 00000000000..b222b335600 --- /dev/null +++ b/gnu/usr.bin/binutils/ld/scripttempl/mipsbsd.sc @@ -0,0 +1,30 @@ +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}", + "${LITTLE_OUTPUT_FORMAT}") +OUTPUT_ARCH(${ARCH}) + +${RELOCATING+${LIB_SEARCH_DIRS}} +SECTIONS +{ + ${RELOCATING+. = ${TEXT_START_ADDR};} + .text : + { + CREATE_OBJECT_SYMBOLS + *(.text) + ${RELOCATING+etext = ${DATA_ALIGNMENT};} + } + ${RELOCATING+. = ${DATA_ALIGNMENT};} + .data : + { + *(.data) + ${CONSTRUCTING+CONSTRUCTORS} + ${RELOCATING+edata = .;} + } + .bss : + { + *(.bss) + *(COMMON) + ${RELOCATING+end = . }; + } +} +EOF diff --git a/gnu/usr.bin/binutils/ld/scripttempl/nw.sc b/gnu/usr.bin/binutils/ld/scripttempl/nw.sc new file mode 100644 index 00000000000..725522c7895 --- /dev/null +++ b/gnu/usr.bin/binutils/ld/scripttempl/nw.sc @@ -0,0 +1,131 @@ +# +# Unusual variables checked by this code: +# NOP - two byte opcode for no-op (defaults to 0) +# DATA_ADDR - if end-of-text-plus-one-page isn't right for data start +# OTHER_READONLY_SECTIONS - other than .text .init .ctors .rodata ... +# (e.g., .PARISC.milli) +# OTHER_READWRITE_SECTIONS - other than .data .bss .sdata ... +# (e.g., .PARISC.global) +# OTHER_SECTIONS - at the end +# EXECUTABLE_SYMBOLS - symbols that must be defined for an +# executable (e.g., _DYNAMIC_LINK) +# TEXT_START_SYMBOLS - symbols that appear at the start of the +# .text section. +# DATA_START_SYMBOLS - symbols that appear at the start of the +# .data section. +# OTHER_BSS_SYMBOLS - symbols that appear at the start of the +# .bss section besides __bss_start. +# DATA_PLT - .plt should be in data segment, not text segment. +# +# When adding sections, do note that the names of some sections are used +# when specifying the start address of the next. +# +test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT} +test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT} +test "$LD_FLAG" = "N" && DATA_ADDR=. +INTERP=".interp ${RELOCATING-0} : { *(.interp) }" +PLT=".plt ${RELOCATING-0} : { *(.plt) }" +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}", + "${LITTLE_OUTPUT_FORMAT}") +OUTPUT_ARCH(${ARCH}) + +${RELOCATING+${LIB_SEARCH_DIRS}} +${RELOCATING+/* Do we need any of these for elf? + __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}} */} +${RELOCATING+${EXECUTABLE_SYMBOLS}} +${RELOCATING- /* For some reason, the Solaris linker makes bad executables + if gld -r is used and the intermediate file has sections starting + at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld + bug. But for now assigning the zero vmas works. */} +SECTIONS +{ + /* Read-only sections, merged into text segment: */ + ${CREATE_SHLIB-${RELOCATING+. = ${TEXT_START_ADDR} + SIZEOF_HEADERS;}} + ${CREATE_SHLIB+${RELOCATING+. = SIZEOF_HEADERS;}} + ${CREATE_SHLIB-${INTERP}} + .hash ${RELOCATING-0} : { *(.hash) } + .dynsym ${RELOCATING-0} : { *(.dynsym) } + .dynstr ${RELOCATING-0} : { *(.dynstr) } + .rel.text ${RELOCATING-0} : { *(.rel.text) } + .rela.text ${RELOCATING-0} : { *(.rela.text) } + .rel.data ${RELOCATING-0} : { *(.rel.data) } + .rela.data ${RELOCATING-0} : { *(.rela.data) } + .rel.rodata ${RELOCATING-0} : { *(.rel.rodata) } + .rela.rodata ${RELOCATING-0} : { *(.rela.rodata) } + .rel.got ${RELOCATING-0} : { *(.rel.got) } + .rela.got ${RELOCATING-0} : { *(.rela.got) } + .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) } + .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) } + .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) } + .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) } + .rel.bss ${RELOCATING-0} : { *(.rel.bss) } + .rela.bss ${RELOCATING-0} : { *(.rela.bss) } + .rel.plt ${RELOCATING-0} : { *(.rel.plt) } + .rela.plt ${RELOCATING-0} : { *(.rela.plt) } + .init ${RELOCATING-0} : { *(.init) } =${NOP-0} + ${DATA_PLT-${PLT}} + .text ${RELOCATING-0} : + { + ${RELOCATING+${TEXT_START_SYMBOLS}} + *(.text) + ${CONSTRUCTING+ __CTOR_LIST__ = .;} + ${CONSTRUCTING+ LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)} + ${CONSTRUCTING+ *(.ctors)} + ${CONSTRUCTING+ LONG(0)} + ${CONSTRUCTING+ __CTOR_END__ = .;} + ${CONSTRUCTING+ __DTOR_LIST__ = .;} + ${CONSTRUCTING+ LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)} + ${CONSTRUCTING+ *(.dtors)} + ${CONSTRUCTING+ LONG(0)} + ${CONSTRUCTING+ __DTOR_END__ = .;} + } + ${RELOCATING+_etext = .;} + ${RELOCATING+PROVIDE (etext = .);} + .fini ${RELOCATING-0} : { *(.fini) } =${NOP-0} + .ctors ${RELOCATING-0} : { *(.ctors) } + .dtors ${RELOCATING-0} : { *(.dtors) } + .rodata ${RELOCATING-0} : { *(.rodata) } + .rodata1 ${RELOCATING-0} : { *(.rodata1) } + ${RELOCATING+${OTHER_READONLY_SECTIONS}} + + /* Read-write section, merged into data segment: */ + ${RELOCATING+. = ${DATA_ADDR- ALIGN(8) + ${MAXPAGESIZE}};} + .data ${RELOCATING-0} : + { + ${RELOCATING+${DATA_START_SYMBOLS}} + *(.data) + ${CONSTRUCTING+CONSTRUCTORS} + } + .data1 ${RELOCATING-0} : { *(.data1) } + ${RELOCATING+${OTHER_READWRITE_SECTIONS}} + .got ${RELOCATING-0} : { *(.got.plt) *(.got) } + .dynamic ${RELOCATING-0} : { *(.dynamic) } + ${DATA_PLT+${PLT}} + /* 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 ${RELOCATING-0} : { *(.sdata) } + ${RELOCATING+_edata = .;} + ${RELOCATING+PROVIDE (edata = .);} + ${RELOCATING+__bss_start = .;} + ${RELOCATING+${OTHER_BSS_SYMBOLS}} + .sbss ${RELOCATING-0} : { *(.sbss) *(.scommon) } + .bss ${RELOCATING-0} : + { + *(.dynbss) + *(.bss) + *(COMMON) + } + ${RELOCATING+_end = . ;} + ${RELOCATING+PROVIDE (end = .);} + + /* These are needed for ELF backends which have not yet been + converted to the new style linker. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + + /* These must appear regardless of ${RELOCATING}. */ + ${OTHER_SECTIONS} +} +EOF diff --git a/gnu/usr.bin/binutils/ld/scripttempl/pe.sc b/gnu/usr.bin/binutils/ld/scripttempl/pe.sc new file mode 100644 index 00000000000..608cd2d8a43 --- /dev/null +++ b/gnu/usr.bin/binutils/ld/scripttempl/pe.sc @@ -0,0 +1,124 @@ +# Linker script for PE. +# These are substituted in as variables in order to get '}' in a shell +# conditional expansion. +INIT='.init : { *(.init) }' +FINI='.fini : { *(.fini) }' +cat <<EOF +OUTPUT_FORMAT(${OUTPUT_FORMAT}) +${LIB_SEARCH_DIRS} + +ENTRY(_mainCRTStartup) + +SECTIONS +{ + + .text ${RELOCATING+ __image_base__ + __section_alignment__ } : + { + ${RELOCATING+ *(.init);} + *(.text) + ${CONSTRUCTING+ ___CTOR_LIST__ = .; __CTOR_LIST__ = . ; + LONG (-1); *(.ctors); *(.ctor); LONG (0); } + ${CONSTRUCTING+ ___DTOR_LIST__ = .; __DTOR_LIST__ = . ; + LONG (-1); *(.dtors); *(.dtor); LONG (0); } + ${RELOCATING+ *(.fini);} + ${RELOCATING+ etext = .}; + } + + .bss BLOCK(__section_alignment__) : + { + __bss_start__ = . ; + *(.bss) ; + *(COMMON); + __bss_end__ = . ; + ${RELOCATING+ end = .}; + } + .data BLOCK(__section_alignment__) : + { + __data_start__ = . ; + *(.data); + *(.data2); + __data_end__ = . ; + } + + .rdata BLOCK(__section_alignment__) : + { + *(.rdata) + ; + } + + + + .edata BLOCK(__section_alignment__) : { + *(.edata) ; + } + + .junk BLOCK(__section_alignment__) : { + *(.debug\$S) + *(.debug\$T) + *(.debug\$F) + *(.drectve) + ; + } + + .idata BLOCK(__section_alignment__) : + { + *(.idata\$2) + *(.idata\$3) + *(.idata\$4) + *(.idata\$5) + *(.idata\$6) + *(.idata\$7) + ; + } + .CRT BLOCK(__section_alignment__) : + { + *(.CRT\$XCA) + *(.CRT\$XCC) + *(.CRT\$XCZ) + *(.CRT\$XIA) + *(.CRT\$XIC) + *(.CRT\$XIZ) + *(.CRT\$XLA) + *(.CRT\$XLZ) + *(.CRT\$XPA) + *(.CRT\$XPX) + *(.CRT\$XPZ) + *(.CRT\$XTA) + *(.CRT\$XTZ) + ; + } + .rsrc BLOCK(__section_alignment__) : + { + *(.rsrc\$01) + *(.rsrc\$02) + ; + } + .junk BLOCK(__section_alignment__) : + { + *(.debug\$S) + *(.debug\$T) + *(.debug\$F) + *(.drectve) + ; + } + + .stab BLOCK(__section_alignment__) ${RELOCATING+(NOLOAD)} : + { + [ .stab ] + } + + .stabstr BLOCK(__section_alignment__) ${RELOCATING+(NOLOAD)} : + { + [ .stabstr ] + } + + + .reloc BLOCK(__section_alignment__) : + { + *(.reloc) + ; + } + + +} +EOF diff --git a/gnu/usr.bin/binutils/ld/scripttempl/ppcpe.sc b/gnu/usr.bin/binutils/ld/scripttempl/ppcpe.sc new file mode 100644 index 00000000000..bfeca163eaa --- /dev/null +++ b/gnu/usr.bin/binutils/ld/scripttempl/ppcpe.sc @@ -0,0 +1,191 @@ +# A PE linker script for PowerPC. +# Loosely based on Steve Chamberlain's pe.sc. +# All new mistakes should be credited to Kim Knuttila (krk@cygnus.com) +# +# These are substituted in as variables in order to get '}' in a shell +# conditional expansion. +INIT='.init : { *(.init) }' +FINI='.fini : { *(.fini) }' +cat <<EOF +OUTPUT_FORMAT(${OUTPUT_FORMAT}) +${LIB_SEARCH_DIRS} + +/* Much of this layout was determined by delving into .exe files for + the box generated by other compilers/linkers/etc. This means that + if a particular feature did not happen to appear in one of the + subject files, then it may not be yet supported. +*/ + +/* It's "mainCRTStartup", not "_mainCRTStartup", and it's located in + one of the two .lib files (libc.lib and kernel32.lib) that currently + must be present on the link line. This means that you must use + "-u mainCRTStartup" to make sure it gets included in the link. +*/ + +ENTRY(mainCRTStartup) + +SECTIONS +{ + + /* text - the usual meaning */ + .text ${RELOCATING+ __image_base__ + __section_alignment__ } : + { + ${RELOCATING+ *(.init);} + *(.text) + ${CONSTRUCTING+ ___CTOR_LIST__ = .; __CTOR_LIST__ = . ; + LONG (-1); *(.ctors); *(.ctor); LONG (0); } + ${CONSTRUCTING+ ___DTOR_LIST__ = .; __DTOR_LIST__ = . ; + LONG (-1); *(.dtors); *(.dtor); LONG (0); } + ${RELOCATING+ *(.fini);} + ${RELOCATING+ etext = .}; + } + + /* rdata - Read Only Runtime Data + CTR sections: All of the CRT (read only C runtime data) sections + appear at the start of the .rdata (read only runtime data) + section, in the following order. Don't know if it matters or not. + Not all sections are always present either. + .rdata: compiler generated read only data + .xdata: compiler generated exception handling table. (Most docs + seem to suggest that this section is now deprecated infavor + of the ydata section) + .edata: The exported names table. + */ + .rdata BLOCK(__section_alignment__) : + { + *(.CRT\$XCA); + *(.CRT\$XCC); + *(.CRT\$XCZ); + *(.CRT\$XIA); + *(.CRT\$XIC); + *(.CRT\$XIZ); + *(.CRT\$XLA); + *(.CRT\$XLZ); + *(.CRT\$XPA); + *(.CRT\$XPX); + *(.CRT\$XPZ); + *(.CRT\$XTA); + *(.CRT\$XTZ); + *(.rdata); + *(.xdata); + *(.edata); + } + + /* data - initialized data + .ydata: exception handling information. + .data: the usual meaning. + .data2: more of the same. + .bss: For some reason, bss appears to be included in the data + section, as opposed to being given a section of it's own. + COMMON: + */ + .data BLOCK(__section_alignment__) : + { + __data_start__ = . ; + *(.ydata); + *(.data); + *(.data2); + __bss_start__ = . ; + *(.bss) ; + *(COMMON); + __bss_end__ = . ; + ${RELOCATING+ end = .}; + __data_end__ = . ; + } + + /* The exception handling table. A sequence of 5 word entries. Section + address and extent are placed in the DataDirectory. + */ + .pdata BLOCK(__section_alignment__) : + { + *(.pdata) + ; + } + + /* The idata section is chock full of magic bits. + 1. Boundaries around various idata parts are used to initialize + some of the fields of the DataDirectory. In particular, the + magic for 2, 4 and 5 are known to be used. Some compilers + appear to generate magic section symbols for this purpose. + Where we can, we catch such symbols and use our own. This of + course is something less than a perfect strategy. + 2. The table of contents is placed immediately after idata4. + The ".private.toc" sections are generated by the ppc bfd. The + .toc variable is generated by gas, and resolved here. It is + used to initialized function descriptors (and anyone else who + needs the address of the module's toc). The only thing + interesting about it at all? Most ppc instructions using it + have a 16bit displacement field. The convention for addressing + is to initialize the .toc value to 32K past the start of the + actual toc, and subtract 32K from all references, thus using + the entire 64K range. Naturally, the reloc code must agree + on this number or you get pretty stupid results. + */ + .idata BLOCK(__section_alignment__) : + { + __idata2_magic__ = .; + *(.idata\$2); + __idata3_magic__ = .; + *(.idata\$3); + __idata4_magic__ = .; + *(.idata\$4); + .toc = . + 32768; + *(.private.toc); + __idata5_magic__ = .; + *(.idata\$5); + __idata6_magic__ = .; + *(.idata\$6); + __idata7_magic__ = .; + *(.idata\$7); + ; + } + + /* reldata -- data that requires relocation + */ + .reldata BLOCK(__section_alignment__) : + { + *(.reldata) + ; + } + + /* We don't do anything useful with codeview debugger support or the + directive section (yet). Hopefully, we junk them correctly. + */ + .junk BLOCK(__section_alignment__) : + { + *(.debug\$S) + *(.debug\$T) + *(.debug\$F) + *(.drectve) + ; + } + + /* Resources */ + .rsrc BLOCK(__section_alignment__) : + { + *(.rsrc\$01) + *(.rsrc\$02) + ; + } + + /* The .reloc section is currently generated by the dlltool from Steve + Chamberlain in a second pass of linking. Section address and extent + are placed in the DataDirectory. + */ + .reloc BLOCK(__section_alignment__) : + { + *(.reloc) + ; + } + + .stab BLOCK(__section_alignment__) ${RELOCATING+(NOLOAD)} : + { + [ .stab ] + } + + .stabstr BLOCK(__section_alignment__) ${RELOCATING+(NOLOAD)} : + { + [ .stabstr ] + } +} +EOF diff --git a/gnu/usr.bin/binutils/ld/scripttempl/riscix.sc b/gnu/usr.bin/binutils/ld/scripttempl/riscix.sc new file mode 100644 index 00000000000..c801a0c4a99 --- /dev/null +++ b/gnu/usr.bin/binutils/ld/scripttempl/riscix.sc @@ -0,0 +1,35 @@ +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +OUTPUT_ARCH(${ARCH}) + +${RELOCATING+${LIB_SEARCH_DIRS}} +${RELOCATING+__DYNAMIC = 0;} +${STACKZERO+${RELOCATING+${STACKZERO}}} +${SHLIB_PATH+${RELOCATING+${SHLIB_PATH}}} +SECTIONS +{ + .text ${RELOCATING+${TEXT_START_ADDR}}: + { + CREATE_OBJECT_SYMBOLS + *(.text) + ${PAD_TEXT+${RELOCATING+. = ${DATA_ALIGNMENT};}} + ${RELOCATING+_etext = ${DATA_ALIGNMENT};} + ${RELOCATING+__etext = ${DATA_ALIGNMENT};} + } + .data ${RELOCATING+${DATA_ALIGNMENT}} : + { + *(.data) + ${CONSTRUCTING+CONSTRUCTORS} + ${RELOCATING+_edata = .;} + ${RELOCATING+__edata = .;} + } + .bss ${RELOCATING+SIZEOF(.data) + ADDR(.data)} : + { + ${RELOCATING+ __bss_start = .}; + *(.bss) + *(COMMON) + ${RELOCATING+_end = ALIGN(4) }; + ${RELOCATING+__end = ALIGN(4) }; + } +} +EOF diff --git a/gnu/usr.bin/binutils/ld/scripttempl/sa29200.sc b/gnu/usr.bin/binutils/ld/scripttempl/sa29200.sc new file mode 100644 index 00000000000..a2f267e649d --- /dev/null +++ b/gnu/usr.bin/binutils/ld/scripttempl/sa29200.sc @@ -0,0 +1,44 @@ +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +ENTRY(start) + +SECTIONS { + .text ${RELOCATING+${TEXT_START_ADDR}} : + { + *(.text); + *(.text1); + *(.text2); + ${RELOCATING+_etext = .}; + } + .lit ALIGN(4) : + { + *(.lit); + ${RELOCATING+_elit = .}; + } + .data ALIGN(4) : + { + *(.data); + *(.data1); + *(.data2); + ${RELOCATING+_edata = .}; + ${CONSTRUCTING+CONSTRUCTORS} + ${CONSTRUCTING+ ___CTOR_LIST__ = .;} + ${CONSTRUCTING+ LONG((___CTOR_END__ - ___CTOR_LIST__) / 4 - 2)} + ${CONSTRUCTING+ *(.ctors)} + ${CONSTRUCTING+ LONG(0)} + ${CONSTRUCTING+ ___CTOR_END__ = .;} + ${CONSTRUCTING+ ___DTOR_LIST__ = .;} + ${CONSTRUCTING+ LONG((___DTOR_END__ - ___DTOR_LIST__) / 4 - 2)} + ${CONSTRUCTING+ *(.dtors)} + ${CONSTRUCTING+ LONG(0)} + ${CONSTRUCTING+ ___DTOR_END__ = .;} + } + + .bss ALIGN(4) : + { + *(COMMON) + *(.bss) + ${RELOCATING+_end = .}; + } +} +EOF diff --git a/gnu/usr.bin/binutils/ld/scripttempl/sh.sc b/gnu/usr.bin/binutils/ld/scripttempl/sh.sc new file mode 100644 index 00000000000..45bd83b431e --- /dev/null +++ b/gnu/usr.bin/binutils/ld/scripttempl/sh.sc @@ -0,0 +1,57 @@ +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +OUTPUT_ARCH(${ARCH}) + +MEMORY +{ + ram : o = 0x1000, l = 512k +} + +SECTIONS +{ + .text : + { + *(.text) + *(.strings) + ${RELOCATING+ _etext = . ; } + } ${RELOCATING+ > ram} + .tors : + { + ___ctors = . ; + *(.ctors) + ___ctors_end = . ; + ___dtors = . ; + *(.dtors) + ___dtors_end = . ; + } ${RELOCATING+ > ram} + .data : + { + *(.data) + ${RELOCATING+ _edata = . ; } + } ${RELOCATING+ > ram} + .bss : + { + ${RELOCATING+ _bss_start = . ; } + *(.bss) + *(COMMON) + ${RELOCATING+ _end = . ; } + } ${RELOCATING+ > ram} + .stack ${RELOCATING+ 0x30000 } : + { + ${RELOCATING+ _stack = . ; } + *(.stack) + } ${RELOCATING+ > ram} + .stab 0 ${RELOCATING+(NOLOAD)} : + { + *(.stab) + } + .stabstr 0 ${RELOCATING+(NOLOAD)} : + { + *(.stabstr) + } +} +EOF + + + + diff --git a/gnu/usr.bin/binutils/ld/scripttempl/sparccoff.sc b/gnu/usr.bin/binutils/ld/scripttempl/sparccoff.sc new file mode 100644 index 00000000000..6bbb7ad6e90 --- /dev/null +++ b/gnu/usr.bin/binutils/ld/scripttempl/sparccoff.sc @@ -0,0 +1,48 @@ +# Linker script for Sparc COFF. +# Based on i386coff.sc by Ian Taylor <ian@cygnus.com>. +test -z "$ENTRY" && ENTRY=_start +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +${LIB_SEARCH_DIRS} + +ENTRY(${ENTRY}) + +SECTIONS +{ + .text ${RELOCATING+ SIZEOF_HEADERS} : { + *(.init) + *(.text) + ${RELOCATING+ etext = .;} + ${CONSTRUCTING+ ___CTOR_LIST__ = .;} + ${CONSTRUCTING+ LONG((___CTOR_END__ - ___CTOR_LIST__) / 4 - 2)} + ${CONSTRUCTING+ *(.ctors)} + ${CONSTRUCTING+ LONG(0)} + ${CONSTRUCTING+ ___CTOR_END__ = .;} + ${CONSTRUCTING+ ___DTOR_LIST__ = .;} + ${CONSTRUCTING+ LONG((___DTOR_END__ - ___DTOR_LIST__) / 4 - 2)} + ${CONSTRUCTING+ *(.dtors)} + ${CONSTRUCTING+ LONG(0)} + ${CONSTRUCTING+ ___DTOR_END__ = .;} + *(.fini) + ${RELOCATING+ etext = .}; + } + .data ${RELOCATING+ 0x400000 + (. & 0xffc00fff)} : { + *(.data) + ${RELOCATING+ edata = .}; + } + .bss ${RELOCATING+ SIZEOF(.data) + ADDR(.data)} : + { + *(.bss) + *(COMMON) + ${RELOCATING+ end = .}; + } + .stab 0 ${RELOCATING+(NOLOAD)} : + { + [ .stab ] + } + .stabstr 0 ${RELOCATING+(NOLOAD)} : + { + [ .stabstr ] + } +} +EOF diff --git a/gnu/usr.bin/binutils/ld/scripttempl/sparclynx.sc b/gnu/usr.bin/binutils/ld/scripttempl/sparclynx.sc new file mode 100644 index 00000000000..c2b1e1d327d --- /dev/null +++ b/gnu/usr.bin/binutils/ld/scripttempl/sparclynx.sc @@ -0,0 +1,47 @@ +# Linker script for Sparc LynxOS. +test -z "$ENTRY" && ENTRY=_start +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +${LIB_SEARCH_DIRS} + +ENTRY(${ENTRY}) + +SECTIONS +{ + .text ${RELOCATING+ SIZEOF_HEADERS} : { + *(.init) + *(.text) + ${RELOCATING+ etext = .;} + ${CONSTRUCTING+ ___CTOR_LIST__ = .;} + ${CONSTRUCTING+ LONG((___CTOR_END__ - ___CTOR_LIST__) / 4 - 2)} + ${CONSTRUCTING+ *(.ctors)} + ${CONSTRUCTING+ LONG(0)} + ${CONSTRUCTING+ ___CTOR_END__ = .;} + ${CONSTRUCTING+ ___DTOR_LIST__ = .;} + ${CONSTRUCTING+ LONG((___DTOR_END__ - ___DTOR_LIST__) / 4 - 2)} + ${CONSTRUCTING+ *(.dtors)} + ${CONSTRUCTING+ LONG(0)} + ${CONSTRUCTING+ ___DTOR_END__ = .;} + *(.fini) + ${RELOCATING+ etext = .}; + } + .data ${RELOCATING+ 0x400000 + (. & 0xffc00fff)} : { + *(.data) + ${RELOCATING+ edata = .}; + } + .bss ${RELOCATING+ SIZEOF(.data) + ADDR(.data)} : + { + *(.bss) + *(COMMON) + ${RELOCATING+ end = .}; + } + .stab 0 ${RELOCATING+(NOLOAD)} : + { + [ .stab ] + } + .stabstr 0 ${RELOCATING+(NOLOAD)} : + { + [ .stabstr ] + } +} +EOF diff --git a/gnu/usr.bin/binutils/ld/scripttempl/st2000.sc b/gnu/usr.bin/binutils/ld/scripttempl/st2000.sc new file mode 100644 index 00000000000..7ee132a8b26 --- /dev/null +++ b/gnu/usr.bin/binutils/ld/scripttempl/st2000.sc @@ -0,0 +1,26 @@ +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +OUTPUT_ARCH(${ARCH}) + + +SECTIONS +{ +.text : + { + *(.text) + *(.strings) + _etext = .; + *(.data) + _edata = .; + *(.bss) + *(COMMON) + _end = .; + +} + +} +EOF + + + + diff --git a/gnu/usr.bin/binutils/ld/scripttempl/vanilla.sc b/gnu/usr.bin/binutils/ld/scripttempl/vanilla.sc new file mode 100644 index 00000000000..1798480e69b --- /dev/null +++ b/gnu/usr.bin/binutils/ld/scripttempl/vanilla.sc @@ -0,0 +1 @@ +# Nothing to do. diff --git a/gnu/usr.bin/binutils/ld/scripttempl/w65.sc b/gnu/usr.bin/binutils/ld/scripttempl/w65.sc new file mode 100644 index 00000000000..f9044952952 --- /dev/null +++ b/gnu/usr.bin/binutils/ld/scripttempl/w65.sc @@ -0,0 +1,58 @@ +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +OUTPUT_ARCH(${ARCH}) + +MEMORY { + ram : o = 0x1000, l = 512k + } + +SECTIONS +{ +.text : + { + *(.text) + *(.strings) + ${RELOCATING+ _etext = . ; } + } ${RELOCATING+ > ram} + + +.tors : { + ___ctors = . ; + *(.ctors) + ___ctors_end = . ; + ___dtors = . ; + *(.dtors) + ___dtors_end = . ; +} ${RELOCATING+ > ram} + +.data : + { + *(.data) + ${RELOCATING+ _edata = . ; } + } ${RELOCATING+ > ram} +.bss : + { + ${RELOCATING+ _bss_start = . ; } + *(.bss) + *(COMMON) + ${RELOCATING+ _end = . ; } + } ${RELOCATING+ >ram} +.stack ${RELOCATING+ 0x30000 } : + { + ${RELOCATING+ _stack = . ; } + *(.stack) + } ${RELOCATING+ > ram} + .stab . (NOLOAD) : + { + [ .stab ] + } + .stabstr . (NOLOAD) : + { + [ .stabstr ] + } +} +EOF + + + + diff --git a/gnu/usr.bin/binutils/ld/scripttempl/z8000.sc b/gnu/usr.bin/binutils/ld/scripttempl/z8000.sc new file mode 100644 index 00000000000..2b87930100e --- /dev/null +++ b/gnu/usr.bin/binutils/ld/scripttempl/z8000.sc @@ -0,0 +1,54 @@ +cat <<EOF +OUTPUT_FORMAT("${OUTPUT_FORMAT}") +OUTPUT_ARCH("${OUTPUT_ARCH}") +ENTRY(_start) + +SECTIONS +{ +.text ${BIG+ ${RELOCATING+ 0x0000000}} : { + *(.text) + *(.strings) + *(.rdata) + } + +.ctors ${BIG+ ${RELOCATING+ 0x2000000}} : + { + ${RELOCATING+ ___ctors = . ; } + *(.ctors); + ${RELOCATING+ ___ctors_end = . ; } + ___dtors = . ; + *(.dtors); + ${RELOCATING+ ___dtors_end = . ; } + } + +.data ${BIG+ ${RELOCATING+ 0x3000000}} : { + *(.data) + } + +.bss ${BIG+ ${RELOCATING+ 0x4000000}} : + { + ${RELOCATING+ __start_bss = . ; } + *(.bss); + *(COMMON); + ${RELOCATING+ __end_bss = . ; } + } + +.heap ${BIG+ ${RELOCATING+ 0x5000000}} : { + ${RELOCATING+ __start_heap = . ; } + ${RELOCATING+ . = . + 20k ; } + ${RELOCATING+ __end_heap = . ; } + } + +.stack ${RELOCATING+ 0xf000 } : + { + ${RELOCATING+ _stack = . ; } + *(.stack) + ${RELOCATING+ __stack_top = . ; } + } + +} +EOF + + + + |