diff options
author | andrew <andrew@FreeBSD.org> | 2015-04-10 09:15:35 +0000 |
---|---|---|
committer | andrew <andrew@FreeBSD.org> | 2015-04-10 09:15:35 +0000 |
commit | 469a6f6d983bccffa88972ecfd65fe30500b772c (patch) | |
tree | 1dfcaf7a87a37d2fbd5873ff5dfa64bc87c7f538 /sys/boot/efi/loader | |
parent | 43ee10c1228924cde751067137ea1dcf1efc2a4c (diff) | |
download | FreeBSD-src-469a6f6d983bccffa88972ecfd65fe30500b772c.zip FreeBSD-src-469a6f6d983bccffa88972ecfd65fe30500b772c.tar.gz |
Port the EFI reloc codeto work on arm64. This used the rela relocation
table so wiill need the addend included in the relocation calculation.
Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'sys/boot/efi/loader')
-rw-r--r-- | sys/boot/efi/loader/reloc.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sys/boot/efi/loader/reloc.c b/sys/boot/efi/loader/reloc.c index 0aa56b4..fbe2043 100644 --- a/sys/boot/efi/loader/reloc.c +++ b/sys/boot/efi/loader/reloc.c @@ -32,7 +32,12 @@ __FBSDID("$FreeBSD$"); #include <efi.h> #include <bootstrap.h> -#if defined(__arm__) || defined(__i386__) +#if defined(__aarch64__) +#define ElfW_Rel Elf64_Rela +#define ElfW_Dyn Elf64_Dyn +#define ELFW_R_TYPE ELF64_R_TYPE +#define ELF_RELA +#elif defined(__arm__) || defined(__i386__) #define ElfW_Rel Elf32_Rel #define ElfW_Dyn Elf32_Dyn #define ELFW_R_TYPE ELF32_R_TYPE @@ -43,7 +48,10 @@ __FBSDID("$FreeBSD$"); #else #error architecture not supported #endif -#if defined(__amd64__) +#if defined(__aarch64__) +#define RELOC_TYPE_NONE R_AARCH64_NONE +#define RELOC_TYPE_RELATIVE R_AARCH64_RELATIVE +#elif defined(__amd64__) #define RELOC_TYPE_NONE R_X86_64_NONE #define RELOC_TYPE_RELATIVE R_X86_64_RELATIVE #elif defined(__arm__) @@ -104,6 +112,10 @@ _reloc(unsigned long ImageBase, ElfW_Dyn *dynamic, EFI_HANDLE image_handle, /* Address relative to the base address. */ newaddr = (unsigned long *)(ImageBase + rel->r_offset); *newaddr += ImageBase; + /* Add the addend when the ABI uses them */ +#ifdef ELF_RELA + *newaddr += rel->r_addend; +#endif break; default: /* XXX: do we need other relocations ? */ |