xref: /freebsd/sys/conf/ldscript.riscv (revision aa1a8ff2d6dbc51ef058f46f3db5a8bb77967145)
1OUTPUT_ARCH(riscv)
2ENTRY(_start)
3
4SEARCH_DIR(/usr/lib);
5SECTIONS
6{
7  /* Read-only sections, merged into text segment: */
8  . = kernbase;
9  /* The load address kernel_lma is set using --defsym= on the command line. */
10  .text      : AT(kernel_lma)
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  _etext = .;
19  PROVIDE (etext = .);
20  .fini      : { *(.fini)    } =0x9090
21  .rodata    : { *(.rodata) *(.gnu.linkonce.r*) }
22  .rodata1   : { *(.rodata1) }
23   .interp     : { *(.interp) 	}
24  .hash          : { *(.hash)		}
25  .dynsym        : { *(.dynsym)		}
26  .dynstr        : { *(.dynstr)		}
27  .gnu.version   : { *(.gnu.version)	}
28  .gnu.version_d   : { *(.gnu.version_d)	}
29  .gnu.version_r   : { *(.gnu.version_r)	}
30  .note.gnu.build-id : {
31    PROVIDE (__build_id_start = .);
32    *(.note.gnu.build-id)
33    PROVIDE (__build_id_end = .);
34  }
35  .rel.text      :
36    { *(.rel.text) *(.rel.gnu.linkonce.t*) }
37  .rela.text     :
38    { *(.rela.text) *(.rela.gnu.linkonce.t*) }
39  .rel.data      :
40    { *(.rel.data) *(.rel.gnu.linkonce.d*) }
41  .rela.data     :
42    { *(.rela.data) *(.rela.gnu.linkonce.d*) }
43  .rel.rodata    :
44    { *(.rel.rodata) *(.rel.gnu.linkonce.r*) }
45  .rela.rodata   :
46    { *(.rela.rodata) *(.rela.gnu.linkonce.r*) }
47  .rel.got       : { *(.rel.got)		}
48  .rela.got      : { *(.rela.got)		}
49  .rel.ctors     : { *(.rel.ctors)	}
50  .rela.ctors    : { *(.rela.ctors)	}
51  .rel.dtors     : { *(.rel.dtors)	}
52  .rela.dtors    : { *(.rela.dtors)	}
53  .rel.init      : { *(.rel.init)	}
54  .rela.init     : { *(.rela.init)	}
55  .rel.fini      : { *(.rel.fini)	}
56  .rela.fini     : { *(.rela.fini)	}
57  .rel.bss       : { *(.rel.bss)		}
58  .rela.bss      : { *(.rela.bss)		}
59  .rel.plt       : { *(.rel.plt)		}
60  .rela.plt      : { *(.rela.plt)		}
61  .init          : { *(.init)	} =0x9090
62  .plt      : { *(.plt)	}
63
64  /* Adjust the address for the data segment.  We want to adjust up to
65     the same address within the page on the next page up.  */
66  . = ALIGN(0x1000) + (. & (0x1000 - 1)) ;
67  .data    :
68  {
69    *(.data)
70    *(.gnu.linkonce.d*)
71  }
72  .data1   : { *(.data1) }
73  . = ALIGN(32 / 8);
74  _start_ctors = .;
75  PROVIDE (start_ctors = .);
76  .ctors         :
77  {
78    *(.ctors)
79  }
80  _stop_ctors = .;
81  PROVIDE (stop_ctors = .);
82  .dtors         :
83  {
84    *(.dtors)
85  }
86  .got           : { *(.got.plt) *(.got) }
87  .dynamic       : { *(.dynamic) }
88  /* We want the small data sections together, so single-instruction offsets
89     can access them all, and initialized data all before uninitialized, so
90     we can shorten the on-disk segment size.  */
91  . = ALIGN(8);
92  .sdata     :
93  {
94    __global_pointer$ = . + 0x800;
95    *(.sdata)
96  }
97  _edata  =  .;
98  PROVIDE (edata = .);
99  /* Ensure __bss_start is associated with the next section in case orphan
100     sections are placed directly after .sdata, as has been seen to happen with
101     LLD.  */
102  . = ALIGN(8);
103  __bss_start = .;
104  .sbss      : { *(.sbss) *(.scommon) }
105  .bss       :
106  {
107   *(.dynbss)
108   *(.bss)
109   *(COMMON)
110  }
111  . = ALIGN(8);
112  _end = . ;
113  PROVIDE (end = .);
114  /* Stabs debugging sections.  */
115  .stab 0 : { *(.stab) }
116  .stabstr 0 : { *(.stabstr) }
117  .stab.excl 0 : { *(.stab.excl) }
118  .stab.exclstr 0 : { *(.stab.exclstr) }
119  .stab.index 0 : { *(.stab.index) }
120  .stab.indexstr 0 : { *(.stab.indexstr) }
121  .comment 0 : { *(.comment) }
122  /* DWARF debug sections.
123     Symbols in the DWARF debugging sections are relative to the beginning
124     of the section so we begin them at 0.  */
125  /* DWARF 1 */
126  .debug          0 : { *(.debug) }
127  .line           0 : { *(.line) }
128  /* GNU DWARF 1 extensions */
129  .debug_srcinfo  0 : { *(.debug_srcinfo) }
130  .debug_sfnames  0 : { *(.debug_sfnames) }
131  /* DWARF 1.1 and DWARF 2 */
132  .debug_aranges  0 : { *(.debug_aranges) }
133  .debug_pubnames 0 : { *(.debug_pubnames) }
134  /* DWARF 2 */
135  .debug_info     0 : { *(.debug_info) }
136  .debug_abbrev   0 : { *(.debug_abbrev) }
137  .debug_line     0 : { *(.debug_line) }
138  .debug_frame    0 : { *(.debug_frame) }
139  .debug_str      0 : { *(.debug_str) }
140  .debug_loc      0 : { *(.debug_loc) }
141  .debug_macinfo  0 : { *(.debug_macinfo) }
142  /* SGI/MIPS DWARF 2 extensions */
143  .debug_weaknames 0 : { *(.debug_weaknames) }
144  .debug_funcnames 0 : { *(.debug_funcnames) }
145  .debug_typenames 0 : { *(.debug_typenames) }
146  .debug_varnames  0 : { *(.debug_varnames) }
147
148  .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
149  /DISCARD/ : { *(.note.GNU-stack) }
150}
151