1/*
2 * Linker script for COM32 binaries using libcom32
3 */
4
5/* Script for -z combreloc: combine and sort reloc sections */
6OUTPUT_FORMAT("elf32-i386", "elf32-i386",
7	      "elf32-i386")
8OUTPUT_ARCH(i386)
9EXTERN(_start)
10ENTRY(_start)
11SECTIONS
12{
13  /* Read-only sections, merged into text segment: */
14  . = 0;
15  HIDDEN (__executable_start = .);
16  HIDDEN (_stext = .);
17
18  .init           :
19  {
20    KEEP (*(.init))
21  } =0x90909090
22  .text           :
23  {
24    *(.text .stub .text.* .gnu.linkonce.t.*)
25    /* .gnu.warning sections are handled specially by elf32.em.  */
26    *(.gnu.warning)
27  } =0x90909090
28  .fini           :
29  {
30    KEEP (*(.fini))
31  } =0x90909090
32  HIDDEN (_etext = .);
33
34  HIDDEN( __rodata_start = .);
35  .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
36  .rodata1        : { *(.rodata1) }
37  HIDDEN(__rodata_end = .);
38
39  /*
40   * The difference betwee .ctors/.dtors and .init_array/.fini_array
41   * is the ordering, but we don't use prioritization for libcom32, so
42   * just lump them all together and hope that's okay.
43   */
44  . = ALIGN(4);
45  .ctors          : {
46    HIDDEN(__ctors_start = .);
47    KEEP (*(SORT(.preinit_array*)))
48    KEEP (*(SORT(.init_array*)))
49    KEEP (*(SORT(.ctors*)))
50    HIDDEN(__ctors_end = .);
51  }
52  .dtors          : {
53    HIDDEN(__dtors_start = .);
54    KEEP (*(SORT(.fini_array*)))
55    KEEP (*(SORT(.dtors*)))
56    HIDDEN(__dtors_end = .);
57  }
58
59  .got            : {
60    HIDDEN(__got_start = .);
61    KEEP (*(.got.plt))
62    KEEP (*(.got))
63    HIDDEN(__got_end = .);
64  }
65
66  /* Adjust the address for the data segment.  Avoid mixing code and
67     data within same 128-byte chunk. */
68  . = ALIGN(128);
69
70  .data           :
71  {
72    HIDDEN(_sdata = .);
73    KEEP(*(.data .data.* .gnu.linkonce.d.*))
74    SORT(CONSTRUCTORS)
75    *(.data1)
76    . = ALIGN(4);
77    HIDDEN(_edata = .);
78  }
79
80  HIDDEN(__bss_start = .);
81  .bss            :
82  {
83   *(.dynbss)
84   *(.bss .bss.* .gnu.linkonce.b.*)
85   *(COMMON)
86   /* Align here to ensure that the .bss section occupies space up to
87      _end.  Align after .bss to ensure correct alignment even if the
88      .bss section disappears because there are no input sections.  */
89   . = ALIGN(4);
90  }
91  . = ALIGN(4);
92  HIDDEN(_end = .);
93
94  /* Stabs debugging sections.  */
95  .stab          0 : { *(.stab) }
96  .stabstr       0 : { *(.stabstr) }
97  .stab.excl     0 : { *(.stab.excl) }
98  .stab.exclstr  0 : { *(.stab.exclstr) }
99  .stab.index    0 : { *(.stab.index) }
100  .stab.indexstr 0 : { *(.stab.indexstr) }
101  .comment       0 : { *(.comment) }
102  /* DWARF debug sections.
103     Symbols in the DWARF debugging sections are relative to the beginning
104     of the section so we begin them at 0.  */
105  /* DWARF 1 */
106  .debug          0 : { *(.debug) }
107  .line           0 : { *(.line) }
108  /* GNU DWARF 1 extensions */
109  .debug_srcinfo  0 : { *(.debug_srcinfo) }
110  .debug_sfnames  0 : { *(.debug_sfnames) }
111  /* DWARF 1.1 and DWARF 2 */
112  .debug_aranges  0 : { *(.debug_aranges) }
113  .debug_pubnames 0 : { *(.debug_pubnames) }
114  /* DWARF 2 */
115  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
116  .debug_abbrev   0 : { *(.debug_abbrev) }
117  .debug_line     0 : { *(.debug_line) }
118  .debug_frame    0 : { *(.debug_frame) }
119  .debug_str      0 : { *(.debug_str) }
120  .debug_loc      0 : { *(.debug_loc) }
121  .debug_macinfo  0 : { *(.debug_macinfo) }
122  /* SGI/MIPS DWARF 2 extensions */
123  .debug_weaknames 0 : { *(.debug_weaknames) }
124  .debug_funcnames 0 : { *(.debug_funcnames) }
125  .debug_typenames 0 : { *(.debug_typenames) }
126  .debug_varnames  0 : { *(.debug_varnames) }
127  /DISCARD/ : { *(.note.GNU-stack) }
128}
129