1# Linker script for ARM COFF. 2# Based on i386coff.sc by Ian Taylor <ian@cygnus.com>. 3# 4# Copyright (C) 2014-2016 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 10test -z "$ENTRY" && ENTRY=_start 11if test -z "${DATA_ADDR}"; then 12 if test "$LD_FLAG" = "N" || test "$LD_FLAG" = "n"; then 13 DATA_ADDR=. 14 fi 15fi 16 17# These are substituted in as variables in order to get '}' in a shell 18# conditional expansion. 19CTOR='.ctor : { 20 *(SORT(.ctors.*)) 21 *(.ctor) 22 }' 23DTOR='.dtor : { 24 *(SORT(.dtors.*)) 25 *(.dtor) 26 }' 27 28cat <<EOF 29/* Copyright (C) 2014-2016 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}", "${BIG_OUTPUT_FORMAT}", "${LITTLE_OUTPUT_FORMAT}") 36${LIB_SEARCH_DIRS} 37 38${RELOCATING+ENTRY (${ENTRY})} 39 40SECTIONS 41{ 42 /* We start at 0x8000 because gdb assumes it (see FRAME_CHAIN). 43 This is an artifact of the ARM Demon monitor using the bottom 32k 44 as workspace (shared with the FP instruction emulator if 45 present): */ 46 .text ${RELOCATING+ 0x8000} : { 47 *(.init) 48 *(.text*) 49 *(.glue_7t) 50 *(.glue_7) 51 *(.rdata) 52 ${CONSTRUCTING+ ___CTOR_LIST__ = .; __CTOR_LIST__ = . ; 53 LONG (-1); *(.ctors); *(.ctor); LONG (0); } 54 ${CONSTRUCTING+ ___DTOR_LIST__ = .; __DTOR_LIST__ = . ; 55 LONG (-1); *(.dtors); *(.dtor); LONG (0); } 56 *(.fini) 57 ${RELOCATING+ etext = .;} 58 ${RELOCATING+ _etext = .;} 59 } 60 .data ${RELOCATING+${DATA_ADDR-0x40000 + (ALIGN(0x8) & 0xfffc0fff)}} : { 61 ${RELOCATING+ __data_start__ = . ;} 62 *(.data*) 63 64 ${RELOCATING+*(.gcc_exc*)} 65 ${RELOCATING+___EH_FRAME_BEGIN__ = . ;} 66 ${RELOCATING+*(.eh_fram*)} 67 ${RELOCATING+___EH_FRAME_END__ = . ;} 68 ${RELOCATING+LONG(0);} 69 70 ${RELOCATING+ __data_end__ = . ;} 71 ${RELOCATING+ edata = .;} 72 ${RELOCATING+ _edata = .;} 73 } 74 ${CONSTRUCTING+${RELOCATING-$CTOR}} 75 ${CONSTRUCTING+${RELOCATING-$DTOR}} 76 .bss ${RELOCATING+ ALIGN(0x8)} : 77 { 78 ${RELOCATING+ __bss_start__ = . ;} 79 *(.bss) 80 *(COMMON) 81 ${RELOCATING+ __bss_end__ = . ;} 82 } 83 84 ${RELOCATING+ end = .;} 85 ${RELOCATING+ _end = .;} 86 ${RELOCATING+ __end__ = .;} 87 88 .stab 0 ${RELOCATING+(NOLOAD)} : 89 { 90 [ .stab ] 91 } 92 .stabstr 0 ${RELOCATING+(NOLOAD)} : 93 { 94 [ .stabstr ] 95 } 96} 97EOF 98