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