summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/config.mk4
-rw-r--r--arch/arm/cpu/armv7/Kconfig2
-rw-r--r--arch/arm/cpu/armv7/nonsec_virt.S2
-rw-r--r--arch/arm/cpu/armv8/u-boot.lds24
-rw-r--r--arch/arm/cpu/u-boot.lds36
-rw-r--r--arch/arm/mach-zynq/u-boot.lds36
-rw-r--r--arch/riscv/cpu/ax25/u-boot.lds26
-rw-r--r--arch/sandbox/config.mk3
-rw-r--r--arch/sandbox/cpu/u-boot.lds9
-rw-r--r--arch/x86/config.mk2
-rw-r--r--arch/x86/cpu/start.S2
-rw-r--r--arch/x86/cpu/start64.S2
-rw-r--r--arch/x86/cpu/u-boot-64.lds37
-rw-r--r--arch/x86/cpu/u-boot.lds34
-rw-r--r--arch/x86/include/asm/elf.h45
-rw-r--r--arch/x86/lib/reloc_ia32_efi.c1
-rw-r--r--arch/x86/lib/reloc_x86_64_efi.c1
17 files changed, 145 insertions, 121 deletions
diff --git a/arch/arm/config.mk b/arch/arm/config.mk
index efafc69d1b..f25603109e 100644
--- a/arch/arm/config.mk
+++ b/arch/arm/config.mk
@@ -134,11 +134,11 @@ endif
ifdef CONFIG_ARM64
OBJCOPYFLAGS += -j .text -j .secure_text -j .secure_data -j .rodata -j .data \
-j .u_boot_list -j .rela.dyn -j .got -j .got.plt \
- -j .binman_sym_table
+ -j .binman_sym_table -j .text_rest
else
OBJCOPYFLAGS += -j .text -j .secure_text -j .secure_data -j .rodata -j .hash \
-j .data -j .got -j .got.plt -j .u_boot_list -j .rel.dyn \
- -j .binman_sym_table
+ -j .binman_sym_table -j .text_rest
endif
# if a dtb section exists we always have to include it
diff --git a/arch/arm/cpu/armv7/Kconfig b/arch/arm/cpu/armv7/Kconfig
index 37a0be932e..73d57a2aae 100644
--- a/arch/arm/cpu/armv7/Kconfig
+++ b/arch/arm/cpu/armv7/Kconfig
@@ -53,7 +53,7 @@ config ARMV7_PSCI_NR_CPUS
config ARMV7_LPAE
bool "Use LPAE page table format" if EXPERT
depends on CPU_V7A
- default n
+ default y if ARMV7_VIRT
---help---
Say Y here to use the long descriptor page table format. This is
required if U-Boot runs in HYP mode.
diff --git a/arch/arm/cpu/armv7/nonsec_virt.S b/arch/arm/cpu/armv7/nonsec_virt.S
index 56bdba1d38..1773fae205 100644
--- a/arch/arm/cpu/armv7/nonsec_virt.S
+++ b/arch/arm/cpu/armv7/nonsec_virt.S
@@ -80,6 +80,8 @@ _secure_monitor:
#ifdef CONFIG_ARMV7_VIRT
orreq r5, r5, #0x100 @ allow HVC instruction
moveq r6, #HYP_MODE @ Enter the kernel as HYP
+ mrseq r3, sp_svc
+ msreq sp_hyp, r3 @ migrate SP
#endif
mcr p15, 0, r5, c1, c1, 0 @ write SCR (with NS bit set)
diff --git a/arch/arm/cpu/armv8/u-boot.lds b/arch/arm/cpu/armv8/u-boot.lds
index eb926b3c14..53de80f745 100644
--- a/arch/arm/cpu/armv8/u-boot.lds
+++ b/arch/arm/cpu/armv8/u-boot.lds
@@ -25,6 +25,19 @@ SECTIONS
{
*(.__image_copy_start)
CPUDIR/start.o (.text*)
+ }
+
+ /* This needs to come before *(.text*) */
+ .efi_runtime : {
+ __efi_runtime_start = .;
+ *(.text.efi_runtime*)
+ *(.rodata.efi_runtime*)
+ *(.data.efi_runtime*)
+ __efi_runtime_stop = .;
+ }
+
+ .text_rest :
+ {
*(.text*)
}
@@ -98,17 +111,10 @@ SECTIONS
. = ALIGN(8);
- .efi_runtime : {
- __efi_runtime_start = .;
- *(efi_runtime_text)
- *(efi_runtime_data)
- __efi_runtime_stop = .;
- }
-
.efi_runtime_rel : {
__efi_runtime_rel_start = .;
- *(.relaefi_runtime_text)
- *(.relaefi_runtime_data)
+ *(.rel*.efi_runtime)
+ *(.rel*.efi_runtime.*)
__efi_runtime_rel_stop = .;
}
diff --git a/arch/arm/cpu/u-boot.lds b/arch/arm/cpu/u-boot.lds
index 4157374d21..834dc99554 100644
--- a/arch/arm/cpu/u-boot.lds
+++ b/arch/arm/cpu/u-boot.lds
@@ -43,6 +43,25 @@ SECTIONS
*(.__image_copy_start)
*(.vectors)
CPUDIR/start.o (.text*)
+ }
+
+ /* This needs to come before *(.text*) */
+ .__efi_runtime_start : {
+ *(.__efi_runtime_start)
+ }
+
+ .efi_runtime : {
+ *(.text.efi_runtime*)
+ *(.rodata.efi_runtime*)
+ *(.data.efi_runtime*)
+ }
+
+ .__efi_runtime_stop : {
+ *(.__efi_runtime_stop)
+ }
+
+ .text_rest :
+ {
*(.text*)
}
@@ -136,27 +155,14 @@ SECTIONS
. = ALIGN(4);
- .__efi_runtime_start : {
- *(.__efi_runtime_start)
- }
-
- .efi_runtime : {
- *(efi_runtime_text)
- *(efi_runtime_data)
- }
-
- .__efi_runtime_stop : {
- *(.__efi_runtime_stop)
- }
-
.efi_runtime_rel_start :
{
*(.__efi_runtime_rel_start)
}
.efi_runtime_rel : {
- *(.relefi_runtime_text)
- *(.relefi_runtime_data)
+ *(.rel*.efi_runtime)
+ *(.rel*.efi_runtime.*)
}
.efi_runtime_rel_stop :
diff --git a/arch/arm/mach-zynq/u-boot.lds b/arch/arm/mach-zynq/u-boot.lds
index ec9a0a0161..91c32e89e8 100644
--- a/arch/arm/mach-zynq/u-boot.lds
+++ b/arch/arm/mach-zynq/u-boot.lds
@@ -19,6 +19,25 @@ SECTIONS
*(.__image_copy_start)
*(.vectors)
CPUDIR/start.o (.text*)
+ }
+
+ /* This needs to come before *(.text*) */
+ .__efi_runtime_start : {
+ *(.__efi_runtime_start)
+ }
+
+ .efi_runtime : {
+ *(.text.efi_runtime*)
+ *(.rodata.efi_runtime*)
+ *(.data.efi_runtime*)
+ }
+
+ .__efi_runtime_stop : {
+ *(.__efi_runtime_stop)
+ }
+
+ .text_rest :
+ {
*(.text*)
}
@@ -41,27 +60,14 @@ SECTIONS
. = ALIGN(4);
- .__efi_runtime_start : {
- *(.__efi_runtime_start)
- }
-
- .efi_runtime : {
- *(efi_runtime_text)
- *(efi_runtime_data)
- }
-
- .__efi_runtime_stop : {
- *(.__efi_runtime_stop)
- }
-
.efi_runtime_rel_start :
{
*(.__efi_runtime_rel_start)
}
.efi_runtime_rel : {
- *(.relefi_runtime_text)
- *(.relefi_runtime_data)
+ *(.rel*.efi_runtime)
+ *(.rel*.efi_runtime.*)
}
.efi_runtime_rel_stop :
diff --git a/arch/riscv/cpu/ax25/u-boot.lds b/arch/riscv/cpu/ax25/u-boot.lds
index 1589babf6c..3cc89746b1 100644
--- a/arch/riscv/cpu/ax25/u-boot.lds
+++ b/arch/riscv/cpu/ax25/u-boot.lds
@@ -12,7 +12,20 @@ SECTIONS
.text :
{
arch/riscv/cpu/ax25/start.o (.text)
- *(.text)
+ }
+
+ /* This needs to come before *(.text*) */
+ .efi_runtime : {
+ __efi_runtime_start = .;
+ *(.text.efi_runtime*)
+ *(.rodata.efi_runtime*)
+ *(.data.efi_runtime*)
+ __efi_runtime_stop = .;
+ }
+
+ .text_rest :
+ {
+ *(.text*)
}
. = ALIGN(4);
@@ -39,17 +52,10 @@ SECTIONS
. = ALIGN(4);
- .efi_runtime : {
- __efi_runtime_start = .;
- *(efi_runtime_text)
- *(efi_runtime_data)
- __efi_runtime_stop = .;
- }
-
.efi_runtime_rel : {
__efi_runtime_rel_start = .;
- *(.relaefi_runtime_text)
- *(.relaefi_runtime_data)
+ *(.rel*.efi_runtime)
+ *(.rel*.efi_runtime.*)
__efi_runtime_rel_stop = .;
}
diff --git a/arch/sandbox/config.mk b/arch/sandbox/config.mk
index 2babcde881..5e7077bfe7 100644
--- a/arch/sandbox/config.mk
+++ b/arch/sandbox/config.mk
@@ -5,6 +5,9 @@ PLATFORM_CPPFLAGS += -D__SANDBOX__ -U_FORTIFY_SOURCE
PLATFORM_CPPFLAGS += -DCONFIG_ARCH_MAP_SYSMEM
PLATFORM_LIBS += -lrt
+LDFLAGS_FINAL += --gc-sections
+PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections
+
# Define this to avoid linking with SDL, which requires SDL libraries
# This can solve 'sdl-config: Command not found' errors
ifneq ($(NO_SDL),)
diff --git a/arch/sandbox/cpu/u-boot.lds b/arch/sandbox/cpu/u-boot.lds
index 3a6cf55eb9..727bcc3598 100644
--- a/arch/sandbox/cpu/u-boot.lds
+++ b/arch/sandbox/cpu/u-boot.lds
@@ -24,8 +24,9 @@ SECTIONS
}
.efi_runtime : {
- *(efi_runtime_text)
- *(efi_runtime_data)
+ *(.text.efi_runtime*)
+ *(.rodata.efi_runtime*)
+ *(.data.efi_runtime*)
}
.__efi_runtime_stop : {
@@ -38,8 +39,8 @@ SECTIONS
}
.efi_runtime_rel : {
- *(.relefi_runtime_text)
- *(.relefi_runtime_data)
+ *(.rel*.efi_runtime)
+ *(.rel*.efi_runtime.*)
}
.efi_runtime_rel_stop :
diff --git a/arch/x86/config.mk b/arch/x86/config.mk
index 5f77f98e60..586e11a0dd 100644
--- a/arch/x86/config.mk
+++ b/arch/x86/config.mk
@@ -23,6 +23,8 @@ endif
ifeq ($(IS_32BIT),y)
PLATFORM_CPPFLAGS += -march=i386 -m32
+# TODO: These break on x86_64; need to debug further
+PLATFORM_RELFLAGS += -fdata-sections
else
PLATFORM_CPPFLAGS += $(if $(CONFIG_SPL_BUILD),,-fpic) -fno-common -m64
endif
diff --git a/arch/x86/cpu/start.S b/arch/x86/cpu/start.S
index e4e997e3e8..e1f634ffcd 100644
--- a/arch/x86/cpu/start.S
+++ b/arch/x86/cpu/start.S
@@ -17,7 +17,7 @@
#include <generated/generic-asm-offsets.h>
#include <generated/asm-offsets.h>
-.section .text
+.section .text.start
.code32
.globl _start
.type _start, @function
diff --git a/arch/x86/cpu/start64.S b/arch/x86/cpu/start64.S
index 234482b793..a473fd166d 100644
--- a/arch/x86/cpu/start64.S
+++ b/arch/x86/cpu/start64.S
@@ -8,7 +8,7 @@
#include <config.h>
-.section .text
+.section .text.start
.code64
.globl _start
.type _start, @function
diff --git a/arch/x86/cpu/u-boot-64.lds b/arch/x86/cpu/u-boot-64.lds
index 3f38681669..862aa2d35e 100644
--- a/arch/x86/cpu/u-boot-64.lds
+++ b/arch/x86/cpu/u-boot-64.lds
@@ -17,6 +17,23 @@ SECTIONS
. = CONFIG_SYS_TEXT_BASE; /* Location of bootcode in flash */
__text_start = .;
+
+ .text.start : { *(.text.start); }
+
+ .__efi_runtime_start : {
+ *(.__efi_runtime_start)
+ }
+
+ .efi_runtime : {
+ *(.text.efi_runtime*)
+ *(.rodata.efi_runtime*)
+ *(.data.efi_runtime*)
+ }
+
+ .__efi_runtime_stop : {
+ *(.__efi_runtime_stop)
+ }
+
.text : { *(.text*); }
. = ALIGN(4);
@@ -27,7 +44,10 @@ SECTIONS
}
. = ALIGN(4);
- .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
+ .rodata : {
+ *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*)))
+ KEEP(*(.rodata.efi.init));
+ }
. = ALIGN(4);
.data : { *(.data*) }
@@ -38,6 +58,21 @@ SECTIONS
. = ALIGN(4);
.got : { *(.got*) }
+ .efi_runtime_rel_start :
+ {
+ *(.__efi_runtime_rel_start)
+ }
+
+ .efi_runtime_rel : {
+ *(.rel*.efi_runtime)
+ *(.rel*.efi_runtime.*)
+ }
+
+ .efi_runtime_rel_stop :
+ {
+ *(.__efi_runtime_rel_stop)
+ }
+
. = ALIGN(4);
__data_end = .;
__init_end = .;
diff --git a/arch/x86/cpu/u-boot.lds b/arch/x86/cpu/u-boot.lds
index f0719368ba..a1cc19ce4c 100644
--- a/arch/x86/cpu/u-boot.lds
+++ b/arch/x86/cpu/u-boot.lds
@@ -17,6 +17,23 @@ SECTIONS
. = CONFIG_SYS_TEXT_BASE; /* Location of bootcode in flash */
__text_start = .;
+
+ .text.start : { *(.text.start); }
+
+ .__efi_runtime_start : {
+ *(.__efi_runtime_start)
+ }
+
+ .efi_runtime : {
+ *(.text.efi_runtime*)
+ *(.rodata.efi_runtime*)
+ *(.data.efi_runtime*)
+ }
+
+ .__efi_runtime_stop : {
+ *(.__efi_runtime_stop)
+ }
+
.text : { *(.text*); }
. = ALIGN(4);
@@ -43,27 +60,14 @@ SECTIONS
. = ALIGN(4);
- .__efi_runtime_start : {
- *(.__efi_runtime_start)
- }
-
- .efi_runtime : {
- *(efi_runtime_text)
- *(efi_runtime_data)
- }
-
- .__efi_runtime_stop : {
- *(.__efi_runtime_stop)
- }
-
.efi_runtime_rel_start :
{
*(.__efi_runtime_rel_start)
}
.efi_runtime_rel : {
- *(.relefi_runtime_text)
- *(.relefi_runtime_data)
+ *(.rel*.efi_runtime)
+ *(.rel*.efi_runtime.*)
}
.efi_runtime_rel_stop :
diff --git a/arch/x86/include/asm/elf.h b/arch/x86/include/asm/elf.h
deleted file mode 100644
index 7ae9c7d6da..0000000000
--- a/arch/x86/include/asm/elf.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Brought in from Linux 4.1, removed things not useful to U-Boot.
- * The definitions perhaps came from the GNU Library which is GPL.
- */
-
-#ifndef _ASM_X86_ELF_H
-#define _ASM_X86_ELF_H
-
-/* ELF register definitions */
-#define R_386_NONE 0
-#define R_386_32 1
-#define R_386_PC32 2
-#define R_386_GOT32 3
-#define R_386_PLT32 4
-#define R_386_COPY 5
-#define R_386_GLOB_DAT 6
-#define R_386_JMP_SLOT 7
-#define R_386_RELATIVE 8
-#define R_386_GOTOFF 9
-#define R_386_GOTPC 10
-#define R_386_NUM 11
-
-/* x86-64 relocation types */
-#define R_X86_64_NONE 0 /* No reloc */
-#define R_X86_64_64 1 /* Direct 64 bit */
-#define R_X86_64_PC32 2 /* PC relative 32 bit signed */
-#define R_X86_64_GOT32 3 /* 32 bit GOT entry */
-#define R_X86_64_PLT32 4 /* 32 bit PLT address */
-#define R_X86_64_COPY 5 /* Copy symbol at runtime */
-#define R_X86_64_GLOB_DAT 6 /* Create GOT entry */
-#define R_X86_64_JUMP_SLOT 7 /* Create PLT entry */
-#define R_X86_64_RELATIVE 8 /* Adjust by program base */
-/* 32 bit signed pc relative offset to GOT */
-#define R_X86_64_GOTPCREL 9
-#define R_X86_64_32 10 /* Direct 32 bit zero extended */
-#define R_X86_64_32S 11 /* Direct 32 bit sign extended */
-#define R_X86_64_16 12 /* Direct 16 bit zero extended */
-#define R_X86_64_PC16 13 /* 16 bit sign extended pc relative */
-#define R_X86_64_8 14 /* Direct 8 bit sign extended */
-#define R_X86_64_PC8 15 /* 8 bit sign extended pc relative */
-
-#define R_X86_64_NUM 16
-
-#endif
diff --git a/arch/x86/lib/reloc_ia32_efi.c b/arch/x86/lib/reloc_ia32_efi.c
index a262533c0f..d56cd50bd9 100644
--- a/arch/x86/lib/reloc_ia32_efi.c
+++ b/arch/x86/lib/reloc_ia32_efi.c
@@ -10,7 +10,6 @@
#include <common.h>
#include <efi.h>
#include <elf.h>
-#include <asm/elf.h>
efi_status_t EFIAPI _relocate(long ldbase, Elf32_Dyn *dyn)
{
diff --git a/arch/x86/lib/reloc_x86_64_efi.c b/arch/x86/lib/reloc_x86_64_efi.c
index 59d6f8d3d3..2694de7110 100644
--- a/arch/x86/lib/reloc_x86_64_efi.c
+++ b/arch/x86/lib/reloc_x86_64_efi.c
@@ -12,7 +12,6 @@
#include <common.h>
#include <efi.h>
#include <elf.h>
-#include <asm/elf.h>
efi_status_t EFIAPI _relocate(long ldbase, Elf64_Dyn *dyn)
{