Heinrich Schuchardt | 558abfe | 2024-01-25 09:38:13 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: BSD-2-Clause */ |
Alexander Graf | 31bdde9 | 2018-04-23 07:59:45 +0200 | [diff] [blame] | 2 | /* |
| 3 | * U-Boot riscv64 EFI linker script |
| 4 | * |
Alexander Graf | 31bdde9 | 2018-04-23 07:59:45 +0200 | [diff] [blame] | 5 | * Modified from arch/arm/lib/elf_aarch64_efi.lds |
| 6 | */ |
| 7 | |
| 8 | OUTPUT_FORMAT("elf64-littleriscv", "elf64-littleriscv", "elf64-littleriscv") |
| 9 | OUTPUT_ARCH(riscv) |
Heinrich Schuchardt | 9bcbe84 | 2024-01-25 09:38:15 +0100 | [diff] [blame] | 10 | |
| 11 | PHDRS |
| 12 | { |
| 13 | data PT_LOAD FLAGS(3); /* SHF_WRITE | SHF_ALLOC */ |
| 14 | } |
| 15 | |
Alexander Graf | 31bdde9 | 2018-04-23 07:59:45 +0200 | [diff] [blame] | 16 | ENTRY(_start) |
| 17 | SECTIONS |
| 18 | { |
| 19 | .text 0x0 : { |
| 20 | _text = .; |
| 21 | *(.text.head) |
| 22 | *(.text) |
| 23 | *(.text.*) |
| 24 | *(.gnu.linkonce.t.*) |
| 25 | *(.srodata) |
| 26 | *(.rodata*) |
Heinrich Schuchardt | 9bcbe84 | 2024-01-25 09:38:15 +0100 | [diff] [blame] | 27 | . = ALIGN(16); |
| 28 | *(.dynamic); |
Heinrich Schuchardt | f263479 | 2022-01-14 21:40:15 +0100 | [diff] [blame] | 29 | . = ALIGN(512); |
Alexander Graf | 31bdde9 | 2018-04-23 07:59:45 +0200 | [diff] [blame] | 30 | } |
Heinrich Schuchardt | 9bcbe84 | 2024-01-25 09:38:15 +0100 | [diff] [blame] | 31 | .rela.dyn : { *(.rela.dyn) } |
| 32 | .rela.plt : { *(.rela.plt) } |
| 33 | .rela.got : { *(.rela.got) } |
| 34 | .rela.data : { *(.rela.data) *(.rela.data*) } |
Alexander Graf | 31bdde9 | 2018-04-23 07:59:45 +0200 | [diff] [blame] | 35 | _etext = .; |
| 36 | _text_size = . - _text; |
Heinrich Schuchardt | 9bcbe84 | 2024-01-25 09:38:15 +0100 | [diff] [blame] | 37 | . = ALIGN(4096); |
Alexander Graf | 31bdde9 | 2018-04-23 07:59:45 +0200 | [diff] [blame] | 38 | .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 Schuchardt | f263479 | 2022-01-14 21:40:15 +0100 | [diff] [blame] | 59 | . = ALIGN(512); |
Alexander Graf | 31bdde9 | 2018-04-23 07:59:45 +0200 | [diff] [blame] | 60 | _bss_end = .; |
| 61 | _edata = .; |
Heinrich Schuchardt | 9bcbe84 | 2024-01-25 09:38:15 +0100 | [diff] [blame] | 62 | } :data |
| 63 | _data_size = _edata - _data; |
Alexander Graf | 31bdde9 | 2018-04-23 07:59:45 +0200 | [diff] [blame] | 64 | |
| 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 | } |