Commit | Line | Data |
---|---|---|
252b5132 RH |
1 | test -z "$ENTRY" && ENTRY=_start |
2 | test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT} | |
3 | test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT} | |
4 | if [ -z "$MACHINE" ]; then OUTPUT_ARCH=${ARCH}; else OUTPUT_ARCH=${ARCH}:${MACHINE}; fi | |
5 | test "$LD_FLAG" = "N" && DATA_ADDR=. | |
6 | INTERP=".interp ${RELOCATING-0} : { *(.interp) }" | |
7 | PLT=".plt ${RELOCATING-0} : { *(.plt) }" | |
8 | ||
9 | ||
10 | CTOR=".ctors ${CONSTRUCTING-0} : | |
11 | { | |
12 | ${CONSTRUCTING+${CTOR_START}} | |
13 | /* gcc uses crtbegin.o to find the start of | |
14 | the constructors, so we make sure it is | |
15 | first. Because this is a wildcard, it | |
16 | doesn't matter if the user does not | |
17 | actually link against crtbegin.o; the | |
18 | linker won't look for a file to match a | |
19 | wildcard. The wildcard also means that it | |
20 | doesn't matter which directory crtbegin.o | |
21 | is in. */ | |
22 | ||
23 | KEEP (*crtbegin.o(.ctors)) | |
24 | ||
25 | /* We don't want to include the .ctor section from | |
26 | from the crtend.o file until after the sorted ctors. | |
27 | The .ctor section from the crtend file contains the | |
28 | end of ctors marker and it must be last */ | |
29 | ||
30 | KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) | |
31 | KEEP (*(SORT(.ctors.*))) | |
32 | KEEP (*(.ctors)) | |
33 | ${CONSTRUCTING+${CTOR_END}} | |
34 | }" | |
35 | ||
36 | DTOR=" .dtors ${CONSTRUCTING-0} : | |
37 | { | |
38 | ${CONSTRUCTING+${DTOR_START}} | |
39 | KEEP (*crtbegin.o(.dtors)) | |
40 | KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) | |
41 | KEEP (*(SORT(.dtors.*))) | |
42 | KEEP (*(.dtors)) | |
43 | ${CONSTRUCTING+${DTOR_END}} | |
44 | }" | |
45 | ||
eaba1dd3 | 46 | STACK=" .stack : { _stack = .; *(.stack) } >STACK " |
252b5132 RH |
47 | |
48 | # if this is for an embedded system, don't add SIZEOF_HEADERS. | |
49 | if [ -z "$EMBEDDED" ]; then | |
50 | test -z "${READONLY_BASE_ADDRESS}" && READONLY_BASE_ADDRESS="${READONLY_START_ADDR} + SIZEOF_HEADERS" | |
51 | else | |
52 | test -z "${READONLY_BASE_ADDRESS}" && READONLY_BASE_ADDRESS="${READONLY_START_ADDR}" | |
53 | fi | |
54 | ||
55 | cat <<EOF | |
56 | OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}", | |
57 | "${LITTLE_OUTPUT_FORMAT}") | |
58 | OUTPUT_ARCH(${OUTPUT_ARCH}) | |
59 | ENTRY(${ENTRY}) | |
60 | ||
61 | ${RELOCATING+${LIB_SEARCH_DIRS}} | |
62 | ${RELOCATING+/* Do we need any of these for elf? | |
63 | __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}} */} | |
64 | ${RELOCATING+${EXECUTABLE_SYMBOLS}} | |
eaba1dd3 RH |
65 | |
66 | MEMORY | |
67 | { | |
68 | UNIFIED : org = 0, len = 0x1000000 | |
69 | INSN : org = 0x1000000, len = 0x40000 | |
70 | DATA : org = 0x2000004, len = 0x7FFC | |
71 | STACK : org = 0x2007FFE, len = 4 | |
72 | } | |
73 | ||
252b5132 RH |
74 | SECTIONS |
75 | { | |
eaba1dd3 RH |
76 | .text : |
77 | { | |
78 | ${RELOCATING+${TEXT_START_SYMBOLS}} | |
79 | KEEP (*(.init)) | |
788fca5a | 80 | KEEP (*(.init.*)) |
eaba1dd3 | 81 | KEEP (*(.fini)) |
788fca5a | 82 | KEEP (*(.fini.*)) |
eaba1dd3 RH |
83 | *(.text) |
84 | *(.text.*) | |
85 | /* .gnu.warning sections are handled specially by elf32.em. */ | |
86 | *(.gnu.warning) | |
87 | *(.gnu.linkonce.t*) | |
88 | ${RELOCATING+_etext = .;} | |
89 | ${RELOCATING+PROVIDE (etext = .);} | |
90 | } ${RELOCATING+ >INSN} =${NOP-0} | |
91 | ||
92 | .rodata ${RELOCATING-0} : { | |
788fca5a MM |
93 | *(.rodata) |
94 | *(.gnu.linkonce.r*) | |
95 | *(.rodata.*) | |
eaba1dd3 | 96 | } ${RELOCATING+ >DATA} |
788fca5a MM |
97 | |
98 | .rodata1 ${RELOCATING-0} : { | |
99 | *(.rodata1) | |
100 | *(.rodata1.*) | |
101 | } ${RELOCATING+ >DATA} | |
252b5132 RH |
102 | |
103 | .data ${RELOCATING-0} : | |
104 | { | |
105 | ${RELOCATING+${DATA_START_SYMBOLS}} | |
106 | *(.data) | |
107 | *(.data.*) | |
108 | *(.gnu.linkonce.d*) | |
109 | ${CONSTRUCTING+CONSTRUCTORS} | |
eaba1dd3 | 110 | } ${RELOCATING+ >DATA} |
f9faad58 MM |
111 | |
112 | .data1 ${RELOCATING-0} : { | |
113 | *(.data1) | |
114 | *(.data1.*) | |
115 | } ${RELOCATING+ >DATA} | |
116 | ||
eaba1dd3 RH |
117 | ${RELOCATING+${CTOR} >DATA} |
118 | ${RELOCATING+${DTOR} >DATA} | |
119 | ||
252b5132 RH |
120 | /* We want the small data sections together, so single-instruction offsets |
121 | can access them all, and initialized data all before uninitialized, so | |
122 | we can shorten the on-disk segment size. */ | |
788fca5a MM |
123 | .sdata ${RELOCATING-0} : { |
124 | *(.sdata) | |
125 | *(.sdata.*) | |
126 | } ${RELOCATING+ >DATA} | |
127 | ||
eaba1dd3 | 128 | ${RELOCATING+_edata = .;} |
252b5132 RH |
129 | ${RELOCATING+PROVIDE (edata = .);} |
130 | ${RELOCATING+__bss_start = .;} | |
eaba1dd3 | 131 | .sbss ${RELOCATING-0} : { *(.sbss) *(.scommon) } ${RELOCATING+ >DATA} |
252b5132 RH |
132 | .bss ${RELOCATING-0} : |
133 | { | |
134 | *(.dynbss) | |
788fca5a | 135 | *(.dynbss.*) |
252b5132 | 136 | *(.bss) |
788fca5a | 137 | *(.bss.*) |
252b5132 | 138 | *(COMMON) |
eaba1dd3 | 139 | } ${RELOCATING+ >DATA} |
788fca5a | 140 | |
252b5132 RH |
141 | ${RELOCATING+_end = . ;} |
142 | ${RELOCATING+PROVIDE (end = .);} | |
143 | ||
eaba1dd3 RH |
144 | ${RELOCATING+$STACK} |
145 | ||
252b5132 RH |
146 | /* Stabs debugging sections. */ |
147 | .stab 0 : { *(.stab) } | |
148 | .stabstr 0 : { *(.stabstr) } | |
149 | .stab.excl 0 : { *(.stab.excl) } | |
150 | .stab.exclstr 0 : { *(.stab.exclstr) } | |
151 | .stab.index 0 : { *(.stab.index) } | |
152 | .stab.indexstr 0 : { *(.stab.indexstr) } | |
153 | ||
154 | .comment 0 : { *(.comment) } | |
155 | ||
156 | /* DWARF debug sections. | |
157 | Symbols in the DWARF debugging sections are relative to the beginning | |
158 | of the section so we begin them at 0. */ | |
159 | ||
160 | /* DWARF 1 */ | |
161 | .debug 0 : { *(.debug) } | |
162 | .line 0 : { *(.line) } | |
163 | ||
164 | /* GNU DWARF 1 extensions */ | |
165 | .debug_srcinfo 0 : { *(.debug_srcinfo) } | |
166 | .debug_sfnames 0 : { *(.debug_sfnames) } | |
167 | ||
168 | /* DWARF 1.1 and DWARF 2 */ | |
169 | .debug_aranges 0 : { *(.debug_aranges) } | |
170 | .debug_pubnames 0 : { *(.debug_pubnames) } | |
171 | ||
172 | /* DWARF 2 */ | |
3a9d486c | 173 | .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) } |
252b5132 RH |
174 | .debug_abbrev 0 : { *(.debug_abbrev) } |
175 | .debug_line 0 : { *(.debug_line) } | |
176 | .debug_frame 0 : { *(.debug_frame) } | |
177 | .debug_str 0 : { *(.debug_str) } | |
178 | .debug_loc 0 : { *(.debug_loc) } | |
179 | .debug_macinfo 0 : { *(.debug_macinfo) } | |
180 | ||
181 | /* SGI/MIPS DWARF 2 extensions */ | |
182 | .debug_weaknames 0 : { *(.debug_weaknames) } | |
183 | .debug_funcnames 0 : { *(.debug_funcnames) } | |
184 | .debug_typenames 0 : { *(.debug_typenames) } | |
185 | .debug_varnames 0 : { *(.debug_varnames) } | |
252b5132 RH |
186 | } |
187 | EOF |