KEEP(*(SORT(.u_boot_list*)));
}
+ . = ALIGN(4);
+
+ .efi_runtime : {
+ __efi_runtime_start = .;
+ *(efi_runtime_text)
+ *(efi_runtime_data)
+ __efi_runtime_stop = .;
+ }
+
+ .efi_runtime_rel : {
+ __efi_runtime_rel_start = .;
+ *(.relaefi_runtime_text)
+ *(.relaefi_runtime_data)
+ __efi_runtime_rel_stop = .;
+ }
+
. = ALIGN(4);
/DISCARD/ : { *(.rela.plt*) }
config CMD_BOOTEFI_HELLO_COMPILE
bool "Compile a standard EFI hello world binary for testing"
- depends on CMD_BOOTEFI && (ARM || X86)
+ depends on CMD_BOOTEFI && (ARM || X86 || RISCV)
default y
help
This compiles a standard EFI hello world application with U-Boot so
config EFI_LOADER
bool "Support running EFI Applications in U-Boot"
- depends on (ARM || X86) && OF_LIBFDT
+ depends on (ARM || X86 || RISCV) && OF_LIBFDT
# We do not support bootefi booting ARMv7 in non-secure mode
depends on !ARMV7_NONSEC
# We need EFI_STUB_64BIT to be set on x86_64 with EFI_STUB
#include <asm/elf.h>
#define R_RELATIVE R_386_RELATIVE
#define R_MASK 0xffULL
+#elif defined(CONFIG_RISCV)
+#include <elf.h>
+#define R_RELATIVE R_RISCV_RELATIVE
+#define R_MASK 0xffULL
+#define IS_RELA 1
+
+struct dyn_sym {
+ ulong foo1;
+ ulong addr;
+ u32 foo2;
+ u32 foo3;
+};
+#ifdef CONFIG_CPU_RISCV_32
+#define R_ABSOLUTE R_RISCV_32
+#define SYM_INDEX 8
+#else
+#define R_ABSOLUTE R_RISCV_64
+#define SYM_INDEX 32
+#endif
#else
#error Need to add relocation awareness
#endif
p = (void*)((ulong)rel->offset - base) + gd->relocaddr;
- if ((rel->info & R_MASK) != R_RELATIVE) {
- continue;
- }
+ debug("%s: rel->info=%#lx *p=%#lx rel->offset=%p\n", __func__, rel->info, *p, rel->offset);
+ switch (rel->info & R_MASK) {
+ case R_RELATIVE:
#ifdef IS_RELA
newaddr = rel->addend + offset - CONFIG_SYS_TEXT_BASE;
#else
newaddr = *p - lastoff + offset;
#endif
+ break;
+#ifdef R_ABSOLUTE
+ case R_ABSOLUTE: {
+ ulong symidx = rel->info >> SYM_INDEX;
+ extern struct dyn_sym __dyn_sym_start[];
+ newaddr = __dyn_sym_start[symidx].addr + offset;
+ break;
+ }
+#endif
+ default:
+ continue;
+ }
/* Check if the relocation is inside bounds */
if (map && ((newaddr < map->virtual_start) ||