]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - ld/scripttempl/armcoff.sc
cefd6eba3f8b3c64743795d7f669731f0b21e815
[thirdparty/binutils-gdb.git] / ld / scripttempl / armcoff.sc
1 # Linker script for ARM COFF.
2 # Based on i386coff.sc by Ian Taylor <ian@cygnus.com>.
3 test -z "$ENTRY" && ENTRY=_start
4 if test -z "${DATA_ADDR}"; then
5 if test "$LD_FLAG" = "N" || test "$LD_FLAG" = "n"; then
6 DATA_ADDR=.
7 fi
8 fi
9
10 # These are substituted in as variables in order to get '}' in a shell
11 # conditional expansion.
12 CTOR='.ctor : {
13 *(SORT(.ctors.*))
14 *(.ctor)
15 }'
16 DTOR='.dtor : {
17 *(SORT(.dtors.*))
18 *(.dtor)
19 }'
20 if test "${RELOCATING}"; then
21 R_IDATA234='
22 SORT(*)(.idata$2)
23 SORT(*)(.idata$3)
24 /* These zeroes mark the end of the import list. */
25 LONG (0); LONG (0); LONG (0); LONG (0); LONG (0);
26 SORT(*)(.idata$4)'
27 R_IDATA5='SORT(*)(.idata$5)'
28 R_IDATA67='
29 SORT(*)(.idata$6)
30 SORT(*)(.idata$7)'
31 else
32 R_IDATA234=
33 R_IDATA5=
34 R_IDATA67=
35 fi
36 cat <<EOF
37 OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}", "${LITTLE_OUTPUT_FORMAT}")
38 ${LIB_SEARCH_DIRS}
39
40 ${RELOCATING+ENTRY (${ENTRY})}
41
42 SECTIONS
43 {
44 /* We start at 0x8000 because gdb assumes it (see FRAME_CHAIN).
45 This is an artifact of the ARM Demon monitor using the bottom 32k
46 as workspace (shared with the FP instruction emulator if
47 present): */
48 .text ${RELOCATING+ 0x8000} : {
49 *(.init)
50 *(.text*)
51 *(.glue_7t)
52 *(.glue_7)
53 *(.rdata)
54 ${CONSTRUCTING+ ___CTOR_LIST__ = .; __CTOR_LIST__ = . ;
55 LONG (-1); *(.ctors); *(.ctor); LONG (0); }
56 ${CONSTRUCTING+ ___DTOR_LIST__ = .; __DTOR_LIST__ = . ;
57 LONG (-1); *(.dtors); *(.dtor); LONG (0); }
58 *(.fini)
59 ${RELOCATING+ etext = .;}
60 ${RELOCATING+ _etext = .;}
61 }
62 .data ${RELOCATING+${DATA_ADDR-0x40000 + (ALIGN(0x8) & 0xfffc0fff)}} : {
63 ${RELOCATING+ __data_start__ = . ;}
64 *(.data*)
65
66 ${RELOCATING+*(.gcc_exc*)}
67 ${RELOCATING+___EH_FRAME_BEGIN__ = . ;}
68 ${RELOCATING+*(.eh_fram*)}
69 ${RELOCATING+___EH_FRAME_END__ = . ;}
70 ${RELOCATING+LONG(0);}
71
72 ${RELOCATING+ __data_end__ = . ;}
73 ${RELOCATING+ edata = .;}
74 ${RELOCATING+ _edata = .;}
75 }
76 ${CONSTRUCTING+${RELOCATING-$CTOR}}
77 ${CONSTRUCTING+${RELOCATING-$DTOR}}
78 .idata ${RELOCATING+BLOCK(__section_alignment__)} :
79 {
80 /* This cannot currently be handled with grouped sections.
81 See pep.em:sort_sections. */
82 ${R_IDATA234}
83 ${RELOCATING+__IAT_start__ = .;}
84 ${R_IDATA5}
85 ${RELOCATING+__IAT_end__ = .;}
86 ${R_IDATA67}
87 }
88 .bss ${RELOCATING+ ALIGN(0x8)} :
89 {
90 ${RELOCATING+ __bss_start__ = . ;}
91 *(.bss)
92 *(COMMON)
93 ${RELOCATING+ __bss_end__ = . ;}
94 }
95
96 ${RELOCATING+ end = .;}
97 ${RELOCATING+ _end = .;}
98 ${RELOCATING+ __end__ = .;}
99
100 .stab 0 ${RELOCATING+(NOLOAD)} :
101 {
102 [ .stab ]
103 }
104 .stabstr 0 ${RELOCATING+(NOLOAD)} :
105 {
106 [ .stabstr ]
107 }
108 }
109 EOF