]>
Commit | Line | Data |
---|---|---|
26c7ca95 ILT |
1 | # |
2 | # Unusual variables checked by this code: | |
3 | # NOP - two byte opcode for no-op (defaults to 0) | |
4 | # DATA_ADDR - if end-of-text-plus-one-page isn't right for data start | |
5 | # OTHER_READONLY_SECTIONS - other than .text .init .rodata ... | |
6 | # (e.g., .PARISC.milli) | |
7 | # OTHER_READWRITE_SECTIONS - other than .data .bss .ctors .sdata ... | |
8 | # (e.g., .PARISC.global) | |
9 | # OTHER_SECTIONS - at the end | |
10 | # EXECUTABLE_SYMBOLS - symbols that must be defined for an | |
11 | # executable (e.g., _DYNAMIC_LINK) | |
12 | # TEXT_START_SYMBOLS - symbols that appear at the start of the | |
13 | # .text section. | |
14 | # DATA_START_SYMBOLS - symbols that appear at the start of the | |
15 | # .data section. | |
16 | # OTHER_BSS_SYMBOLS - symbols that appear at the start of the | |
17 | # .bss section besides __bss_start. | |
18 | # DATA_PLT - .plt should be in data segment, not text segment. | |
19 | # EMBEDDED - whether this is for an embedded system. | |
20 | # | |
21 | # When adding sections, do note that the names of some sections are used | |
22 | # when specifying the start address of the next. | |
23 | # | |
24 | test -z "$ENTRY" && ENTRY=_start | |
25 | test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT} | |
26 | test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT} | |
27 | if [ -z "$MACHINE" ]; then OUTPUT_ARCH=${ARCH}; else OUTPUT_ARCH=${ARCH}:${MACHINE}; fi | |
28 | test "$LD_FLAG" = "N" && DATA_ADDR=. | |
29 | INTERP=".interp ${RELOCATING-0} : { *(.interp) }" | |
30 | PLT=".plt ${RELOCATING-0} : { *(.plt) }" | |
31 | ||
32 | # if this is for an embedded system, don't add SIZEOF_HEADERS. | |
33 | if [ -z "$EMBEDDED" ]; then | |
34 | test -z "${READONLY_BASE_ADDRESS}" && READONLY_BASE_ADDRESS="${READONLY_START_ADDR} + SIZEOF_HEADERS" | |
35 | else | |
36 | test -z "${READONLY_BASE_ADDRESS}" && READONLY_BASE_ADDRESS="${READONLY_START_ADDR}" | |
37 | fi | |
38 | ||
39 | cat <<EOF | |
40 | OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}", | |
41 | "${LITTLE_OUTPUT_FORMAT}") | |
42 | OUTPUT_ARCH(${OUTPUT_ARCH}) | |
43 | ENTRY(${ENTRY}) | |
44 | ||
45 | ${RELOCATING+${LIB_SEARCH_DIRS}} | |
46 | ${RELOCATING+/* Do we need any of these for elf? | |
47 | __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}} */} | |
48 | ${RELOCATING+${EXECUTABLE_SYMBOLS}} | |
49 | ${RELOCATING- /* For some reason, the Solaris linker makes bad executables | |
50 | if gld -r is used and the intermediate file has sections starting | |
51 | at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld | |
52 | bug. But for now assigning the zero vmas works. */} | |
53 | SECTIONS | |
54 | { | |
55 | /* Read-only sections, merged into text segment: */ | |
56 | ${CREATE_SHLIB-${RELOCATING+. = ${READONLY_BASE_ADDRESS};}} | |
57 | ${CREATE_SHLIB+${RELOCATING+. = SIZEOF_HEADERS;}} | |
58 | ${CREATE_SHLIB-${INTERP}} | |
59 | .hash ${RELOCATING-0} : { *(.hash) } | |
60 | .dynsym ${RELOCATING-0} : { *(.dynsym) } | |
61 | .dynstr ${RELOCATING-0} : { *(.dynstr) } | |
62 | .rel.text ${RELOCATING-0} : { *(.rel.text) } | |
63 | .rela.text ${RELOCATING-0} : { *(.rela.text) } | |
64 | .rel.data ${RELOCATING-0} : { *(.rel.data) } | |
65 | .rela.data ${RELOCATING-0} : { *(.rela.data) } | |
66 | .rel.rodata ${RELOCATING-0} : { *(.rel.rodata) } | |
67 | .rela.rodata ${RELOCATING-0} : { *(.rela.rodata) } | |
68 | .rel.got ${RELOCATING-0} : { *(.rel.got) } | |
69 | .rela.got ${RELOCATING-0} : { *(.rela.got) } | |
70 | .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) } | |
71 | .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) } | |
72 | .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) } | |
73 | .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) } | |
74 | .rel.init ${RELOCATING-0} : { *(.rel.init) } | |
75 | .rela.init ${RELOCATING-0} : { *(.rela.init) } | |
76 | .rel.fini ${RELOCATING-0} : { *(.rel.fini) } | |
77 | .rela.fini ${RELOCATING-0} : { *(.rela.fini) } | |
78 | .rel.bss ${RELOCATING-0} : { *(.rel.bss) } | |
79 | .rela.bss ${RELOCATING-0} : { *(.rela.bss) } | |
80 | .rel.plt ${RELOCATING-0} : { *(.rel.plt) } | |
81 | .rela.plt ${RELOCATING-0} : { *(.rela.plt) } | |
82 | ${DATA_PLT-${PLT}} | |
83 | .rodata ${RELOCATING-0} : { *(.rodata) *(.gnu.linkonce.r*) } | |
84 | .rodata1 ${RELOCATING-0} : { *(.rodata1) } | |
85 | ${RELOCATING+${OTHER_READONLY_SECTIONS}} | |
86 | ||
87 | /* Adjust the address for the data segment. */ | |
88 | ${RELOCATING+. = ${DATA_ADDR-ALIGN(4);}} | |
89 | ||
90 | .data ${RELOCATING-0} : | |
91 | { | |
92 | ${RELOCATING+${DATA_START_SYMBOLS}} | |
93 | *(.data) | |
94 | *(.gnu.linkonce.d*) | |
95 | ${CONSTRUCTING+CONSTRUCTORS} | |
96 | } | |
97 | .data1 ${RELOCATING-0} : { *(.data1) } | |
98 | ${RELOCATING+${OTHER_READWRITE_SECTIONS}} | |
99 | .ctors ${RELOCATING-0} : | |
100 | { | |
101 | ${CONSTRUCTING+${CTOR_START}} | |
102 | *(SORT(.ctors.*)) | |
103 | *(.ctors) | |
104 | ${CONSTRUCTING+${CTOR_END}} | |
105 | } | |
106 | .dtors ${RELOCATING-0} : | |
107 | { | |
108 | ${CONSTRUCTING+${DTOR_START}} | |
109 | *(SORT(.dtors.*)) | |
110 | *(.dtors) | |
111 | ${CONSTRUCTING+${DTOR_END}} | |
112 | } | |
113 | .got ${RELOCATING-0} : { *(.got.plt) *(.got) } | |
114 | .dynamic ${RELOCATING-0} : { *(.dynamic) } | |
115 | ${DATA_PLT+${PLT}} | |
116 | /* We want the small data sections together, so single-instruction offsets | |
117 | can access them all, and initialized data all before uninitialized, so | |
118 | we can shorten the on-disk segment size. */ | |
119 | .sdata ${RELOCATING-0} : { *(.sdata) } | |
120 | ${RELOCATING+_edata = .;} | |
121 | ${RELOCATING+PROVIDE (edata = .);} | |
122 | ${RELOCATING+__bss_start = .;} | |
123 | ${RELOCATING+${OTHER_BSS_SYMBOLS}} | |
124 | .sbss ${RELOCATING-0} : { *(.sbss) *(.scommon) } | |
125 | .bss ${RELOCATING-0} : | |
126 | { | |
127 | *(.dynbss) | |
128 | *(.bss) | |
129 | *(COMMON) | |
130 | } | |
131 | ${RELOCATING+_end = . ;} | |
132 | ${RELOCATING+PROVIDE (end = .);} | |
133 | ||
134 | /* Stabs debugging sections. */ | |
135 | .stab 0 : { *(.stab) } | |
136 | .stabstr 0 : { *(.stabstr) } | |
137 | .stab.excl 0 : { *(.stab.excl) } | |
138 | .stab.exclstr 0 : { *(.stab.exclstr) } | |
139 | .stab.index 0 : { *(.stab.index) } | |
140 | .stab.indexstr 0 : { *(.stab.indexstr) } | |
141 | ||
142 | .comment 0 : { *(.comment) } | |
143 | ||
144 | /* DWARF debug sections. | |
145 | Symbols in the DWARF debugging sections are relative to the beginning | |
146 | of the section so we begin them at 0. */ | |
147 | ||
148 | /* DWARF 1 */ | |
149 | .debug 0 : { *(.debug) } | |
150 | .line 0 : { *(.line) } | |
151 | ||
152 | /* GNU DWARF 1 extensions */ | |
153 | .debug_srcinfo 0 : { *(.debug_srcinfo) } | |
154 | .debug_sfnames 0 : { *(.debug_sfnames) } | |
155 | ||
156 | /* DWARF 1.1 and DWARF 2 */ | |
157 | .debug_aranges 0 : { *(.debug_aranges) } | |
158 | .debug_pubnames 0 : { *(.debug_pubnames) } | |
159 | ||
160 | /* DWARF 2 */ | |
161 | .debug_info 0 : { *(.debug_info) } | |
162 | .debug_abbrev 0 : { *(.debug_abbrev) } | |
163 | .debug_line 0 : { *(.debug_line) } | |
164 | .debug_frame 0 : { *(.debug_frame) } | |
165 | .debug_str 0 : { *(.debug_str) } | |
166 | .debug_loc 0 : { *(.debug_loc) } | |
167 | .debug_macinfo 0 : { *(.debug_macinfo) } | |
168 | ||
169 | /* SGI/MIPS DWARF 2 extensions */ | |
170 | .debug_weaknames 0 : { *(.debug_weaknames) } | |
171 | .debug_funcnames 0 : { *(.debug_funcnames) } | |
172 | .debug_typenames 0 : { *(.debug_typenames) } | |
173 | .debug_varnames 0 : { *(.debug_varnames) } | |
174 | ||
175 | ${RELOCATING+${OTHER_RELOCATING_SECTIONS}} | |
176 | ||
177 | /* These must appear regardless of ${RELOCATING}. */ | |
178 | ${OTHER_SECTIONS} | |
179 | ||
180 | ||
181 | /* Hmmm, there's got to be a better way. This sets the stack to the | |
182 | top of the simulator memory (i.e. top of 64K data space). */ | |
183 | .stack 0x00007FFE : { _stack = .; *(.stack) } | |
184 | ||
185 | .text ${RELOCATING+${TEXT_START_ADDR}} : | |
186 | { | |
187 | ${RELOCATING+${TEXT_START_SYMBOLS}} | |
188 | *(.init) | |
189 | *(.fini) | |
190 | *(.text) | |
191 | /* .gnu.warning sections are handled specially by elf32.em. */ | |
192 | *(.gnu.warning) | |
193 | *(.gnu.linkonce.t*) | |
194 | } =${NOP-0} | |
195 | ${RELOCATING+_etext = .;} | |
196 | ${RELOCATING+PROVIDE (etext = .);} | |
197 | } | |
198 | EOF |