Commit | Line | Data |
---|---|---|
267a3ab3 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 | |
fa247c00 | 5 | # OTHER_READONLY_SECTIONS - other than .text .init .rodata ... |
267a3ab3 | 6 | # (e.g., .PARISC.milli) |
fa247c00 | 7 | # OTHER_READWRITE_SECTIONS - other than .data .bss .ctors .sdata ... |
267a3ab3 | 8 | # (e.g., .PARISC.global) |
31ddb156 | 9 | # OTHER_SECTIONS - at the end |
267a3ab3 ILT |
10 | # EXECUTABLE_SYMBOLS - symbols that must be defined for an |
11 | # executable (e.g., _DYNAMIC_LINK) | |
2a9fa50c ILT |
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. | |
bff600cf ILT |
16 | # OTHER_BSS_SYMBOLS - symbols that appear at the start of the |
17 | # .bss section besides __bss_start. | |
2a9fa50c | 18 | # DATA_PLT - .plt should be in data segment, not text segment. |
267a3ab3 ILT |
19 | # |
20 | # When adding sections, do note that the names of some sections are used | |
21 | # when specifying the start address of the next. | |
22 | # | |
fa247c00 | 23 | test -z "$ENTRY" && ENTRY=_start |
cd1d4f83 ILT |
24 | test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT} |
25 | test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT} | |
18f0961e | 26 | if [ -z "$MACHINE" ]; then OUTPUT_ARCH=${ARCH}; else OUTPUT_ARCH=${ARCH}:${MACHINE}; fi |
cd1d4f83 | 27 | test "$LD_FLAG" = "N" && DATA_ADDR=. |
31ddb156 | 28 | INTERP=".interp ${RELOCATING-0} : { *(.interp) }" |
2a9fa50c | 29 | PLT=".plt ${RELOCATING-0} : { *(.plt) }" |
f90bb826 | 30 | cat <<EOF |
cd1d4f83 ILT |
31 | OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}", |
32 | "${LITTLE_OUTPUT_FORMAT}") | |
18f0961e | 33 | OUTPUT_ARCH(${OUTPUT_ARCH}) |
fa247c00 | 34 | ENTRY(${ENTRY}) |
f90bb826 KR |
35 | |
36 | ${RELOCATING+${LIB_SEARCH_DIRS}} | |
267a3ab3 ILT |
37 | ${RELOCATING+/* Do we need any of these for elf? |
38 | __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}} */} | |
39 | ${RELOCATING+${EXECUTABLE_SYMBOLS}} | |
40 | ${RELOCATING- /* For some reason, the Solaris linker makes bad executables | |
41 | if gld -r is used and the intermediate file has sections starting | |
42 | at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld | |
43 | bug. But for now assigning the zero vmas works. */} | |
f90bb826 KR |
44 | SECTIONS |
45 | { | |
267a3ab3 | 46 | /* Read-only sections, merged into text segment: */ |
31ddb156 ILT |
47 | ${CREATE_SHLIB-${RELOCATING+. = ${TEXT_START_ADDR} + SIZEOF_HEADERS;}} |
48 | ${CREATE_SHLIB+${RELOCATING+. = SIZEOF_HEADERS;}} | |
49 | ${CREATE_SHLIB-${INTERP}} | |
cd1d4f83 ILT |
50 | .hash ${RELOCATING-0} : { *(.hash) } |
51 | .dynsym ${RELOCATING-0} : { *(.dynsym) } | |
52 | .dynstr ${RELOCATING-0} : { *(.dynstr) } | |
53 | .rel.text ${RELOCATING-0} : { *(.rel.text) } | |
54 | .rela.text ${RELOCATING-0} : { *(.rela.text) } | |
55 | .rel.data ${RELOCATING-0} : { *(.rel.data) } | |
56 | .rela.data ${RELOCATING-0} : { *(.rela.data) } | |
57 | .rel.rodata ${RELOCATING-0} : { *(.rel.rodata) } | |
58 | .rela.rodata ${RELOCATING-0} : { *(.rela.rodata) } | |
59 | .rel.got ${RELOCATING-0} : { *(.rel.got) } | |
60 | .rela.got ${RELOCATING-0} : { *(.rela.got) } | |
61 | .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) } | |
62 | .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) } | |
63 | .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) } | |
64 | .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) } | |
65 | .rel.init ${RELOCATING-0} : { *(.rel.init) } | |
66 | .rela.init ${RELOCATING-0} : { *(.rela.init) } | |
67 | .rel.fini ${RELOCATING-0} : { *(.rel.fini) } | |
68 | .rela.fini ${RELOCATING-0} : { *(.rela.fini) } | |
69 | .rel.bss ${RELOCATING-0} : { *(.rel.bss) } | |
70 | .rela.bss ${RELOCATING-0} : { *(.rela.bss) } | |
71 | .rel.plt ${RELOCATING-0} : { *(.rel.plt) } | |
72 | .rela.plt ${RELOCATING-0} : { *(.rela.plt) } | |
73 | .init ${RELOCATING-0} : { *(.init) } =${NOP-0} | |
2a9fa50c ILT |
74 | ${DATA_PLT-${PLT}} |
75 | .text ${RELOCATING-0} : | |
f90bb826 | 76 | { |
2a9fa50c | 77 | ${RELOCATING+${TEXT_START_SYMBOLS}} |
f90bb826 | 78 | *(.text) |
fa247c00 ILT |
79 | /* .gnu.warning sections are handled specially by elf32.em. */ |
80 | *(.gnu.warning) | |
18f0961e | 81 | *(.gnu.linkonce*) |
fa247c00 | 82 | } =${NOP-0} |
2a9fa50c | 83 | ${RELOCATING+_etext = .;} |
31ddb156 | 84 | ${RELOCATING+PROVIDE (etext = .);} |
2a9fa50c | 85 | .fini ${RELOCATING-0} : { *(.fini) } =${NOP-0} |
2a9fa50c ILT |
86 | .rodata ${RELOCATING-0} : { *(.rodata) } |
87 | .rodata1 ${RELOCATING-0} : { *(.rodata1) } | |
267a3ab3 | 88 | ${RELOCATING+${OTHER_READONLY_SECTIONS}} |
267a3ab3 | 89 | |
18f0961e ILT |
90 | /* Adjust the address for the data segment. We want to adjust up to |
91 | the same address within the page on the next page up. */ | |
92 | ${RELOCATING+. = ${DATA_ADDR-ALIGN(${MAXPAGESIZE}) + (ALIGN(8) & (${MAXPAGESIZE} - 1))};} | |
93 | ||
2a9fa50c | 94 | .data ${RELOCATING-0} : |
f90bb826 | 95 | { |
2a9fa50c | 96 | ${RELOCATING+${DATA_START_SYMBOLS}} |
f90bb826 KR |
97 | *(.data) |
98 | ${CONSTRUCTING+CONSTRUCTORS} | |
f90bb826 | 99 | } |
2a9fa50c | 100 | .data1 ${RELOCATING-0} : { *(.data1) } |
267a3ab3 | 101 | ${RELOCATING+${OTHER_READWRITE_SECTIONS}} |
fa247c00 ILT |
102 | .ctors ${RELOCATING-0} : { *(.ctors) } |
103 | .dtors ${RELOCATING-0} : { *(.dtors) } | |
cd1d4f83 | 104 | .got ${RELOCATING-0} : { *(.got.plt) *(.got) } |
2a9fa50c ILT |
105 | .dynamic ${RELOCATING-0} : { *(.dynamic) } |
106 | ${DATA_PLT+${PLT}} | |
267a3ab3 ILT |
107 | /* We want the small data sections together, so single-instruction offsets |
108 | can access them all, and initialized data all before uninitialized, so | |
109 | we can shorten the on-disk segment size. */ | |
2a9fa50c | 110 | .sdata ${RELOCATING-0} : { *(.sdata) } |
bff600cf | 111 | ${RELOCATING+_edata = .;} |
31ddb156 | 112 | ${RELOCATING+PROVIDE (edata = .);} |
2a9fa50c | 113 | ${RELOCATING+__bss_start = .;} |
bff600cf | 114 | ${RELOCATING+${OTHER_BSS_SYMBOLS}} |
2a9fa50c ILT |
115 | .sbss ${RELOCATING-0} : { *(.sbss) *(.scommon) } |
116 | .bss ${RELOCATING-0} : | |
f90bb826 | 117 | { |
2a9fa50c | 118 | *(.dynbss) |
f90bb826 KR |
119 | *(.bss) |
120 | *(COMMON) | |
f90bb826 | 121 | } |
2a9fa50c | 122 | ${RELOCATING+_end = . ;} |
31ddb156 ILT |
123 | ${RELOCATING+PROVIDE (end = .);} |
124 | ||
18f0961e | 125 | /* Stabs debugging sections. */ |
31ddb156 ILT |
126 | .stab 0 : { *(.stab) } |
127 | .stabstr 0 : { *(.stabstr) } | |
18f0961e ILT |
128 | .stab.excl 0 : { *(.stab.excl) } |
129 | .stab.exclstr 0 : { *(.stab.exclstr) } | |
130 | .stab.index 0 : { *(.stab.index) } | |
131 | .stab.indexstr 0 : { *(.stab.indexstr) } | |
132 | ||
133 | .comment 0 : { *(.comment) } | |
134 | ||
135 | /* DWARF debug sections. | |
136 | Symbols in the .debug DWARF section are relative to the beginning of the | |
137 | section so we begin .debug at 0. It's not clear yet what needs to happen | |
138 | for the others. */ | |
139 | .debug 0 : { *(.debug) } | |
140 | .debug_srcinfo 0 : { *(.debug_srcinfo) } | |
141 | .debug_aranges 0 : { *(.debug_aranges) } | |
142 | .debug_pubnames 0 : { *(.debug_pubnames) } | |
143 | .debug_sfnames 0 : { *(.debug_sfnames) } | |
144 | .line 0 : { *(.line) } | |
31ddb156 ILT |
145 | |
146 | /* These must appear regardless of ${RELOCATING}. */ | |
147 | ${OTHER_SECTIONS} | |
f90bb826 KR |
148 | } |
149 | EOF |