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(kernel_text = .);
15                    *(.text)
16                    *(.text.*)
17                    *(.stub)
18          } =0
19
20          /* Move .rodata to the next L2 block to set unexecutable */
21          . = ALIGN(L2_SIZE);
22
23          PROVIDE(__rodata_start = .);
24          .rodata :
25          {
26                    *(.rodata)
27                    *(.rodata.*)
28                    . = ALIGN(64);
29                    __CTOR_LIST__ = .;
30                    *(.ctors)
31                    *(.init_array)
32                    __CTOR_END__ = .;
33          }
34
35          PROVIDE(_etext = .);
36          PROVIDE(etext = .);
37
38          /*
39           * Adjust the address for the data segment. Move .data to the next
40           * L2 block, and .text and .rodata will be set readonly if needed.
41           */
42          PROVIDE(_erodata = .);
43          . = ALIGN(L2_SIZE);
44
45          .data :
46          {
47                    PROVIDE(__data_start = .);
48                    *(.data)
49          }
50
51          . = ALIGN(COHERENCY_UNIT);
52          .data.cacheline_aligned :
53          {
54                    *(.data.cacheline_aligned)
55          }
56          . = ALIGN(COHERENCY_UNIT);
57          .data.read_mostly :
58          {
59                    *(.data.read_mostly)
60          }
61          . = ALIGN(COHERENCY_UNIT);
62
63          _edata = .;
64          PROVIDE (edata = .);
65
66          __bss_start = .;
67          __bss_start__ = .;
68          .bss :
69          {
70                    *(.bss)
71                    *(.bss.*)
72                    *(COMMON)
73
74                    /*
75                     * Align here to ensure that the .bss section occupies space
76                     * up to _end. Align after .bss to ensure correct alignment
77                     * even if the .bss section disappears because there are no
78                     * input sections.
79                     *
80                     * FIXME: Why do we need it? When there is no .bss section,
81                     * we don't pad the .data section.
82                     */
83                    . = ALIGN(. != 0 ? 32 / 8 : 1);
84          }
85          _bss_end__ = . ;
86          __bss_end__ = . ;
87          . = ALIGN(32 / 8);
88
89          __end__ = . ;
90          _end = .;
91          PROVIDE(end = .);
92}
93