diff options
author | Simon Glass <sjg@chromium.org> | 2016-11-07 08:47:14 -0700 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2016-11-14 23:24:04 +0100 |
commit | 2dcd4e9ee1b6dc0f0ba1d89a7af3987ea47dda23 (patch) | |
tree | bee452040b1403b2feab1709c8fff3b44e80bbfa /arch/x86/lib/efi | |
parent | d36badfdc6a47ae1377dde809c9ea6f6249f5c15 (diff) |
x86: Move efi .S files into the 'lib' directory
These files now need to be in a standard place so that they can be located
by generic Makefile rules. Move them to the 'lib' directory.
Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'arch/x86/lib/efi')
-rw-r--r-- | arch/x86/lib/efi/Makefile | 18 | ||||
-rw-r--r-- | arch/x86/lib/efi/crt0-efi-ia32.S | 52 | ||||
-rw-r--r-- | arch/x86/lib/efi/crt0-efi-x86_64.S | 51 | ||||
-rw-r--r-- | arch/x86/lib/efi/reloc_ia32.c | 72 | ||||
-rw-r--r-- | arch/x86/lib/efi/reloc_x86_64.c | 66 |
5 files changed, 0 insertions, 259 deletions
diff --git a/arch/x86/lib/efi/Makefile b/arch/x86/lib/efi/Makefile index af4503e1c22..43aadfc996a 100644 --- a/arch/x86/lib/efi/Makefile +++ b/arch/x86/lib/efi/Makefile @@ -7,21 +7,3 @@ obj-$(CONFIG_EFI_STUB) += car.o obj-$(CONFIG_EFI_STUB) += efi.o - -obj-$(CONFIG_EFI_APP) += crt0-efi-ia32.o reloc_ia32.o - -ifneq ($(CONFIG_EFI_STUB),) - -CFLAGS_REMOVE_reloc_ia32.o += -mregparm=3 -CFLAGS_reloc_ia32.o += -fpic -fshort-wchar - -# When building for 64-bit we must remove the i386-specific flags -CFLAGS_REMOVE_reloc_x86_64.o += -mregparm=3 -march=i386 -m32 -CFLAGS_reloc_x86_64.o += -fpic -fshort-wchar - -AFLAGS_REMOVE_crt0-efi-x86_64.o += -mregparm=3 -march=i386 -m32 -AFLAGS_crt0-efi-x86_64.o += -fpic -fshort-wchar - -extra-$(CONFIG_EFI_STUB_32BIT) += crt0-efi-ia32.o reloc_ia32.o -extra-$(CONFIG_EFI_STUB_64BIT) += crt0-efi-x86_64.o reloc_x86_64.o -endif diff --git a/arch/x86/lib/efi/crt0-efi-ia32.S b/arch/x86/lib/efi/crt0-efi-ia32.S deleted file mode 100644 index 30e5eb0c1a3..00000000000 --- a/arch/x86/lib/efi/crt0-efi-ia32.S +++ /dev/null @@ -1,52 +0,0 @@ -/* - * crt0-efi-ia32.S - x86 EFI startup code. - * - * Copyright (C) 1999 Hewlett-Packard Co. - * Contributed by David Mosberger <davidm@hpl.hp.com>. - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - .text - .align 4 - - .globl _start -_start: - pushl %ebp - movl %esp,%ebp - - pushl 12(%ebp) # copy "image" argument - pushl 8(%ebp) # copy "systab" argument - - call 0f -0: popl %eax - movl %eax,%ebx - - addl $image_base-0b,%eax # %eax = ldbase - addl $_DYNAMIC-0b,%ebx # %ebx = _DYNAMIC - - pushl %ebx # pass _DYNAMIC as second argument - pushl %eax # pass ldbase as first argument - call _relocate - popl %ebx - popl %ebx - testl %eax,%eax - jne .exit - call efi_main # call app with "image" and "systab" argument - -.exit: leave - ret - - /* - * hand-craft a dummy .reloc section so EFI knows it's a relocatable - * executable: - */ - .data -dummy: .long 0 - -#define IMAGE_REL_ABSOLUTE 0 - .section .reloc - .long dummy /* Page RVA */ - .long 10 /* Block Size (2*4+2) */ - .word (IMAGE_REL_ABSOLUTE << 12) + 0 /* reloc for dummy */ diff --git a/arch/x86/lib/efi/crt0-efi-x86_64.S b/arch/x86/lib/efi/crt0-efi-x86_64.S deleted file mode 100644 index c5cbf4108b3..00000000000 --- a/arch/x86/lib/efi/crt0-efi-x86_64.S +++ /dev/null @@ -1,51 +0,0 @@ -/* - * crt0-efi-x86_64.S - x86_64 EFI startup code. - * Copyright (C) 1999 Hewlett-Packard Co. - * Contributed by David Mosberger <davidm@hpl.hp.com>. - * Copyright (C) 2005 Intel Co. - * Contributed by Fenghua Yu <fenghua.yu@intel.com>. - * - * All rights reserved. - * SPDX-License-Identifier: BSD-3-Clause - */ - .text - .align 4 - - .globl _start -_start: - subq $8, %rsp - pushq %rcx - pushq %rdx - -0: - lea image_base(%rip), %rdi - lea _DYNAMIC(%rip), %rsi - - popq %rcx - popq %rdx - pushq %rcx - pushq %rdx - call _relocate - - popq %rdi - popq %rsi - - call efi_main - addq $8, %rsp - -.exit: - ret - - /* - * hand-craft a dummy .reloc section so EFI knows it's a relocatable - * executable: - */ - .data -dummy: .long 0 - -#define IMAGE_REL_ABSOLUTE 0 - .section .reloc, "a" -label1: - .long dummy-label1 /* Page RVA */ - .long 10 /* Block Size (2*4+2) */ - .word (IMAGE_REL_ABSOLUTE << 12) + 0 /* reloc for dummy */ diff --git a/arch/x86/lib/efi/reloc_ia32.c b/arch/x86/lib/efi/reloc_ia32.c deleted file mode 100644 index 4d6825515d1..00000000000 --- a/arch/x86/lib/efi/reloc_ia32.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * reloc_ia32.c - position independent x86 ELF shared object relocator - * Copyright (C) 1999 Hewlett-Packard Co. - * Contributed by David Mosberger <davidm@hpl.hp.com>. - * - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include <common.h> -#include <efi.h> -#include <elf.h> -#include <asm/elf.h> - -efi_status_t _relocate(long ldbase, Elf32_Dyn *dyn, efi_handle_t image, - struct efi_system_table *systab) -{ - long relsz = 0, relent = 0; - Elf32_Rel *rel = 0; - unsigned long *addr; - int i; - - for (i = 0; dyn[i].d_tag != DT_NULL; ++i) { - switch (dyn[i].d_tag) { - case DT_REL: - rel = (Elf32_Rel *)((unsigned long)dyn[i].d_un.d_ptr + - ldbase); - break; - - case DT_RELSZ: - relsz = dyn[i].d_un.d_val; - break; - - case DT_RELENT: - relent = dyn[i].d_un.d_val; - break; - - case DT_RELA: - break; - - default: - break; - } - } - - if (!rel && relent == 0) - return EFI_SUCCESS; - - if (!rel || relent == 0) - return EFI_LOAD_ERROR; - - while (relsz > 0) { - /* apply the relocs */ - switch (ELF32_R_TYPE(rel->r_info)) { - case R_386_NONE: - break; - - case R_386_RELATIVE: - addr = (unsigned long *)(ldbase + rel->r_offset); - *addr += ldbase; - break; - - default: - break; - } - rel = (Elf32_Rel *)((char *)rel + relent); - relsz -= relent; - } - - return EFI_SUCCESS; -} diff --git a/arch/x86/lib/efi/reloc_x86_64.c b/arch/x86/lib/efi/reloc_x86_64.c deleted file mode 100644 index 5f71f2ac8a3..00000000000 --- a/arch/x86/lib/efi/reloc_x86_64.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * reloc_x86_64.c - position independent x86_64 ELF shared object relocator - * Copyright (C) 1999 Hewlett-Packard Co. - * Contributed by David Mosberger <davidm@hpl.hp.com>. - * Copyright (C) 2005 Intel Co. - * Contributed by Fenghua Yu <fenghua.yu@intel.com>. - * - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include <common.h> -#include <efi.h> -#include <elf.h> -#include <asm/elf.h> - -efi_status_t _relocate(long ldbase, Elf64_Dyn *dyn, efi_handle_t image, - struct efi_system_table *systab) -{ - long relsz = 0, relent = 0; - Elf64_Rel *rel = 0; - unsigned long *addr; - int i; - - for (i = 0; dyn[i].d_tag != DT_NULL; ++i) { - switch (dyn[i].d_tag) { - case DT_RELA: - rel = (Elf64_Rel *) - ((unsigned long)dyn[i].d_un.d_ptr + ldbase); - break; - case DT_RELASZ: - relsz = dyn[i].d_un.d_val; - break; - case DT_RELAENT: - relent = dyn[i].d_un.d_val; - break; - default: - break; - } - } - - if (!rel && relent == 0) - return EFI_SUCCESS; - - if (!rel || relent == 0) - return EFI_LOAD_ERROR; - - while (relsz > 0) { - /* apply the relocs */ - switch (ELF64_R_TYPE(rel->r_info)) { - case R_X86_64_NONE: - break; - case R_X86_64_RELATIVE: - addr = (unsigned long *)(ldbase + rel->r_offset); - *addr += ldbase; - break; - default: - break; - } - rel = (Elf64_Rel *)((char *)rel + relent); - relsz -= relent; - } - - return EFI_SUCCESS; -} |