diff options
author | Subrata Banik <subratabanik@google.com> | 2024-05-16 15:19:22 +0530 |
---|---|---|
committer | Subrata Banik <subratabanik@google.com> | 2024-05-24 08:10:56 +0000 |
commit | 36e2b97e4cdaeb065265ed79b77f130747308b61 (patch) | |
tree | 837f3e011868e35113480ddffeff993892848c67 /payloads/libpayload | |
parent | 814ae3b05507726938b0f9a9ba0c3a2a37e7b295 (diff) |
libpayload: Inject head.S into libc, remove separate class
Integrate head.S directly into libc and remove all instances of head.o.
* Drop 'separate class' entry for head.S.
* Drop special treament for head.o inside lpgcc.
* Change the .text in `x86/head.S` to `.section .text._entry`.
* Drop arch/mock/head.c, initially added as a dummy file.
Change-Id: I156d781908fcc38d455bbf9f2c29e5ab95c7775a
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/82478
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'payloads/libpayload')
-rw-r--r-- | payloads/libpayload/Makefile.mk | 8 | ||||
-rw-r--r-- | payloads/libpayload/arch/arm/Makefile.mk | 3 | ||||
-rw-r--r-- | payloads/libpayload/arch/arm64/Makefile.mk | 5 | ||||
-rw-r--r-- | payloads/libpayload/arch/mock/Makefile.mk | 2 | ||||
-rw-r--r-- | payloads/libpayload/arch/mock/head.c | 3 | ||||
-rw-r--r-- | payloads/libpayload/arch/x86/Makefile.mk | 2 | ||||
-rw-r--r-- | payloads/libpayload/arch/x86/head.S | 2 | ||||
-rwxr-xr-x | payloads/libpayload/bin/lpgcc | 17 |
8 files changed, 8 insertions, 34 deletions
diff --git a/payloads/libpayload/Makefile.mk b/payloads/libpayload/Makefile.mk index afaa06dd3d..d654995889 100644 --- a/payloads/libpayload/Makefile.mk +++ b/payloads/libpayload/Makefile.mk @@ -56,7 +56,6 @@ classes-$(CONFIG_LP_REMOTEGDB) += libgdb classes-$(CONFIG_LP_VBOOT_LIB) += vboot_fw classes-$(CONFIG_LP_VBOOT_LIB) += tlcl libraries := $(classes-y) -classes-y += head.o subdirs-y := arch/$(ARCHDIR-y) subdirs-y += crypto libc drivers libpci gdb @@ -97,7 +96,7 @@ $(obj)/libpayload-config.h: $(KCONFIG_AUTOHEADER) $(obj)/libpayload.config cmp $@ $< 2>/dev/null || cp $< $@ library-targets = $(addsuffix .a,$(addprefix $(obj)/,$(libraries))) $(obj)/libpayload.a -lib: $$(library-targets) $(obj)/head.o +lib: $$(library-targets) extract_nth=$(word $(1), $(subst |, ,$(2))) @@ -116,17 +115,12 @@ $(obj)/%.a: $$(%-objs) printf " AR $(subst $(CURDIR)/,,$(@))\n" printf "create $@\n$(foreach objc,$(filter-out %.a,$^),addmod $(objc)\n)$(foreach lib,$(filter %.a,$^),addlib $(lib)\n)save\nend\n" | $(AR) -M -$(obj)/head.o: $(obj)/arch/$(ARCHDIR-y)/head.head.o.o - printf " CP $(subst $(CURDIR)/,,$(@))\n" - cp $^ $@ - install: real-target printf " INSTALL $(DESTDIR)/libpayload/lib\n" install -m 755 -d $(DESTDIR)/libpayload/lib install -m 644 $(library-targets) $(DESTDIR)/libpayload/lib/ install -m 644 arch/$(ARCHDIR-y)/libpayload.ldscript $(DESTDIR)/libpayload/lib/ install -m 755 -d $(DESTDIR)/libpayload/lib/$(ARCHDIR-y) - install -m 644 $(obj)/head.o $(DESTDIR)/libpayload/lib/$(ARCHDIR-y) printf " INSTALL $(DESTDIR)/libpayload/include\n" install -m 755 -d $(DESTDIR)/libpayload/include find include -type d -exec install -m755 -d $(DESTDIR)/libpayload/{} \; diff --git a/payloads/libpayload/arch/arm/Makefile.mk b/payloads/libpayload/arch/arm/Makefile.mk index f71138baaa..e6574e7782 100644 --- a/payloads/libpayload/arch/arm/Makefile.mk +++ b/payloads/libpayload/arch/arm/Makefile.mk @@ -29,7 +29,7 @@ CFLAGS += -mthumb -march=armv7-a arm_asm_flags = -Wa,-mthumb -Wa,-mimplicit-it=always -Wa,-mno-warn-deprecated -head.o-y += head.S +libc-y += head.S libc-y += eabi_compat.c libc-y += main.c sysinfo.c libc-y += timer.c coreboot.c util.S @@ -44,5 +44,4 @@ libc-$(CONFIG_LP_GPL) += memcpy.S memset.S memmove.S libgdb-y += gdb.c # Add other classes here when you put assembly files into them! -head.o-S-ccopts += $(arm_asm_flags) libc-S-ccopts += $(arm_asm_flags) diff --git a/payloads/libpayload/arch/arm64/Makefile.mk b/payloads/libpayload/arch/arm64/Makefile.mk index b478c77bce..d6cc51efdf 100644 --- a/payloads/libpayload/arch/arm64/Makefile.mk +++ b/payloads/libpayload/arch/arm64/Makefile.mk @@ -29,7 +29,7 @@ CFLAGS += -march=armv8-a arm64_asm_flags = -head.o-y += head.S +libc-y += head.S libc-y += main.c sysinfo.c libc-y += timer.c coreboot.c util.S libc-y += virtual.c @@ -42,5 +42,4 @@ libc-y += mmu.c libgdb-y += gdb.c # Add other classes here when you put assembly files into them! - head.o-S-ccopts += $(arm64_asm_flags) - libc-S-ccopts += $(arm64_asm_flags) +libc-S-ccopts += $(arm64_asm_flags) diff --git a/payloads/libpayload/arch/mock/Makefile.mk b/payloads/libpayload/arch/mock/Makefile.mk index e3f10a69ed..0b418f0d97 100644 --- a/payloads/libpayload/arch/mock/Makefile.mk +++ b/payloads/libpayload/arch/mock/Makefile.mk @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-only -head.o-y += head.c - libc-y += virtual.c CFLAGS += -Wno-address-of-packed-member diff --git a/payloads/libpayload/arch/mock/head.c b/payloads/libpayload/arch/mock/head.c deleted file mode 100644 index 55a691f910..0000000000 --- a/payloads/libpayload/arch/mock/head.c +++ /dev/null @@ -1,3 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -/* This file is empty on purpose. It should not be used. */ diff --git a/payloads/libpayload/arch/x86/Makefile.mk b/payloads/libpayload/arch/x86/Makefile.mk index 196415d7a2..d2c33b4fb8 100644 --- a/payloads/libpayload/arch/x86/Makefile.mk +++ b/payloads/libpayload/arch/x86/Makefile.mk @@ -30,7 +30,7 @@ ifneq ($(CONFIG_LP_COMPILER_LLVM_CLANG),y) CFLAGS += -mpreferred-stack-boundary=2 endif -head.o-y += head.S +libc-y += head.S libc-y += main.c sysinfo.c libc-y += timer.c coreboot.c util.S libc-y += exec.S virtual.c diff --git a/payloads/libpayload/arch/x86/head.S b/payloads/libpayload/arch/x86/head.S index 99842cd54b..26ba901d5a 100644 --- a/payloads/libpayload/arch/x86/head.S +++ b/payloads/libpayload/arch/x86/head.S @@ -29,7 +29,7 @@ .code32 .global _entry - .text + .section .text._entry .align 4 /* diff --git a/payloads/libpayload/bin/lpgcc b/payloads/libpayload/bin/lpgcc index 724f5eca64..a954d4ff5b 100755 --- a/payloads/libpayload/bin/lpgcc +++ b/payloads/libpayload/bin/lpgcc @@ -201,14 +201,6 @@ if [ $DOLINK -eq 0 ]; then $DEFAULT_CC $CMDLINE $_CFLAGS else _LIBGCC=`$DEFAULT_CC $_ARCHEXTRA -print-libgcc-file-name` - if [ -f $_ARCHLIBDIR/head.o ]; then - HEAD_O=$_ARCHLIBDIR/head.o - elif [ -f $_OBJ/head.o ]; then - HEAD_O=$_OBJ/head.o - else - echo "Could not find head.o" - exit 1 - fi if [ "$CONFIG_LP_ARM64_A53_ERRATUM_843419" = y ] && grep -q fix-cortex-a53-843419 $_XCOMPILE; then @@ -220,13 +212,8 @@ else _LDFLAGS="$_LDFLAGS -Wl,--defsym=CONFIG_LP_STACK_SIZE=$CONFIG_LP_STACK_SIZE" if [ $DEBUGME -eq 1 ]; then - echo "$DEFAULT_CC $_LDFLAGS $HEAD_O $CMDLINE $_CFLAGS -lpayload $_LIBGCC" + echo "$DEFAULT_CC $_LDFLAGS $CMDLINE $_CFLAGS -lpayload $_LIBGCC" fi - # Note: $_ARCHLIBDIR/head.o must be the first object being linked, because it - # contains a Multiboot header. The Multiboot standard requires this - # header to be placed below 0x2000 in the resulting image. See: - # http://www.gnu.org/software/grub/manual/multiboot/html_node/OS-image-format.html - - $DEFAULT_CC $_LDFLAGS $HEAD_O $CMDLINE $_CFLAGS -lpayload -xnone $_LIBGCC + $DEFAULT_CC $_LDFLAGS $CMDLINE $_CFLAGS -lpayload -xnone $_LIBGCC fi |