xref: /illumos-kvm-cmd/ppc64.ld (revision 68396ea9)
1/* Script for -z combreloc: combine and sort reloc sections */
2OUTPUT_FORMAT("elf64-powerpc", "elf64-powerpc",
3	      "elf64-powerpc")
4OUTPUT_ARCH(powerpc:common64)
5ENTRY(_start)
6/* __DYNAMIC = 0;    */
7SECTIONS
8{
9  /* Read-only sections, merged into text segment: */
10  PROVIDE (__executable_start = 0x60000000); . = 0x60000000 + SIZEOF_HEADERS;
11  .interp         : { *(.interp) }
12  .hash           : { *(.hash) }
13  .dynsym         : { *(.dynsym) }
14  .dynstr         : { *(.dynstr) }
15  .gnu.version    : { *(.gnu.version) }
16  .gnu.version_d  : { *(.gnu.version_d) }
17  .gnu.version_r  : { *(.gnu.version_r) }
18  .rel.dyn        :
19    {
20      *(.rel.init)
21      *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
22      *(.rel.fini)
23      *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
24      *(.rel.data.rel.ro*)
25      *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
26      *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
27      *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
28      *(.rel.ctors)
29      *(.rel.dtors)
30      *(.rel.got)
31      *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*)
32      *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*)
33      *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*)
34      *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*)
35      *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
36    }
37  .rela.dyn       :
38    {
39      *(.rela.init)
40      *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
41      *(.rela.fini)
42      *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
43      *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
44      *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
45      *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
46      *(.rela.ctors)
47      *(.rela.dtors)
48      *(.rela.got)
49      *(.rela.toc)
50      *(.rela.opd)
51      *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*)
52      *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*)
53      *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*)
54      *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*)
55      *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
56    }
57  .rel.plt        : { *(.rel.plt) }
58  .rela.plt       : { *(.rela.plt) }
59  .rela.tocbss	  : { *(.rela.tocbss) }
60  .init           :
61  {
62    KEEP (*(.init))
63  } =0x60000000
64  .text           :
65  {
66    *(.text .stub .text.* .gnu.linkonce.t.*)
67    KEEP (*(.text.*personality*))
68    /* .gnu.warning sections are handled specially by elf32.em.  */
69    *(.gnu.warning)
70    *(.sfpr .glink)
71  } =0x60000000
72  .fini           :
73  {
74    KEEP (*(.fini))
75  } =0x60000000
76  PROVIDE (__etext = .);
77  PROVIDE (_etext = .);
78  PROVIDE (etext = .);
79  .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
80  .rodata1        : { *(.rodata1) }
81  .sdata2         : { *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) }
82  .sbss2          : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) }
83  .eh_frame_hdr : { *(.eh_frame_hdr) }
84  .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) }
85  .gcc_except_table   : ONLY_IF_RO { KEEP (*(.gcc_except_table))
86*(.gcc_except_table.*) } /* Adjust the address for the data segment.  We want to
87adjust up to +     the same address within the page on the next page up.  */
88  . = ALIGN (0x10000) - ((0x10000 - .) & (0x10000 - 1)); . = DATA_SEGMENT_ALIGN
89(0x10000, 0x1000);   /* Exception handling  */
90  .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
91  .gcc_except_table   : ONLY_IF_RW { KEEP (*(.gcc_except_table))
92*(.gcc_except_table.*) }   /* Thread Local Storage sections  */
93  .tdata	  : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
94  .tbss		  : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
95  /* Ensure the __preinit_array_start label is properly aligned.  We
96     could instead move the label definition inside the section, but
97     the linker would then create the section even if it turns out to
98     be empty, which isn't pretty.  */
99  . = ALIGN(64 / 8);
100  PROVIDE (__preinit_array_start = .);
101  .preinit_array     : { KEEP (*(.preinit_array)) }
102  PROVIDE (__preinit_array_end = .);
103  PROVIDE (__init_array_start = .);
104  .init_array     : { KEEP (*(.init_array)) }
105  PROVIDE (__init_array_end = .);
106  PROVIDE (__fini_array_start = .);
107  .fini_array     : { KEEP (*(.fini_array)) }
108  PROVIDE (__fini_array_end = .);
109  .ctors          :
110  {
111    /* gcc uses crtbegin.o to find the start of
112       the constructors, so we make sure it is
113       first.  Because this is a wildcard, it
114       doesn't matter if the user does not
115       actually link against crtbegin.o; the
116       linker won't look for a file to match a
117       wildcard.  The wildcard also means that it
118       doesn't matter which directory crtbegin.o
119       is in.  */
120    KEEP (*crtbegin*.o(.ctors))
121    /* We don't want to include the .ctor section from
122       from the crtend.o file until after the sorted ctors.
123       The .ctor section from the crtend file contains the
124       end of ctors marker and it must be last */
125    KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))
126    KEEP (*(SORT(.ctors.*)))
127    KEEP (*(.ctors))
128  }
129  .dtors          :
130  {
131    KEEP (*crtbegin*.o(.dtors))
132    KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
133    KEEP (*(SORT(.dtors.*)))
134    KEEP (*(.dtors))
135  }
136  .jcr            : { KEEP (*(.jcr)) }
137  .data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro*) }
138  .dynamic        : { *(.dynamic) }
139  . = DATA_SEGMENT_RELRO_END (0, .);
140  .data           :
141  {
142    *(.data .data.* .gnu.linkonce.d.*)
143    KEEP (*(.gnu.linkonce.d.*personality*))
144    SORT(CONSTRUCTORS)
145  }
146  .data1          : { *(.data1) }
147  .toc1		 ALIGN(8) : { *(.toc1) }
148  .opd		 ALIGN(8) : { KEEP (*(.opd)) }
149  .got		ALIGN(8) : { *(.got .toc) }
150  /* We want the small data sections together, so single-instruction offsets
151     can access them all, and initialized data all before uninitialized, so
152     we can shorten the on-disk segment size.  */
153  .sdata          :
154  {
155    *(.sdata .sdata.* .gnu.linkonce.s.*)
156  }
157  _edata = .;
158  PROVIDE (edata = .);
159  __bss_start = .;
160  .tocbss	 ALIGN(8) : { *(.tocbss)}
161  .sbss           :
162  {
163    PROVIDE (__sbss_start = .);
164    PROVIDE (___sbss_start = .);
165    *(.dynsbss)
166    *(.sbss .sbss.* .gnu.linkonce.sb.*)
167    *(.scommon)
168    PROVIDE (__sbss_end = .);
169    PROVIDE (___sbss_end = .);
170  }
171  .plt            : { *(.plt) }
172  .bss            :
173  {
174   *(.dynbss)
175   *(.bss .bss.* .gnu.linkonce.b.*)
176   *(COMMON)
177   /* Align here to ensure that the .bss section occupies space up to
178      _end.  Align after .bss to ensure correct alignment even if the
179      .bss section disappears because there are no input sections.  */
180   . = ALIGN(64 / 8);
181  }
182  . = ALIGN(64 / 8);
183  _end = .;
184  PROVIDE (end = .);
185  . = DATA_SEGMENT_END (.);
186  /* Stabs debugging sections.  */
187  .stab          0 : { *(.stab) }
188  .stabstr       0 : { *(.stabstr) }
189  .stab.excl     0 : { *(.stab.excl) }
190  .stab.exclstr  0 : { *(.stab.exclstr) }
191  .stab.index    0 : { *(.stab.index) }
192  .stab.indexstr 0 : { *(.stab.indexstr) }
193  .comment       0 : { *(.comment) }
194  /* DWARF debug sections.
195     Symbols in the DWARF debugging sections are relative to the beginning
196     of the section so we begin them at 0.  */
197  /* DWARF 1 */
198  .debug          0 : { *(.debug) }
199  .line           0 : { *(.line) }
200  /* GNU DWARF 1 extensions */
201  .debug_srcinfo  0 : { *(.debug_srcinfo) }
202  .debug_sfnames  0 : { *(.debug_sfnames) }
203  /* DWARF 1.1 and DWARF 2 */
204  .debug_aranges  0 : { *(.debug_aranges) }
205  .debug_pubnames 0 : { *(.debug_pubnames) }
206  /* DWARF 2 */
207  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
208  .debug_abbrev   0 : { *(.debug_abbrev) }
209  .debug_line     0 : { *(.debug_line) }
210  .debug_frame    0 : { *(.debug_frame) }
211  .debug_str      0 : { *(.debug_str) }
212  .debug_loc      0 : { *(.debug_loc) }
213  .debug_macinfo  0 : { *(.debug_macinfo) }
214  /* SGI/MIPS DWARF 2 extensions */
215  .debug_weaknames 0 : { *(.debug_weaknames) }
216  .debug_funcnames 0 : { *(.debug_funcnames) }
217  .debug_typenames 0 : { *(.debug_typenames) }
218  .debug_varnames  0 : { *(.debug_varnames) }
219  /DISCARD/ : { *(.note.GNU-stack) }
220}
221