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