diff options
Diffstat (limited to 'drivers/firmware/efi/libstub/arm64-stub.c')
-rw-r--r-- | drivers/firmware/efi/libstub/arm64-stub.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/firmware/efi/libstub/arm64-stub.c b/drivers/firmware/efi/libstub/arm64-stub.c index 2915b44132e6..db0c1a9c1699 100644 --- a/drivers/firmware/efi/libstub/arm64-stub.c +++ b/drivers/firmware/efi/libstub/arm64-stub.c @@ -6,17 +6,11 @@ * Adapted from ARM version by Mark Salter <msalter@redhat.com> */ -/* - * To prevent the compiler from emitting GOT-indirected (and thus absolute) - * references to the section markers, override their visibility as 'hidden' - */ -#pragma GCC visibility push(hidden) -#include <asm/sections.h> -#pragma GCC visibility pop #include <linux/efi.h> #include <asm/efi.h> #include <asm/memory.h> +#include <asm/sections.h> #include <asm/sysreg.h> #include "efistub.h" @@ -49,7 +43,6 @@ efi_status_t handle_kernel_image(unsigned long *image_addr, { efi_status_t status; unsigned long kernel_size, kernel_memsize = 0; - void *old_image_addr = (void *)*image_addr; unsigned long preferred_offset; u64 phys_seed = 0; @@ -123,6 +116,7 @@ efi_status_t handle_kernel_image(unsigned long *image_addr, * Mustang), we can still place the kernel at the address * 'dram_base + TEXT_OFFSET'. */ + *image_addr = (unsigned long)_text; if (*image_addr == preferred_offset) return EFI_SUCCESS; @@ -147,7 +141,11 @@ efi_status_t handle_kernel_image(unsigned long *image_addr, } *image_addr = *reserve_addr + TEXT_OFFSET; } - memcpy((void *)*image_addr, old_image_addr, kernel_size); + + if (image->image_base != _text) + pr_efi_err("FIRMWARE BUG: efi_loaded_image_t::image_base has bogus value\n"); + + memcpy((void *)*image_addr, _text, kernel_size); return EFI_SUCCESS; } |