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