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