Executable: Move most rodata sections into the main rodata segment
[glibc/nacl-glibc.git] / ld / ldscripts / elf_nacl.x
blob103e434a9042ad9b13031196b572842def2aa2e0
1 /* Default linker script, for normal executables */
2 OUTPUT_FORMAT("elf32-nacl", "elf32-nacl",
3               "elf32-nacl")
4 OUTPUT_ARCH(i386)
5 ENTRY(_start)
6 SEARCH_DIR("/usr/i386-linux-gnu/lib32"); SEARCH_DIR("/usr/local/lib32"); SEARCH_DIR("/lib32"); SEARCH_DIR("/usr/lib32"); SEARCH_DIR("/usr/i386-linux-gnu/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
7 SECTIONS
9   /* Read-only sections, merged into text segment: */
10   PROVIDE (__executable_start = 0x1000000); . = 0x1000000 + SIZEOF_HEADERS;
11   .interp         : { *(.interp) }
12   . = ALIGN(CONSTANT (MAXPAGESIZE)); /* nacl wants page alignment */
13   .init           :
14   {
15     KEEP (*(.init))
16     . = ALIGN(32); /* ensures NOP fill */
17   } =0x90909090
18   .plt            : { *(.plt) }
19   .text           :
20   {
21     *(.text .stub .text.* .gnu.linkonce.t.*)
22     KEEP (*(.text.*personality*))
23     /* .gnu.warning sections are handled specially by elf32.em.  */
24     *(.gnu.warning)
25   } =0x90909090
26   .fini           :
27   {
28     KEEP (*(.fini))
29     /* Putting alignment inside section ensures we get NOP fill */
30     . = ALIGN(CONSTANT (MAXPAGESIZE)); /* nacl wants page alignment */
31   } =0x90909090
32   PROVIDE (__etext = .);
33   PROVIDE (_etext = .);
34   PROVIDE (etext = .);
36   .note.gnu.build-id : { *(.note.gnu.build-id) }
37   .hash           : { *(.hash) }
38   .gnu.hash       : { *(.gnu.hash) }
39   .dynsym         : { *(.dynsym) }
40   .dynstr         : { *(.dynstr) }
41   .gnu.version    : { *(.gnu.version) }
42   .gnu.version_d  : { *(.gnu.version_d) }
43   .gnu.version_r  : { *(.gnu.version_r) }
44   .rel.init       : { *(.rel.init) }
45   .rela.init      : { *(.rela.init) }
46   .rel.text       : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
47   .rela.text      : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
48   .rel.fini       : { *(.rel.fini) }
49   .rela.fini      : { *(.rela.fini) }
50   .rel.rodata     : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
51   .rela.rodata    : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
52   .rel.data.rel.ro   : { *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*) }
53   .rela.data.rel.ro   : { *(.rela.data.rel.ro* .rela.gnu.linkonce.d.rel.ro.*) }
54   .rel.data       : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
55   .rela.data      : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
56   .rel.tdata      : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
57   .rela.tdata     : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
58   .rel.tbss       : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
59   .rela.tbss      : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
60   .rel.ctors      : { *(.rel.ctors) }
61   .rela.ctors     : { *(.rela.ctors) }
62   .rel.dtors      : { *(.rel.dtors) }
63   .rela.dtors     : { *(.rela.dtors) }
64   .rel.got        : { *(.rel.got) }
65   .rela.got       : { *(.rela.got) }
66   .rel.bss        : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
67   .rela.bss       : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
68   .rel.plt        : { *(.rel.plt) }
69   .rela.plt       : { *(.rela.plt) }
71   .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
72   .rodata1        : { *(.rodata1) }
73   .eh_frame_hdr : { *(.eh_frame_hdr) }
74   .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) }
75   .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
76   /* Adjust the address for the data segment.  We want to adjust up to
77      the same address within the page on the next page up.  */
78   . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
79   /* Exception handling  */
80   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
81   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
82   /* Thread Local Storage sections  */
83   .tdata          : {
84     PROVIDE (__tls_template_start = .);
85     *(.tdata .tdata.* .gnu.linkonce.td.*)
86     PROVIDE (__tls_template_tdata_end = .);
87   }
88   .tbss           : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
89   PROVIDE (__tls_template_end = .);
90   .preinit_array     :
91   {
92     PROVIDE_HIDDEN (__preinit_array_start = .);
93     KEEP (*(.preinit_array))
94     PROVIDE_HIDDEN (__preinit_array_end = .);
95   }
96   .init_array     :
97   {
98      PROVIDE_HIDDEN (__init_array_start = .);
99      KEEP (*(SORT(.init_array.*)))
100      KEEP (*(.init_array))
101      PROVIDE_HIDDEN (__init_array_end = .);
102   }
103   .fini_array     :
104   {
105     PROVIDE_HIDDEN (__fini_array_start = .);
106     KEEP (*(.fini_array))
107     KEEP (*(SORT(.fini_array.*)))
108     PROVIDE_HIDDEN (__fini_array_end = .);
109   }
110   .ctors          :
111   {
112     /* gcc uses crtbegin.o to find the start of
113        the constructors, so we make sure it is
114        first.  Because this is a wildcard, it
115        doesn't matter if the user does not
116        actually link against crtbegin.o; the
117        linker won't look for a file to match a
118        wildcard.  The wildcard also means that it
119        doesn't matter which directory crtbegin.o
120        is in.  */
121     KEEP (*crtbegin.o(.ctors))
122     KEEP (*crtbegin?.o(.ctors))
123     /* We don't want to include the .ctor section from
124        the crtend.o file until after the sorted ctors.
125        The .ctor section from the crtend file contains the
126        end of ctors marker and it must be last */
127     KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
128     KEEP (*(SORT(.ctors.*)))
129     KEEP (*(.ctors))
130   }
131   .dtors          :
132   {
133     KEEP (*crtbegin.o(.dtors))
134     KEEP (*crtbegin?.o(.dtors))
135     KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
136     KEEP (*(SORT(.dtors.*)))
137     KEEP (*(.dtors))
138   }
139   .jcr            : { KEEP (*(.jcr)) }
140   .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
141   .dynamic        : { *(.dynamic) }
142   .got            : { *(.got) }
143   . = DATA_SEGMENT_RELRO_END (12, .);
144   .got.plt        : { *(.got.plt) }
145   .data           :
146   {
147     *(.data .data.* .gnu.linkonce.d.*)
148     KEEP (*(.gnu.linkonce.d.*personality*))
149     SORT(CONSTRUCTORS)
150   }
151   .data1          : { *(.data1) }
152   _edata = .; PROVIDE (edata = .);
153   __bss_start = .;
154   .bss            :
155   {
156    *(.dynbss)
157    *(.bss .bss.* .gnu.linkonce.b.*)
158    *(COMMON)
159    /* Align here to ensure that the .bss section occupies space up to
160       _end.  Align after .bss to ensure correct alignment even if the
161       .bss section disappears because there are no input sections.
162       FIXME: Why do we need it? When there is no .bss section, we don't
163       pad the .data section.  */
164    . = ALIGN(. != 0 ? 32 / 8 : 1);
165   }
166   . = ALIGN(32 / 8);
167   . = ALIGN(32 / 8);
168   _end = .; PROVIDE (end = .);
169   . = DATA_SEGMENT_END (.);
170   /* Stabs debugging sections.  */
171   .stab          0 : { *(.stab) }
172   .stabstr       0 : { *(.stabstr) }
173   .stab.excl     0 : { *(.stab.excl) }
174   .stab.exclstr  0 : { *(.stab.exclstr) }
175   .stab.index    0 : { *(.stab.index) }
176   .stab.indexstr 0 : { *(.stab.indexstr) }
177   .comment       0 : { *(.comment) }
178   /* DWARF debug sections.
179      Symbols in the DWARF debugging sections are relative to the beginning
180      of the section so we begin them at 0.  */
181   /* DWARF 1 */
182   .debug          0 : { *(.debug) }
183   .line           0 : { *(.line) }
184   /* GNU DWARF 1 extensions */
185   .debug_srcinfo  0 : { *(.debug_srcinfo) }
186   .debug_sfnames  0 : { *(.debug_sfnames) }
187   /* DWARF 1.1 and DWARF 2 */
188   .debug_aranges  0 : { *(.debug_aranges) }
189   .debug_pubnames 0 : { *(.debug_pubnames) }
190   /* DWARF 2 */
191   .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
192   .debug_abbrev   0 : { *(.debug_abbrev) }
193   .debug_line     0 : { *(.debug_line) }
194   .debug_frame    0 : { *(.debug_frame) }
195   .debug_str      0 : { *(.debug_str) }
196   .debug_loc      0 : { *(.debug_loc) }
197   .debug_macinfo  0 : { *(.debug_macinfo) }
198   /* SGI/MIPS DWARF 2 extensions */
199   .debug_weaknames 0 : { *(.debug_weaknames) }
200   .debug_funcnames 0 : { *(.debug_funcnames) }
201   .debug_typenames 0 : { *(.debug_typenames) }
202   .debug_varnames  0 : { *(.debug_varnames) }
203   /* DWARF 3 */
204   .debug_pubtypes 0 : { *(.debug_pubtypes) }
205   .debug_ranges   0 : { *(.debug_ranges) }
206   .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
207   /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) }