source: mainline/uspace/lib/c/arch/ia32/_link.ld.in@ 1433ecda

lfn serial ticket/834-toolchain-update topic/fix-logger-deadlock topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 1433ecda was 47b2d7e3, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 8 years ago

Always load ELF headers as part of the text segment.

This forces us to align the start of the text segment to its
declared alignment, otherwise the linker would be forced to allocate
address 0, which the kernel doesn't allow.

Instead of setting the start differently based on each platform's
declared text alignment, set it always to 0x400000 (4 MB),
which is greater than the largest alignment among the currently
supported platforms (amd64, 2MB alignment), and also aligns with
large pages on all platforms that support them.

  • Property mode set to 100644
File size: 2.1 KB
Line 
1#ifndef SHLIB
2STARTUP(LIBC_PATH/arch/UARCH/src/entry.o)
3ENTRY(__entry)
4#endif
5
6PHDRS {
7#if defined(LOADER) || defined(DLEXE)
8 interp PT_INTERP;
9#endif
10 text PT_LOAD FILEHDR PHDRS FLAGS(5);
11 data PT_LOAD FLAGS(6);
12 tls PT_TLS;
13#if defined(SHLIB) || defined(DLEXE)
14 dynamic PT_DYNAMIC;
15#endif
16 debug PT_NOTE;
17}
18
19SECTIONS {
20#ifdef LOADER
21 . = SEGMENT_START("text-segment", 0x70400000);
22#else
23 . = SEGMENT_START("text-segment", 0x400000);
24#endif
25#ifndef SHLIB
26 PROVIDE (__executable_start = .);
27#endif
28 . = . + SIZEOF_HEADERS;
29
30 .init : {
31 *(.init);
32 } :text
33
34 .text : {
35 *(.text .text.*);
36 *(.rodata .rodata.*);
37 } :text
38
39#if defined(SHLIB) || defined(DLEXE)
40 .rel.plt : {
41 *(.rel.plt);
42 }
43 /*
44 *.rel.dyn MUST FOLLOW IMMEDIATELY after .rel.plt
45 * without alignment gap or DT_REL will be broken
46 */
47 .rel.dyn : {
48 *(.rel.*);
49 } :text
50
51 .plt : {
52 *(.plt);
53 } :text
54
55 .dynsym : {
56 *(.dynsym);
57 } :text
58
59 .dynstr : {
60 *(.dynstr);
61 } :text
62
63 .hash : {
64 *(.hash);
65 } :text
66#endif
67
68#if defined(LOADER) || defined(DLEXE)
69 .interp : {
70 *(.interp);
71 } :interp :text
72#endif
73
74 . = . + 0x1000;
75
76#if defined(SHLIB) || defined(DLEXE)
77 .dynamic : {
78 *(.dynamic);
79 } :data :dynamic
80#endif
81
82 .data : {
83 *(.data);
84 } :data
85
86#if defined(SHLIB) || defined(DLEXE)
87 .data.rel : {
88 *(.data.rel .data.rel.*);
89 } :data
90
91 .got : {
92 *(.got);
93 } :data
94
95 .got.plt : {
96 *(.got.plt);
97 } :data
98#endif
99
100 .tdata : {
101 _tdata_start = .;
102 *(.tdata);
103 *(.gnu.linkonce.tb.*);
104 _tdata_end = .;
105 } :data :tls
106 .tbss : {
107 _tbss_start = .;
108 *(.tbss);
109 _tbss_end = .;
110 } :data :tls
111
112 _tls_alignment = MAX(ALIGNOF(.tdata), ALIGNOF(.tbss));
113
114 .bss : {
115 *(.dynbss);
116 *(COMMON);
117 *(.bss);
118 } :data
119
120#ifdef CONFIG_LINE_DEBUG
121 .comment 0 : { *(.comment); } :debug
122 .debug_abbrev 0 : { *(.debug_abbrev); } :debug
123 .debug_aranges 0 : { *(.debug_aranges); } :debug
124 .debug_info 0 : { *(.debug_info); } :debug
125 .debug_line 0 : { *(.debug_line); } :debug
126 .debug_loc 0 : { *(.debug_loc); } :debug
127 .debug_pubnames 0 : { *(.debug_pubnames); } :debug
128 .debug_pubtypes 0 : { *(.debug_pubtypes); } :debug
129 .debug_ranges 0 : { *(.debug_ranges); } :debug
130 .debug_str 0 : { *(.debug_str); } :debug
131#endif
132
133 /DISCARD/ : {
134 *(*);
135 }
136}
Note: See TracBrowser for help on using the repository browser.