Refine eabi support
[deliverable/binutils-gdb.git] / ld / scripttempl / elfppc.sc
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 .ctors .rodata ...
6 # (e.g., .PARISC.milli)
7 # OTHER_READWRITE_SECTIONS - other than .data .bss .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 #
20 # When adding sections, do note that the names of some sections are used
21 # when specifying the start address of the next.
22 #
23 test -z "$ENTRY" && ENTRY=_start
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=.
27 INTERP=".interp ${RELOCATING-0} : { *(.interp) }"
28 PLT=".plt ${RELOCATING-0} : { *(.plt) }"
29 cat <<EOF
30 OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
31 "${LITTLE_OUTPUT_FORMAT}")
32 OUTPUT_ARCH(${ARCH})
33 ENTRY(${ENTRY})
34
35 ${RELOCATING+${LIB_SEARCH_DIRS}}
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. */}
43 SECTIONS
44 {
45 /* Read-only sections, merged into text segment: */
46 ${CREATE_SHLIB-${RELOCATING+. = ${TEXT_START_ADDR} + SIZEOF_HEADERS;}}
47 ${CREATE_SHLIB+${RELOCATING+. = SIZEOF_HEADERS;}}
48 ${CREATE_SHLIB-${INTERP}}
49 .hash ${RELOCATING-0} : { *(.hash) }
50 .dynsym ${RELOCATING-0} : { *(.dynsym) }
51 .dynstr ${RELOCATING-0} : { *(.dynstr) }
52 .rela.text ${RELOCATING-0} : { *(.rela.text) }
53 .rela.data ${RELOCATING-0} : { *(.rela.data) }
54 .rela.rodata ${RELOCATING-0} : { *(.rela.rodata) }
55 .rela.got ${RELOCATING-0} : { *(.rela.got) }
56 .rela.got1 ${RELOCATING-0} : { *(.rela.got1) }
57 .rela.got2 ${RELOCATING-0} : { *(.rela.got2) }
58 .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) }
59 .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) }
60 .rela.init ${RELOCATING-0} : { *(.rela.init) }
61 .rela.fini ${RELOCATING-0} : { *(.rela.fini) }
62 .rela.bss ${RELOCATING-0} : { *(.rela.bss) }
63 .rela.plt ${RELOCATING-0} : { *(.rela.plt) }
64 .init ${RELOCATING-0} : { *(.init) } =${NOP-0}
65 ${DATA_PLT-${PLT}}
66 .text ${RELOCATING-0} :
67 {
68 ${RELOCATING+${TEXT_START_SYMBOLS}}
69 *(.text)
70 /* .gnu.warning sections are handled specially by elf32.em. */
71 *(.gnu.warning)
72 } =${NOP-0}
73 ${RELOCATING+_etext = .;}
74 ${RELOCATING+PROVIDE (etext = .);}
75 .fini ${RELOCATING-0} : { *(.fini) } =${NOP-0}
76 .rodata ${RELOCATING-0} : { *(.rodata) }
77 .rodata1 ${RELOCATING-0} : { *(.rodata1) }
78 ${RELOCATING+${OTHER_READONLY_SECTIONS}}
79
80 /* Read-write section, merged into data segment: */
81 ${RELOCATING+. = ${DATA_ADDR- ALIGN(8) + ${MAXPAGESIZE}};}
82 .data ${RELOCATING-0} :
83 {
84 ${RELOCATING+${DATA_START_SYMBOLS}}
85 *(.data)
86 ${CONSTRUCTING+CONSTRUCTORS}
87 }
88 .data1 ${RELOCATING-0} : { *(.data1) }
89 ${RELOCATING+${OTHER_READWRITE_SECTIONS}}
90
91 .sdata2 ${RELOCATING-0} : { *(.sdata2) }
92 .sbss2 ${RELOCATING-0} : { *(.sbss2) }
93 .got1 ${RELOCATING-0} : { *(.got1) }
94 .dynamic ${RELOCATING-0} : { *(.dynamic) }
95
96 /* Put .ctors and .dtors next to the .got2 section, so that the pointers
97 get relocated with -mrelocatable. Also put in the .fixup pointers.
98 The current compiler no longer needs this, but keep it around for 2.7.2 */
99
100 ${RELOCATING+PROVIDE (_GOT2_START_ = .);}
101 .got2 ${RELOCATING-0} : { *(.got2) }
102
103 ${RELOCATING+PROVIDE (__CTOR_LIST__ = .);}
104 .ctors ${RELOCATING-0} : { *(.ctors) }
105 ${RELOCATING+PROVIDE (__CTOR_END__ = .);}
106
107 ${RELOCATING+PROVIDE (__DTOR_LIST__ = .);}
108 .dtors ${RELOCATING-0} : { *(.dtors) }
109 ${RELOCATING+PROVIDE (__DTOR_END__ = .);}
110
111 ${RELOCATING+PROVIDE (_FIXUP_START_ = .);}
112 .fixup ${RELOCATING-0} : { *(.fixup) }
113 ${RELOCATING+PROVIDE (_FIXUP_END_ = .);}
114 ${RELOCATING+PROVIDE (_GOT2_END_ = .);}
115
116 ${RELOCATING+PROVIDE (_GOT_START_ = .);}
117 ${RELOCATING+PROVIDE (_GLOBAL_OFFSET_TABLE_ = .);}
118 .got ${RELOCATING-0} : { *(.got) }
119 .got.plt ${RELOCATING-0} : { *(.got.plt) }
120 ${RELOCATING+PROVIDE (_GOT_END_ = .);}
121
122 ${DATA_PLT+${PLT}}
123
124 /* We want the small data sections together, so single-instruction offsets
125 can access them all, and initialized data all before uninitialized, so
126 we can shorten the on-disk segment size. */
127 .sdata ${RELOCATING-0} : { *(.sdata) }
128 ${RELOCATING+_edata = .;}
129 ${RELOCATING+PROVIDE (edata = .);}
130 .sbss ${RELOCATING-0} :
131 {
132 ${RELOCATING+PROVIDE (__sbss_start = .);}
133 *(.sbss)
134 *(.scommon)
135 ${RELOCATING+PROVIDE (__sbss_end = .);}
136 }
137 .bss ${RELOCATING-0} :
138 {
139 ${RELOCATING+${OTHER_BSS_SYMBOLS}}
140 ${RELOCATING+PROVIDE (__bss_start = .);}
141 *(.dynbss)
142 *(.bss)
143 *(COMMON)
144 }
145 ${RELOCATING+_end = . ;}
146 ${RELOCATING+PROVIDE (end = .);}
147
148 /* These are needed for ELF backends which have not yet been
149 converted to the new style linker. */
150 .stab 0 : { *(.stab) }
151 .stabstr 0 : { *(.stabstr) }
152
153 /* These must appear regardless of ${RELOCATING}. */
154 ${OTHER_SECTIONS}
155 }
156 EOF
This page took 0.033449 seconds and 5 git commands to generate.