xref: /freebsd/stand/efi/loader/arch/riscv/riscv.ldscript (revision cb14a3fe5122c879eae1fb480ed7ce82a699ddb6)
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  .sdata	: {
39    /*
40     * u-boot expects the gp register to be untouched by the EFI payload, so we
41     * can't enable this yet.
42     */
43    /* __global_pointer$ = . + 0x800; */
44    *(.got.plt .got)
45    *(.sdata .sdata.* .gnu.linkonce.s.*)
46    *(dynsbss)
47    *(.scommon)
48  }
49  . = ALIGN(16);
50  .dynamic	: { *(.dynamic) }
51  . = ALIGN(16);
52  .rela.dyn	: {
53    *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
54    *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
55    *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
56    *(.rela.got)
57    *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*)
58    *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*)
59    *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*)
60    *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*)
61    *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
62    *(.rela.plt)
63    *(.relset_*)
64    *(.rela.dyn .rela.dyn.*)
65  }
66  . = ALIGN(16);
67  .reloc	: { *(.reloc) }
68  . = ALIGN(16);
69  .dynsym	: { *(.dynsym) }
70  _edata = .;
71
72  /* Unused sections */
73  .interp	: { *(.interp) }
74  .dynstr	: { *(.dynstr) }
75  .hash		: { *(.hash) }
76}
77