1# Linker script for TI TMS320C80 (tic80) COFF. 2# 3# Copyright (C) 2014 Free Software Foundation, Inc. 4# 5# Copying and distribution of this file, with or without modification, 6# are permitted in any medium without royalty provided the copyright 7# notice and this notice are preserved. 8# 9# Besides the shell variables set by the emulparams script, and the LD_FLAG 10# variable, the genscripts.sh script will set the following variables for each 11# time this script is run to generate one of the linker scripts for ldscripts: 12# 13# RELOCATING: Set to a non-empty string when the linker is going to be doing 14# a final relocation. 15# 16# CONSTRUCTING: Set to a non-empty string when the linker is going to be 17# building global constructor and destructor tables. 18# 19# DATA_ALIGNMENT: Set to an ALIGN expression when the output should be page 20# aligned, or to "." when generating the -N script. 21# 22# CREATE_SHLIB: Set to a non-empty string when generating a script for 23# the -shared linker arg. 24 25test -z "$TEXT_START_ADDR" && TEXT_START_ADDR="0x80000 + SIZEOF_HEADERS" 26test -z "$ENTRY" && ENTRY=__start 27 28cat <<EOF 29/* Copyright (C) 2014 Free Software Foundation, Inc. 30 31 Copying and distribution of this script, with or without modification, 32 are permitted in any medium without royalty provided the copyright 33 notice and this notice are preserved. */ 34 35OUTPUT_FORMAT("${OUTPUT_FORMAT}") 36${LIB_SEARCH_DIRS} 37 38${RELOCATING+ENTRY (${ENTRY})} 39 40SECTIONS 41{ 42 .text ${RELOCATING+ $TEXT_START_ADDR} : { 43 *(.init) 44 *(.fini) 45 *(.text) 46 } 47 .const ALIGN(4) : { 48 *(.const) 49 } 50 .ctors ALIGN(4) : { 51 ${CONSTRUCTING+ . = ALIGN(4);} 52 ${CONSTRUCTING+ ___CTOR_LIST__ = .;} 53 ${CONSTRUCTING+ LONG(-1)} 54 *(.ctors) 55 ${CONSTRUCTING+ ___CTOR_END__ = .;} 56 ${CONSTRUCTING+ LONG(0)} 57 } 58 .dtors ALIGN(4) : { 59 ${CONSTRUCTING+ ___DTOR_LIST__ = .;} 60 ${CONSTRUCTING+ LONG(-1)} 61 ${CONSTRUCTING+ *(.dtors)} 62 ${CONSTRUCTING+ ___DTOR_END__ = .;} 63 ${CONSTRUCTING+ LONG(0)} 64 } 65 ${RELOCATING+ etext = .;} 66 .data : { 67 *(.data) 68 ${RELOCATING+ __edata = .}; 69 } 70 .bss : { 71 ${RELOCATING+ __bss_start = .}; 72 *(.bss) 73 *(COMMON) 74 ${RELOCATING+ _end = ALIGN(0x8)}; 75 ${RELOCATING+ __end = ALIGN(0x8)}; 76 } 77 .stab 0 ${RELOCATING+(NOLOAD)} : 78 { 79 [ .stab ] 80 } 81 .stabstr 0 ${RELOCATING+(NOLOAD)} : 82 { 83 [ .stabstr ] 84 } 85} 86EOF 87