]> git.sur5r.net Git - u-boot/commitdiff
x86: Move efi .S files into the 'lib' directory
authorSimon Glass <sjg@chromium.org>
Mon, 7 Nov 2016 15:47:14 +0000 (08:47 -0700)
committerAlexander Graf <agraf@suse.de>
Mon, 14 Nov 2016 22:24:04 +0000 (23:24 +0100)
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>
12 files changed:
Makefile
arch/x86/config.mk
arch/x86/lib/Makefile
arch/x86/lib/crt0_ia32_efi.S [new file with mode: 0644]
arch/x86/lib/crt0_x86_64_efi.S [new file with mode: 0644]
arch/x86/lib/efi/Makefile
arch/x86/lib/efi/crt0-efi-ia32.S [deleted file]
arch/x86/lib/efi/crt0-efi-x86_64.S [deleted file]
arch/x86/lib/efi/reloc_ia32.c [deleted file]
arch/x86/lib/efi/reloc_x86_64.c [deleted file]
arch/x86/lib/reloc_ia32_efi.c [new file with mode: 0644]
arch/x86/lib/reloc_x86_64_efi.c [new file with mode: 0644]

index bb108d476c3ba2f0274bc5095827d3c1760623bb..96ddc59ca668f455c5de64a9306d9dca4db51683 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1140,7 +1140,7 @@ quiet_cmd_u-boot_payload ?= LD      $@
       cmd_u-boot_payload ?= $(LD) $(LDFLAGS_EFI_PAYLOAD) -o $@ \
       -T u-boot-payload.lds arch/x86/cpu/call32.o \
       lib/efi/efi.o lib/efi/efi_stub.o u-boot.bin.o \
-      $(addprefix arch/$(ARCH)/lib/efi/,$(EFISTUB))
+      $(addprefix arch/$(ARCH)/lib/,$(EFISTUB))
 
 u-boot-payload: u-boot.bin.o u-boot-payload.lds FORCE
        $(call if_changed,u-boot_payload)
index a17abbbffd1162fb8a296abe7b589183bce95443..12a8d73f87f78a6ad508d525b392cd3439e4da19 100644 (file)
@@ -46,7 +46,7 @@ endif
 EFIPAYLOAD_BFDARCH = i386
 
 LDSCRIPT_EFI := $(srctree)/arch/x86/lib/elf_$(EFIARCH)_efi.lds
-EFISTUB := crt0-efi-$(EFIARCH).o reloc_$(EFIARCH).o
+EFISTUB := crt0_$(EFIARCH)_efi.o reloc_$(EFIARCH)_efi.o
 OBJCOPYFLAGS_EFI += --target=efi-app-$(EFIARCH)
 
 CPPFLAGS_REMOVE_crt0-efi-$(EFIARCH).o += $(CFLAGS_NON_EFI)
index b9c29226bdb3a93928224c900d9cfa9298b86907..aad6555a713fd5e0f2d242d390d93c26002775ed 100644 (file)
@@ -44,3 +44,21 @@ NORMAL_LIBGCC = $(shell $(CC) $(PLATFORM_CPPFLAGS) -print-libgcc-file-name)
 OBJCOPYFLAGS := --prefix-symbols=__normal_
 $(obj)/lib.a: $(NORMAL_LIBGCC) FORCE
        $(call if_changed,objcopy)
+
+obj-$(CONFIG_EFI_APP) += crt0_ia32_efi.o reloc_ia32_efi.o
+
+ifneq ($(CONFIG_EFI_STUB),)
+
+CFLAGS_REMOVE_reloc_ia32_efi.o += -mregparm=3
+CFLAGS_reloc_ia32_efi.o += -fpic -fshort-wchar
+
+# When building for 64-bit we must remove the i386-specific flags
+CFLAGS_REMOVE_reloc_x86_64_efi.o += -mregparm=3 -march=i386 -m32
+CFLAGS_reloc_x86_64_efi.o += -fpic -fshort-wchar
+
+AFLAGS_REMOVE_crt0_x86_64_efi.o += -mregparm=3 -march=i386 -m32
+AFLAGS_crt0_x86_64_efi.o += -fpic -fshort-wchar
+
+extra-$(CONFIG_EFI_STUB_32BIT) += crt0_ia32_efi.o reloc_ia32_efi.o
+extra-$(CONFIG_EFI_STUB_64BIT) += crt0_x86_64_efi.o reloc_x86_64_efi.o
+endif
diff --git a/arch/x86/lib/crt0_ia32_efi.S b/arch/x86/lib/crt0_ia32_efi.S
new file mode 100644 (file)
index 0000000..30e5eb0
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * 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/crt0_x86_64_efi.S b/arch/x86/lib/crt0_x86_64_efi.S
new file mode 100644 (file)
index 0000000..c5cbf41
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * 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 */
index af4503e1c22c695fa785cc2c323005b5afe4c056..43aadfc996a1c892f7788ba10cdcb476e992ec0e 100644 (file)
@@ -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 (file)
index 30e5eb0..0000000
+++ /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 (file)
index c5cbf41..0000000
+++ /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 (file)
index 4d68255..0000000
+++ /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 (file)
index 5f71f2a..0000000
+++ /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;
-}
diff --git a/arch/x86/lib/reloc_ia32_efi.c b/arch/x86/lib/reloc_ia32_efi.c
new file mode 100644 (file)
index 0000000..4d68255
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * 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/reloc_x86_64_efi.c b/arch/x86/lib/reloc_x86_64_efi.c
new file mode 100644 (file)
index 0000000..5f71f2a
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * 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;
+}