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

lfn serial ticket/834-toolchain-update 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: 1.3 KB
Line 
1STARTUP(LIBC_PATH/arch/UARCH/src/entry.o)
2ENTRY(__entry)
3
4PHDRS {
5#ifdef LOADER
6 interp PT_INTERP;
7#endif
8 text PT_LOAD FILEHDR PHDRS FLAGS(5);
9 data PT_LOAD FLAGS(6);
10 debug PT_NOTE;
11}
12
13SECTIONS {
14#ifdef LOADER
15 . = SEGMENT_START("text-segment", 0x70400000);
16#else
17 . = SEGMENT_START("text-segment", 0x400000);
18#endif
19#ifndef SHLIB
20 PROVIDE (__executable_start = .);
21#endif
22 . = . + SIZEOF_HEADERS;
23
24 .init : {
25 *(.init);
26 } :text
27
28 .text : {
29 *(.text .text.*);
30 *(.rodata .rodata.*);
31 } :text
32
33#ifdef LOADER
34 .interp : {
35 *(.interp);
36 } :interp :text
37#endif
38
39 . = . + 0x1000;
40
41 .data : {
42 *(.data);
43 *(.data.rel*);
44 } :data
45
46 .tdata : {
47 _tdata_start = .;
48 *(.tdata);
49 _tdata_end = .;
50 _tbss_start = .;
51 *(.tbss);
52 _tbss_end = .;
53 } :data
54
55 _tls_alignment = ALIGNOF(.tdata);
56
57 .bss : {
58 *(COMMON);
59 *(.bss);
60 } :data
61
62#ifdef CONFIG_LINE_DEBUG
63 .comment 0 : { *(.comment); } :debug
64 .debug_abbrev 0 : { *(.debug_abbrev); } :debug
65 .debug_aranges 0 : { *(.debug_aranges); } :debug
66 .debug_info 0 : { *(.debug_info); } :debug
67 .debug_line 0 : { *(.debug_line); } :debug
68 .debug_loc 0 : { *(.debug_loc); } :debug
69 .debug_pubnames 0 : { *(.debug_pubnames); } :debug
70 .debug_pubtypes 0 : { *(.debug_pubtypes); } :debug
71 .debug_ranges 0 : { *(.debug_ranges); } :debug
72 .debug_str 0 : { *(.debug_str); } :debug
73#endif
74
75 /DISCARD/ : {
76 *(*);
77 }
78}
Note: See TracBrowser for help on using the repository browser.