[PATCH 5/5] x86_64: do not pass the EFI image handle or system table to relocation

Masahiro Yamada masahiroy at kernel.org
Tue Nov 16 19:49:18 PST 2021


The _reloc() function in reloc_x86_64.c is passed with the EFI image
handle and system table, but they are unrelated to the relocation.
In fact, they are not used at all.

Remove them and clean up the assembler code as well.

Signed-off-by: Masahiro Yamada <masahiroy at kernel.org>
---

 arch/x86/mach-efi/crt0-efi-x86_64.S | 6 +-----
 arch/x86/mach-efi/reloc_x86_64.c    | 4 ++--
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/arch/x86/mach-efi/crt0-efi-x86_64.S b/arch/x86/mach-efi/crt0-efi-x86_64.S
index aa03106e9..d23c1fb2d 100644
--- a/arch/x86/mach-efi/crt0-efi-x86_64.S
+++ b/arch/x86/mach-efi/crt0-efi-x86_64.S
@@ -47,14 +47,10 @@ _start:
 	lea image_base(%rip), %rdi
 	lea _DYNAMIC(%rip), %rsi
 
-	popq %rcx
-	popq %rdx
-	pushq %rcx
-	pushq %rdx
 	call _relocate
 
-	popq %rdi
 	popq %rsi
+	popq %rdi
 
 	call efi_main
 	addq $8, %rsp
diff --git a/arch/x86/mach-efi/reloc_x86_64.c b/arch/x86/mach-efi/reloc_x86_64.c
index e83bacb30..f015ae047 100644
--- a/arch/x86/mach-efi/reloc_x86_64.c
+++ b/arch/x86/mach-efi/reloc_x86_64.c
@@ -41,9 +41,9 @@
 
 #include <elf.h>
 
-asmlinkage efi_status_t _relocate (long, Elf64_Dyn *, efi_handle_t, efi_system_table_t *);
+asmlinkage efi_status_t _relocate(long, Elf64_Dyn *);
 
-efi_status_t _relocate (long ldbase, Elf64_Dyn *dyn, efi_handle_t image, efi_system_table_t *systab)
+efi_status_t _relocate(long ldbase, Elf64_Dyn *dyn)
 {
 	long relsz = 0, relent = 0;
 	Elf64_Rel *rel = 0;
-- 
2.30.2




More information about the barebox mailing list