blob: 7b9bd7b7f15e113a88d48183fda8f1fb7b25ccd4 [file] [log] [blame]
Heinrich Schuchardt558abfe2024-01-25 09:38:13 +01001/* SPDX-License-Identifier: BSD-2-Clause */
Alexander Graf31bdde92018-04-23 07:59:45 +02002/*
3 * U-Boot riscv32 EFI linker script
4 *
Alexander Graf31bdde92018-04-23 07:59:45 +02005 * Modified from arch/arm/lib/elf_aarch64_efi.lds
6 */
7
8OUTPUT_FORMAT("elf32-littleriscv", "elf32-littleriscv", "elf32-littleriscv")
9OUTPUT_ARCH(riscv)
Heinrich Schuchardt9bcbe842024-01-25 09:38:15 +010010
11PHDRS
12{
13 data PT_LOAD FLAGS(3); /* SHF_WRITE | SHF_ALLOC */
14}
15
Alexander Graf31bdde92018-04-23 07:59:45 +020016ENTRY(_start)
17SECTIONS
18{
19 .text 0x0 : {
20 _text = .;
21 *(.text.head)
22 *(.text)
23 *(.text.*)
24 *(.gnu.linkonce.t.*)
25 *(.srodata)
26 *(.rodata*)
Heinrich Schuchardt9bcbe842024-01-25 09:38:15 +010027 . = ALIGN(16);
28 *(.dynamic);
Heinrich Schuchardtf2634792022-01-14 21:40:15 +010029 . = ALIGN(512);
Alexander Graf31bdde92018-04-23 07:59:45 +020030 }
Heinrich Schuchardt9bcbe842024-01-25 09:38:15 +010031 .rela.dyn : { *(.rela.dyn) }
32 .rela.plt : { *(.rela.plt) }
33 .rela.got : { *(.rela.got) }
34 .rela.data : { *(.rela.data) *(.rela.data*) }
Alexander Graf31bdde92018-04-23 07:59:45 +020035 _etext = .;
36 _text_size = . - _text;
Heinrich Schuchardt9bcbe842024-01-25 09:38:15 +010037 . = ALIGN(4096);
Alexander Graf31bdde92018-04-23 07:59:45 +020038 .data : {
39 _data = .;
40 *(.sdata)
41 *(.data)
42 *(.data1)
43 *(.data.*)
44 *(.got.plt)
45 *(.got)
46
47 /*
48 * The EFI loader doesn't seem to like a .bss section, so we
49 * stick it all into .data:
50 */
51 . = ALIGN(16);
52 _bss = .;
53 *(.sbss)
54 *(.scommon)
55 *(.dynbss)
56 *(.bss)
57 *(.bss.*)
58 *(COMMON)
Heinrich Schuchardtf2634792022-01-14 21:40:15 +010059 . = ALIGN(512);
Alexander Graf31bdde92018-04-23 07:59:45 +020060 _bss_end = .;
61 _edata = .;
Heinrich Schuchardt9bcbe842024-01-25 09:38:15 +010062 } :data
63 _data_size = _edata - _data;
Alexander Graf31bdde92018-04-23 07:59:45 +020064
65 . = ALIGN(4096);
66 .dynsym : { *(.dynsym) }
67 . = ALIGN(4096);
68 .dynstr : { *(.dynstr) }
69 . = ALIGN(4096);
70 .note.gnu.build-id : { *(.note.gnu.build-id) }
71 /DISCARD/ : {
72 *(.rel.reloc)
73 *(.eh_frame)
74 *(.note.GNU-stack)
75 }
76 .comment 0 : { *(.comment) }
77}