xref: /freebsd/sys/conf/ldscript.arm64 (revision ea8dc498aa8ea91ce0364a3f0ccdb740a24dcfb4)
1OUTPUT_ARCH(aarch64)
2ENTRY(_start)
3
4SEARCH_DIR(/usr/lib);
5SECTIONS
6{
7  /* Read-only sections, merged into text segment: */
8  . = text_start; /* This is set using --defsym= on the command line. */
9  .vmm_vectors : { *(.vmm_vectors) }
10  .text      :
11  {
12    *(.text)
13    *(.stub)
14    /* .gnu.warning sections are handled specially by elf32.em.  */
15    *(.gnu.warning)
16    *(.gnu.linkonce.t*)
17  } =0x9090
18  /*
19   * Align to the the largest page size the kernel could be built for.
20   * If we don't then building page tables in locore.S could fail as it
21   * assumes the .text section is on a different page to later sections.
22   */
23  . = ALIGN(CONSTANT(MAXPAGESIZE));
24  _etext = .;
25  PROVIDE (etext = .);
26
27  .fini      : { *(.fini)    } =0x9090
28  .rodata    : { *(.rodata*) *(.gnu.linkonce.r*) }
29  .rodata1   : { *(.rodata1) }
30   .interp     : { *(.interp) 	}
31  .hash          : { *(.hash)		}
32  .dynsym        : { *(.dynsym)		}
33  .dynstr        : { *(.dynstr)		}
34  .gnu.version   : { *(.gnu.version)	}
35  .gnu.version_d   : { *(.gnu.version_d)	}
36  .gnu.version_r   : { *(.gnu.version_r)	}
37  .note.gnu.build-id : {
38    PROVIDE (__build_id_start = .);
39    *(.note.gnu.build-id)
40    PROVIDE (__build_id_end = .);
41  }
42  .rel.text      :
43    { *(.rel.text) *(.rel.gnu.linkonce.t*) }
44  .rela.text     :
45    { *(.rela.text) *(.rela.gnu.linkonce.t*) }
46  .rel.data      :
47    { *(.rel.data) *(.rel.gnu.linkonce.d*) }
48  .rela.data     :
49    { *(.rela.data) *(.rela.gnu.linkonce.d*) }
50  .rel.rodata    :
51    { *(.rel.rodata) *(.rel.gnu.linkonce.r*) }
52  .rela.rodata   :
53    { *(.rela.rodata) *(.rela.gnu.linkonce.r*) }
54  .rel.got       : { *(.rel.got)		}
55  .rela.got      : { *(.rela.got)		}
56  .rel.ctors     : { *(.rel.ctors)	}
57  .rela.ctors    : { *(.rela.ctors)	}
58  .rel.dtors     : { *(.rel.dtors)	}
59  .rela.dtors    : { *(.rela.dtors)	}
60  .rel.init      : { *(.rel.init)	}
61  .rela.init     : { *(.rela.init)	}
62  .rel.fini      : { *(.rel.fini)	}
63  .rela.fini     : { *(.rela.fini)	}
64  .rel.bss       : { *(.rel.bss)		}
65  .rela.bss      : { *(.rela.bss)		}
66  .rel.plt       : { *(.rel.plt)		}
67  .rela.plt      : { *(.rela.plt)		}
68  .init          : { *(.init)	} =0x9090
69  .plt      : { *(.plt)	}
70
71  . = ALIGN(4);
72  _extab_start = .;
73  PROVIDE(extab_start = .);
74  .ARM.extab : { *(.ARM.extab) }
75  _extab.end = .;
76  PROVIDE(extab_end = .);
77
78  _exidx_start = .;
79  PROVIDE(exidx_start = .);
80  .ARM.exidx : { *(.ARM.exidx) }
81  _exidx_end = .;
82  PROVIDE(exidx_end = .);
83
84  /* Adjust the address for the data segment.  We want to adjust up to
85     the same address within the page on the next page up.  */
86  . = ALIGN(0x1000) + (. & (0x1000 - 1)) ;
87  .data    :
88  {
89    *(.data)
90    *(.gnu.linkonce.d*)
91  }
92  . = ALIGN(128);
93  .data.read_frequently :
94  {
95    *(SORT_BY_ALIGNMENT(.data.read_frequently))
96  }
97  .data.read_mostly :
98  {
99    *(.data.read_mostly)
100  }
101  . = ALIGN(128);
102  .data.exclusive_cache_line :
103  {
104    *(.data.exclusive_cache_line)
105  }
106  . = ALIGN(128);
107  .data1   : { *(.data1) }
108  . = ALIGN(32 / 8);
109  .init_array    :
110  {
111    PROVIDE_HIDDEN (__init_array_start = .);
112    KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*)))
113    KEEP (*(.init_array))
114    PROVIDE_HIDDEN (__init_array_end = .);
115  }
116  .fini_array    :
117  {
118    PROVIDE_HIDDEN (__fini_array_start = .);
119    KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*)))
120    KEEP (*(.fini_array))
121    PROVIDE_HIDDEN (__fini_array_end = .);
122  }
123  _start_ctors = .;
124  PROVIDE (start_ctors = .);
125  .ctors         :
126  {
127    *(.ctors)
128  }
129  _stop_ctors = .;
130  PROVIDE (stop_ctors = .);
131  .dtors         :
132  {
133    *(.dtors)
134  }
135  .got           : { *(.got.plt) *(.got) }
136  .dynamic       : { *(.dynamic) }
137  /* We want the small data sections together, so single-instruction offsets
138     can access them all, and initialized data all before uninitialized, so
139     we can shorten the on-disk segment size.  */
140  . = ALIGN(8);
141  .sdata     : { *(.sdata) }
142  _edata  =  .;
143  PROVIDE (edata = .);
144  . = ALIGN(16);
145  __bss_start = .;
146  .sbss      : { *(.sbss) *(.scommon) }
147  .bss       :
148  {
149   *(.dynbss)
150   *(.bss)
151   *(COMMON)
152   . = ALIGN(16);
153   __bss_end = .;
154   /* A section for the initial page table, it doesn't need to be in the
155      kernel file, however unlike normal .bss entries should not be zeroed
156      out as we use it before the .bss section is cleared. */
157   *(.init_pagetable)
158  }
159  _end = . ;
160  PROVIDE (end = .);
161
162  /* Debug */
163  INCLUDE debuginfo.ldscript
164
165  .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
166  /DISCARD/ : { *(.note.GNU-stack) }
167}
168