summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2021-12-15 08:25:19 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2021-12-15 08:25:19 +0100
commit3dd4b2040a3a4011859d92d1cd7818837c02104d (patch)
tree78dc8a82705499e94192bf2ab47f03e99e0a7463
parent3913a7c1833e31a47c2daae69275b730c58a72a3 (diff)
parentba80c6eaec11bd522db970ba9c4849dcb349c994 (diff)
downloadbarebox-3dd4b2040a3a4011859d92d1cd7818837c02104d.tar.gz
barebox-3dd4b2040a3a4011859d92d1cd7818837c02104d.tar.xz
Merge branch 'for-next/x86'
-rw-r--r--arch/kvx/Makefile2
-rw-r--r--arch/mips/Makefile2
-rw-r--r--arch/riscv/Makefile1
-rw-r--r--arch/x86/Makefile23
-rw-r--r--arch/x86/mach-efi/crt0-efi-x86_64.S6
-rw-r--r--arch/x86/mach-efi/reloc_x86_64.c4
6 files changed, 12 insertions, 26 deletions
diff --git a/arch/kvx/Makefile b/arch/kvx/Makefile
index 13c4e24319..f29eeef921 100644
--- a/arch/kvx/Makefile
+++ b/arch/kvx/Makefile
@@ -8,7 +8,7 @@ ifeq ($(CROSS_COMPILE),)
CROSS_COMPILE := kvx-elf-
endif
-DEFAULT_CFLAGS := -nostdlib -fno-builtin -fstrict-align -g
+DEFAULT_CFLAGS := -fno-builtin -fstrict-align -g
DEFAULT_CFLAGS += -DTEXT_BASE=$(CONFIG_TEXT_BASE)
LIBGCC_PATH = $(dir $(shell $(CC) $(KBUILD_CFLAGS) --print-libgcc-file-name))
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 4eb6ba7721..7866951944 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -72,8 +72,6 @@ KBUILD_BINARY := barebox.bin
KBUILD_TARGET := barebox.bin
endif
-LDFLAGS_barebox += -nostdlib
-
machine-$(CONFIG_MACH_MIPS_MALTA) := malta
machine-$(CONFIG_MACH_MIPS_AR231X) := ar231x
machine-$(CONFIG_MACH_MIPS_ATH79) := ath79
diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
index 0b1278936d..23ea6178a2 100644
--- a/arch/riscv/Makefile
+++ b/arch/riscv/Makefile
@@ -17,7 +17,6 @@ PBL_CPPFLAGS += $(riscv-cflags-y)
LDFLAGS_pbl += $(riscv-ldflags-y)
cflags-y += $(riscv-cflags-y)
-LDFLAGS_barebox += -nostdlib
LDFLAGS_barebox += $(riscv-ldflags-y)
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 532246647b..a0ce8c17f1 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -28,7 +28,9 @@ endif
ifndef CONFIG_MODULES
# Add cleanup flags
-ifneq ($(CONFIG_X86_EFI),y)
+ifeq ($(CONFIG_X86_EFI),y)
+LDFLAGS_barebox += -shared -Bsymbolic -znocombreloc
+else
KBUILD_CPPFLAGS += -fdata-sections -ffunction-sections
LDFLAGS_barebox += -static --gc-sections
endif
@@ -52,25 +54,16 @@ common-y += arch/x86/lib/
lds-$(CONFIG_X86_32) := arch/x86/mach-efi/elf_ia32_efi.lds
lds-$(CONFIG_X86_64) := arch/x86/mach-efi/elf_x86_64_efi.lds
-cmd_barebox__ ?= $(LD) $(KBUILD_LDFLAGS) $(LDFLAGS_barebox) -o $@ \
- -T $(lds-y) \
- -shared -Bsymbolic -nostdlib -znocombreloc \
- --whole-archive $(BAREBOX_OBJS) \
- --no-whole-archive \
- $(filter-out $(BAREBOX_LDS) $(BAREBOX_OBJS) FORCE ,$^)
-
-quiet_cmd_efi_image = EFI-IMG $@
- cmd_efi_image = $(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic \
- -j .dynsym -j .rel -j .rela -j .reloc -j __barebox_initcalls \
- -j __barebox_exitcalls -j __barebox_cmd -j .barebox_magicvar \
- -j .bbenv.* -j .bblogo.* --target=$(TARGET) $< $@
-
KBUILD_BINARY := barebox
KBUILD_LDFLAGS := --no-undefined
+OBJCOPYFLAGS_barebox.efi = \
+ -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel -j .rela \
+ -j .reloc -j .bbenv.* -j .bblogo.* --target=$(TARGET)
+
barebox.efi: $(KBUILD_BINARY) FORCE
- $(call if_changed,efi_image)
+ $(call if_changed,objcopy)
KBUILD_IMAGE := barebox.efi
diff --git a/arch/x86/mach-efi/crt0-efi-x86_64.S b/arch/x86/mach-efi/crt0-efi-x86_64.S
index aa03106e9c..d23c1fb2d6 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 e83bacb302..f015ae047d 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;