xref: /freebsd/sys/conf/ldscript.riscv (revision dc2282fc8baded5efd0d395b289a9a5bac29f4c6)
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  .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     : { *(.sdata) }
93  _edata  =  .;
94  PROVIDE (edata = .);
95  /* Ensure __bss_start is associated with the next section in case orphan
96     sections are placed directly after .sdata, as has been seen to happen with
97     LLD.  */
98  . = .;
99  __bss_start = .;
100  .sbss      : { *(.sbss) *(.scommon) }
101  .bss       :
102  {
103   *(.dynbss)
104   *(.bss)
105   *(COMMON)
106  }
107  . = ALIGN(8);
108  _end = . ;
109  PROVIDE (end = .);
110  /* Stabs debugging sections.  */
111  .stab 0 : { *(.stab) }
112  .stabstr 0 : { *(.stabstr) }
113  .stab.excl 0 : { *(.stab.excl) }
114  .stab.exclstr 0 : { *(.stab.exclstr) }
115  .stab.index 0 : { *(.stab.index) }
116  .stab.indexstr 0 : { *(.stab.indexstr) }
117  .comment 0 : { *(.comment) }
118  /* DWARF debug sections.
119     Symbols in the DWARF debugging sections are relative to the beginning
120     of the section so we begin them at 0.  */
121  /* DWARF 1 */
122  .debug          0 : { *(.debug) }
123  .line           0 : { *(.line) }
124  /* GNU DWARF 1 extensions */
125  .debug_srcinfo  0 : { *(.debug_srcinfo) }
126  .debug_sfnames  0 : { *(.debug_sfnames) }
127  /* DWARF 1.1 and DWARF 2 */
128  .debug_aranges  0 : { *(.debug_aranges) }
129  .debug_pubnames 0 : { *(.debug_pubnames) }
130  /* DWARF 2 */
131  .debug_info     0 : { *(.debug_info) }
132  .debug_abbrev   0 : { *(.debug_abbrev) }
133  .debug_line     0 : { *(.debug_line) }
134  .debug_frame    0 : { *(.debug_frame) }
135  .debug_str      0 : { *(.debug_str) }
136  .debug_loc      0 : { *(.debug_loc) }
137  .debug_macinfo  0 : { *(.debug_macinfo) }
138  /* SGI/MIPS DWARF 2 extensions */
139  .debug_weaknames 0 : { *(.debug_weaknames) }
140  .debug_funcnames 0 : { *(.debug_funcnames) }
141  .debug_typenames 0 : { *(.debug_typenames) }
142  .debug_varnames  0 : { *(.debug_varnames) }
143  /* These must appear regardless of  .  */
144}
145