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} | |
26 | test "$LD_FLAG" = "N" && DATA_ADDR=. | |
31ddb156 | 27 | INTERP=".interp ${RELOCATING-0} : { *(.interp) }" |
2a9fa50c | 28 | PLT=".plt ${RELOCATING-0} : { *(.plt) }" |
f90bb826 | 29 | cat <<EOF |
cd1d4f83 ILT |
30 | OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}", |
31 | "${LITTLE_OUTPUT_FORMAT}") | |
f90bb826 | 32 | OUTPUT_ARCH(${ARCH}) |
fa247c00 | 33 | ENTRY(${ENTRY}) |
f90bb826 KR |
34 | |
35 | ${RELOCATING+${LIB_SEARCH_DIRS}} | |
267a3ab3 ILT |
36 | ${RELOCATING+/* Do we need any of these for elf? |
37 | __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}} */} | |
38 | ${RELOCATING+${EXECUTABLE_SYMBOLS}} | |
39 | ${RELOCATING- /* For some reason, the Solaris linker makes bad executables | |
40 | if gld -r is used and the intermediate file has sections starting | |
41 | at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld | |
42 | bug. But for now assigning the zero vmas works. */} | |
f90bb826 KR |
43 | SECTIONS |
44 | { | |
267a3ab3 | 45 | /* Read-only sections, merged into text segment: */ |
31ddb156 ILT |
46 | ${CREATE_SHLIB-${RELOCATING+. = ${TEXT_START_ADDR} + SIZEOF_HEADERS;}} |
47 | ${CREATE_SHLIB+${RELOCATING+. = SIZEOF_HEADERS;}} | |
48 | ${CREATE_SHLIB-${INTERP}} | |
cd1d4f83 ILT |
49 | .hash ${RELOCATING-0} : { *(.hash) } |
50 | .dynsym ${RELOCATING-0} : { *(.dynsym) } | |
51 | .dynstr ${RELOCATING-0} : { *(.dynstr) } | |
52 | .rel.text ${RELOCATING-0} : { *(.rel.text) } | |
53 | .rela.text ${RELOCATING-0} : { *(.rela.text) } | |
54 | .rel.data ${RELOCATING-0} : { *(.rel.data) } | |
55 | .rela.data ${RELOCATING-0} : { *(.rela.data) } | |
56 | .rel.rodata ${RELOCATING-0} : { *(.rel.rodata) } | |
57 | .rela.rodata ${RELOCATING-0} : { *(.rela.rodata) } | |
58 | .rel.got ${RELOCATING-0} : { *(.rel.got) } | |
59 | .rela.got ${RELOCATING-0} : { *(.rela.got) } | |
60 | .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) } | |
61 | .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) } | |
62 | .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) } | |
63 | .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) } | |
64 | .rel.init ${RELOCATING-0} : { *(.rel.init) } | |
65 | .rela.init ${RELOCATING-0} : { *(.rela.init) } | |
66 | .rel.fini ${RELOCATING-0} : { *(.rel.fini) } | |
67 | .rela.fini ${RELOCATING-0} : { *(.rela.fini) } | |
68 | .rel.bss ${RELOCATING-0} : { *(.rel.bss) } | |
69 | .rela.bss ${RELOCATING-0} : { *(.rela.bss) } | |
70 | .rel.plt ${RELOCATING-0} : { *(.rel.plt) } | |
71 | .rela.plt ${RELOCATING-0} : { *(.rela.plt) } | |
72 | .init ${RELOCATING-0} : { *(.init) } =${NOP-0} | |
2a9fa50c ILT |
73 | ${DATA_PLT-${PLT}} |
74 | .text ${RELOCATING-0} : | |
f90bb826 | 75 | { |
2a9fa50c | 76 | ${RELOCATING+${TEXT_START_SYMBOLS}} |
f90bb826 | 77 | *(.text) |
fa247c00 ILT |
78 | /* .gnu.warning sections are handled specially by elf32.em. */ |
79 | *(.gnu.warning) | |
80 | } =${NOP-0} | |
2a9fa50c | 81 | ${RELOCATING+_etext = .;} |
31ddb156 | 82 | ${RELOCATING+PROVIDE (etext = .);} |
2a9fa50c | 83 | .fini ${RELOCATING-0} : { *(.fini) } =${NOP-0} |
2a9fa50c ILT |
84 | .rodata ${RELOCATING-0} : { *(.rodata) } |
85 | .rodata1 ${RELOCATING-0} : { *(.rodata1) } | |
267a3ab3 | 86 | ${RELOCATING+${OTHER_READONLY_SECTIONS}} |
267a3ab3 ILT |
87 | |
88 | /* Read-write section, merged into data segment: */ | |
2a9fa50c ILT |
89 | ${RELOCATING+. = ${DATA_ADDR- ALIGN(8) + ${MAXPAGESIZE}};} |
90 | .data ${RELOCATING-0} : | |
f90bb826 | 91 | { |
2a9fa50c | 92 | ${RELOCATING+${DATA_START_SYMBOLS}} |
f90bb826 KR |
93 | *(.data) |
94 | ${CONSTRUCTING+CONSTRUCTORS} | |
f90bb826 | 95 | } |
2a9fa50c | 96 | .data1 ${RELOCATING-0} : { *(.data1) } |
267a3ab3 | 97 | ${RELOCATING+${OTHER_READWRITE_SECTIONS}} |
fa247c00 ILT |
98 | .ctors ${RELOCATING-0} : { *(.ctors) } |
99 | .dtors ${RELOCATING-0} : { *(.dtors) } | |
cd1d4f83 | 100 | .got ${RELOCATING-0} : { *(.got.plt) *(.got) } |
2a9fa50c ILT |
101 | .dynamic ${RELOCATING-0} : { *(.dynamic) } |
102 | ${DATA_PLT+${PLT}} | |
267a3ab3 ILT |
103 | /* We want the small data sections together, so single-instruction offsets |
104 | can access them all, and initialized data all before uninitialized, so | |
105 | we can shorten the on-disk segment size. */ | |
2a9fa50c | 106 | .sdata ${RELOCATING-0} : { *(.sdata) } |
bff600cf | 107 | ${RELOCATING+_edata = .;} |
31ddb156 | 108 | ${RELOCATING+PROVIDE (edata = .);} |
2a9fa50c | 109 | ${RELOCATING+__bss_start = .;} |
bff600cf | 110 | ${RELOCATING+${OTHER_BSS_SYMBOLS}} |
2a9fa50c ILT |
111 | .sbss ${RELOCATING-0} : { *(.sbss) *(.scommon) } |
112 | .bss ${RELOCATING-0} : | |
f90bb826 | 113 | { |
2a9fa50c | 114 | *(.dynbss) |
f90bb826 KR |
115 | *(.bss) |
116 | *(COMMON) | |
f90bb826 | 117 | } |
2a9fa50c | 118 | ${RELOCATING+_end = . ;} |
31ddb156 ILT |
119 | ${RELOCATING+PROVIDE (end = .);} |
120 | ||
121 | /* These are needed for ELF backends which have not yet been | |
122 | converted to the new style linker. */ | |
123 | .stab 0 : { *(.stab) } | |
124 | .stabstr 0 : { *(.stabstr) } | |
125 | ||
126 | /* These must appear regardless of ${RELOCATING}. */ | |
127 | ${OTHER_SECTIONS} | |
f90bb826 KR |
128 | } |
129 | EOF |