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