xref: /freebsd/stand/efi/loader/arch/riscv/riscv.ldscript (revision 5b3b9a58584b101e3ea0fd8dd50dc8d9157c058e)
1OUTPUT_FORMAT("elf64-littleriscv", "elf64-littleriscv", "elf64-littleriscv")
2OUTPUT_ARCH(riscv64)
3ENTRY(_start)
4SECTIONS
5{
6  /* Read-only sections, merged into text segment: */
7  . = 0;
8  ImageBase = .;
9  .text		: {
10    *(.peheader)
11    *(.text .stub .text.* .gnu.linkonce.t.*)
12    /* .gnu.warning sections are handled specially by elf32.em. */
13    *(.gnu.warning)
14    *(.plt)
15  } =0x9090
16  . = ALIGN(16);
17  .data		: {
18    *(.rodata .rodata.* .gnu.linkonce.r.*)
19    *(.rodata1)
20    *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
21    *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)
22    *(.opd)
23    *(.data .data.* .gnu.linkonce.d.*)
24    *(.data1)
25    *(.plabel)
26
27    . = ALIGN(16);
28    __bss_start = .;
29    *(.sbss .sbss.* .gnu.linkonce.sb.*)
30    *(.scommon)
31    *(.dynbss)
32    *(.bss *.bss.*)
33    *(COMMON)
34    . = ALIGN(16);
35    __bss_end = .;
36  }
37  . = ALIGN(16);
38  set_Xcommand_set	: {
39    __start_set_Xcommand_set = .;
40    *(set_Xcommand_set)
41    __stop_set_Xcommand_set = .;
42  }
43  set_Xficl_compile_set	: {
44    __start_set_Xficl_compile_set = .;
45    *(set_Xficl_compile_set)
46    __stop_set_Xficl_compile_set = .;
47  }
48  . = ALIGN(16);
49  .sdata	: {
50    /*
51     * u-boot expects the gp register to be untouched by the EFI payload, so we
52     * can't enable this yet.
53     */
54    /* __global_pointer$ = . + 0x800; */
55    *(.got.plt .got)
56    *(.sdata .sdata.* .gnu.linkonce.s.*)
57    *(dynsbss)
58    *(.scommon)
59  }
60  . = ALIGN(16);
61  .dynamic	: { *(.dynamic) }
62  . = ALIGN(16);
63  .rela.dyn	: {
64    *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
65    *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
66    *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
67    *(.rela.got)
68    *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*)
69    *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*)
70    *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*)
71    *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*)
72    *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
73    *(.rela.plt)
74    *(.relset_*)
75    *(.rela.dyn .rela.dyn.*)
76  }
77  . = ALIGN(16);
78  .reloc	: { *(.reloc) }
79  . = ALIGN(16);
80  .dynsym	: { *(.dynsym) }
81  _edata = .;
82
83  /* Unused sections */
84  .interp	: { *(.interp) }
85  .dynstr	: { *(.dynstr) }
86  .hash		: { *(.hash) }
87}
88