kern.ldscript revision 1.7 1 #include "assym.h"
2
3 /* Default linker script, for normal executables */
4 OUTPUT_FORMAT("elf64-littleaarch64", "elf64-bigaarch64",
5 "elf64-littleaarch64")
6 OUTPUT_ARCH(aarch64)
7 ENTRY(_start)
8 SECTIONS
9 {
10 /* Read-only sections, merged into text segment: */
11 .text :
12 {
13 PROVIDE (__kernel_text = .);
14 PROVIDE_HIDDEN (__eprol = .);
15 *(.text)
16 *(.text.unlikely .text.*_unlikely)
17 *(.text.exit .text.exit.*)
18 *(.text.startup .text.startup.*)
19 *(.text.hot .text.hot.*)
20 *(.stub .text.* .gnu.linkonce.t.*)
21 /* .gnu.warning sections are handled specially by elf32.em. */
22 } =0
23 /* Move .rodata to the next L2 block to set unexecutable */
24 . = ALIGN (L2_SIZE);
25 PROVIDE (__rodata_start = .);
26 .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
27 .rodata1 : { *(.rodata1) }
28 .eh_frame_hdr : { *(.eh_frame_hdr) }
29 .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
30 .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table
31 .gcc_except_table.*) }
32 /* These sections are generated by the Sun/Oracle C++ compiler. */
33 .exception_ranges : ONLY_IF_RO { *(.exception_ranges
34 .exception_ranges*) }
35 PROVIDE (__etext = .);
36 PROVIDE (_etext = .);
37 PROVIDE (etext = .);
38 /* Adjust the address for the data segment. Move .data to the next L2 block,
39 and .text and .rodata will be set readonly if needed. */
40 PROVIDE (_erodata = .);
41 . = ALIGN (L2_SIZE);
42 . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
43 /* Exception handling */
44 .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
45 .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
46 .exception_ranges : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) }
47 .got : { *(.got) *(.igot) }
48 . = DATA_SEGMENT_RELRO_END (24, .);
49 .got.plt : { *(.got.plt) *(.igot.plt) }
50 .data :
51 {
52 PROVIDE (__data_start = .);
53 *(.data .gnu.linkonce.d.*)
54 SORT(CONSTRUCTORS)
55 }
56 .data1 : { *(.data1) }
57
58 . = ALIGN(64); /* COHERENCY_UNIT */
59 .data.cacheline_aligned :
60 {
61 *(.data.cacheline_aligned)
62 }
63 . = ALIGN(64); /* COHERENCY_UNIT */
64 .data.read_mostly :
65 {
66 *(.data.read_mostly)
67 }
68 . = ALIGN(64); /* COHERENCY_UNIT */
69
70 _edata = .; PROVIDE (edata = .);
71 . = .;
72 __bss_start = .;
73 __bss_start__ = .;
74 .bss :
75 {
76 *(.dynbss)
77 *(.bss .bss.* .gnu.linkonce.b.*)
78 *(COMMON)
79 /* Align here to ensure that the .bss section occupies space up to
80 _end. Align after .bss to ensure correct alignment even if the
81 .bss section disappears because there are no input sections.
82 FIXME: Why do we need it? When there is no .bss section, we don't
83 pad the .data section. */
84 . = ALIGN(. != 0 ? 32 / 8 : 1);
85 }
86 _bss_end__ = . ; __bss_end__ = . ;
87 . = ALIGN(32 / 8);
88 . = ALIGN(32 / 8);
89 __end__ = . ;
90 _end = .; PROVIDE (end = .);
91 . = DATA_SEGMENT_END (.);
92 .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) KEEP (*(.gnu.attributes)) }
93 .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
94 }
95