xref: /illumos-kvm-cmd/m68k.ld (revision 68396ea9)
1/* Script for -z combreloc: combine and sort reloc sections */
2OUTPUT_FORMAT("elf32-m68k", "elf32-m68k",
3	      "elf32-m68k")
4OUTPUT_ARCH(m68k)
5ENTRY(_start)
6/* __DYNAMIC = 0;    */
7SECTIONS
8{
9  /* Read-only sections, merged into text segment: */
10  . = 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.data.* .rel.gnu.linkonce.d.*)
25      *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
26      *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
27      *(.rel.ctors)
28      *(.rel.dtors)
29      *(.rel.got)
30      *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
31    }
32  .rela.dyn       :
33    {
34      *(.rela.init)
35      *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
36      *(.rela.fini)
37      *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
38      *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
39      *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
40      *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
41      *(.rela.ctors)
42      *(.rela.dtors)
43      *(.rela.got)
44      *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
45    }
46  .rel.plt        : { *(.rel.plt) }
47  .rela.plt       : { *(.rela.plt) }
48  .init           :
49  {
50    KEEP (*(.init))
51  } =0x4e754e75
52  .plt            : { *(.plt) }
53  .text           :
54  {
55    *(.text .stub .text.* .gnu.linkonce.t.*)
56    /* .gnu.warning sections are handled specially by elf32.em.  */
57    *(.gnu.warning)
58  } =0x4e754e75
59  .fini           :
60  {
61    KEEP (*(.fini))
62  } =0x4e754e75
63  PROVIDE (__etext = .);
64  PROVIDE (_etext = .);
65  PROVIDE (etext = .);
66  .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
67  .rodata1        : { *(.rodata1) }
68  .eh_frame_hdr : { *(.eh_frame_hdr) }
69  /* Adjust the address for the data segment.  We want to adjust up to
70     the same address within the page on the next page up.  */
71  . = ALIGN(0x2000) + (. & (0x2000 - 1));
72  /* Ensure the __preinit_array_start label is properly aligned.  We
73     could instead move the label definition inside the section, but
74     the linker would then create the section even if it turns out to
75     be empty, which isn't pretty.  */
76  . = ALIGN(32 / 8);
77  PROVIDE (__preinit_array_start = .);
78  .preinit_array     : { *(.preinit_array) }
79  PROVIDE (__preinit_array_end = .);
80  PROVIDE (__init_array_start = .);
81  .init_array     : { *(.init_array) }
82  PROVIDE (__init_array_end = .);
83  PROVIDE (__fini_array_start = .);
84  .fini_array     : { *(.fini_array) }
85  PROVIDE (__fini_array_end = .);
86  .data           :
87  {
88    *(.data .data.* .gnu.linkonce.d.*)
89    SORT(CONSTRUCTORS)
90  }
91  .data1          : { *(.data1) }
92  .tdata	  : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
93  .tbss		  : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
94  .eh_frame       : { KEEP (*(.eh_frame)) }
95  .gcc_except_table   : { *(.gcc_except_table) }
96  .dynamic        : { *(.dynamic) }
97  .ctors          :
98  {
99    /* gcc uses crtbegin.o to find the start of
100       the constructors, so we make sure it is
101       first.  Because this is a wildcard, it
102       doesn't matter if the user does not
103       actually link against crtbegin.o; the
104       linker won't look for a file to match a
105       wildcard.  The wildcard also means that it
106       doesn't matter which directory crtbegin.o
107       is in.  */
108    KEEP (*crtbegin.o(.ctors))
109    /* We don't want to include the .ctor section from
110       from the crtend.o file until after the sorted ctors.
111       The .ctor section from the crtend file contains the
112       end of ctors marker and it must be last */
113    KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
114    KEEP (*(SORT(.ctors.*)))
115    KEEP (*(.ctors))
116  }
117  .dtors          :
118  {
119    KEEP (*crtbegin.o(.dtors))
120    KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
121    KEEP (*(SORT(.dtors.*)))
122    KEEP (*(.dtors))
123  }
124  .jcr            : { KEEP (*(.jcr)) }
125  .got            : { *(.got.plt) *(.got) }
126  _edata = .;
127  PROVIDE (edata = .);
128  __bss_start = .;
129  .bss            :
130  {
131   *(.dynbss)
132   *(.bss .bss.* .gnu.linkonce.b.*)
133   *(COMMON)
134   /* Align here to ensure that the .bss section occupies space up to
135      _end.  Align after .bss to ensure correct alignment even if the
136      .bss section disappears because there are no input sections.  */
137   . = ALIGN(32 / 8);
138  }
139  . = ALIGN(32 / 8);
140  _end = .;
141  PROVIDE (end = .);
142  /* Stabs debugging sections.  */
143  .stab          0 : { *(.stab) }
144  .stabstr       0 : { *(.stabstr) }
145  .stab.excl     0 : { *(.stab.excl) }
146  .stab.exclstr  0 : { *(.stab.exclstr) }
147  .stab.index    0 : { *(.stab.index) }
148  .stab.indexstr 0 : { *(.stab.indexstr) }
149  .comment       0 : { *(.comment) }
150  /* DWARF debug sections.
151     Symbols in the DWARF debugging sections are relative to the beginning
152     of the section so we begin them at 0.  */
153  /* DWARF 1 */
154  .debug          0 : { *(.debug) }
155  .line           0 : { *(.line) }
156  /* GNU DWARF 1 extensions */
157  .debug_srcinfo  0 : { *(.debug_srcinfo) }
158  .debug_sfnames  0 : { *(.debug_sfnames) }
159  /* DWARF 1.1 and DWARF 2 */
160  .debug_aranges  0 : { *(.debug_aranges) }
161  .debug_pubnames 0 : { *(.debug_pubnames) }
162  /* DWARF 2 */
163  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
164  .debug_abbrev   0 : { *(.debug_abbrev) }
165  .debug_line     0 : { *(.debug_line) }
166  .debug_frame    0 : { *(.debug_frame) }
167  .debug_str      0 : { *(.debug_str) }
168  .debug_loc      0 : { *(.debug_loc) }
169  .debug_macinfo  0 : { *(.debug_macinfo) }
170  /* SGI/MIPS DWARF 2 extensions */
171  .debug_weaknames 0 : { *(.debug_weaknames) }
172  .debug_funcnames 0 : { *(.debug_funcnames) }
173  .debug_typenames 0 : { *(.debug_typenames) }
174  .debug_varnames  0 : { *(.debug_varnames) }
175}
176