1 # Linker script for 386 COFF. This works on SVR3.2 and SCO Unix 3.2.2. 2 # Ian Taylor <ian (a] cygnus.com>. 3 # 4 # Copyright (C) 2014 Free Software Foundation, Inc. 5 # 6 # Copying and distribution of this file, with or without modification, 7 # are permitted in any medium without royalty provided the copyright 8 # notice and this notice are preserved. 9 10 test -z "$ENTRY" && ENTRY=_start 11 # These are substituted in as variables in order to get '}' in a shell 12 # conditional expansion. 13 INIT='.init : { *(.init) }' 14 FINI='.fini : { *(.fini) }' 15 16 cat <<EOF 17 /* Copyright (C) 2014 Free Software Foundation, Inc. 18 19 Copying and distribution of this script, with or without modification, 20 are permitted in any medium without royalty provided the copyright 21 notice and this notice are preserved. */ 22 23 OUTPUT_FORMAT("${OUTPUT_FORMAT}") 24 ${LIB_SEARCH_DIRS} 25 26 ${RELOCATING+ENTRY (${ENTRY})} 27 28 SECTIONS 29 { 30 .text ${RELOCATING+ SIZEOF_HEADERS} : { 31 ${RELOCATING+ *(.init)} 32 *(.text) 33 ${RELOCATING+ *(.fini)} 34 ${RELOCATING+ etext = .}; 35 } 36 .data ${RELOCATING+ 0x400000 + (. & 0xffc00fff)} : { 37 *(.data) 38 ${RELOCATING+ edata = .}; 39 } 40 .bss ${RELOCATING+ SIZEOF(.data) + ADDR(.data)} : 41 { 42 *(.bss) 43 *(COMMON) 44 ${RELOCATING+ end = .}; 45 } 46 ${RELOCATING- ${INIT}} 47 ${RELOCATING- ${FINI}} 48 .stab 0 ${RELOCATING+(NOLOAD)} : 49 { 50 [ .stab ] 51 } 52 .stabstr 0 ${RELOCATING+(NOLOAD)} : 53 { 54 [ .stabstr ] 55 } 56 } 57 EOF 58