ARMv7: get rmodule support to compile

BRANCH=none
BUG=none
TEST=emerge-peach_pit chromeos-coreboot-peach_pit compiles
     successfully when CONFIG_VBOOT_VERIFY_FIRMWARE=y

Signed-off-by: Stefan Reinauer <reinauer@google.com>
Change-Id: I4a8f26d2e6ba92e4145022512d67e8a469fbba2f
Reviewed-on: https://chromium-review.googlesource.com/169372
Reviewed-by: David Hendrix <dhendrix@chromium.org>
This commit is contained in:
Stefan Reinauer 2013-09-16 14:31:36 -07:00 committed by chrome-internal-fetch
commit 5b3cdaed27
6 changed files with 46 additions and 13 deletions

View file

@ -170,16 +170,25 @@ bootblock-y += eabi_compat.c
ramstage-y += boot.c
ramstage-y += tables.c
romstage-y += memset.S
ramstage-y += memset.S
bootblock-y += memset.S
romstage-y += memcpy.S
ramstage-y += memcpy.S
bootblock-y += memcpy.S
romstage-y += memmove.S
ramstage-y += memmove.S
bootblock-y += memmove.S
romstage-y += memset.S
romstage-y += memcpy.S
romstage-y += memmove.S
ramstage-y += memset.S
ramstage-y += memcpy.S
ramstage-y += memmove.S
rmodules-y += memset.S
rmodules-y += memcpy.S
rmodules-y += memmove.S
rmodules-y += eabi_compat.c
VBOOT_STUB_DEPS += $(obj)/arch/armv7/eabi_compat.rmodules.o
romstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
ramstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c

View file

@ -11,15 +11,12 @@
#include <console/console.h>
/* FIXME(dhendrix): prototypes added for assembler */
int raise (int signum) __attribute__((used));
int raise (int signum)
{
printk(BIOS_CRIT, "raise: Signal # %d caught\n", signum);
return 0;
}
/* Dummy function to avoid linker complaints */
void __aeabi_unwind_cpp_pr0(void) __attribute__((used));
void __aeabi_unwind_cpp_pr0(void)
{

View file

@ -53,6 +53,12 @@ ramstage-y += dp.c dp_lowlevel.c fimd.c
ramstage-y += usb.c
ramstage-y += cbmem.c
rmodules-y += monotonic_timer.c
rmodules-y += mct.c
VBOOT_STUB_DEPS += $(obj)/cpu/samsung/exynos5420/monotonic_timer.rmodules.o
VBOOT_STUB_DEPS += $(obj)/cpu/samsung/exynos5420/mct.rmodules.o
exynos5420_add_bl1: $(obj)/coreboot.pre
printf " DD Adding Samsung Exynos5420 BL1\n"
dd if=3rdparty/cpu/samsung/exynos5420/bl1.bin \

View file

@ -143,6 +143,8 @@ ramstage-y += rmodule.c
romstage-$(CONFIG_RELOCATABLE_RAMSTAGE) += rmodule.c
RMODULE_LDSCRIPT := $(src)/lib/rmodule.ld
ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y)
RMODULE_LDFLAGS := -nostartfiles -shared -z defs -nostdlib -Bsymbolic -T $(RMODULE_LDSCRIPT)
# rmodule_link_rules is a function that should be called with:
@ -152,9 +154,25 @@ RMODULE_LDFLAGS := -nostartfiles -shared -z defs -nostdlib -Bsymbolic -T $(RMOD
# It will create the necessary Make rules.
define rmodule_link
$(strip $(1)): $(strip $(2)) $$(RMODULE_LDSCRIPT) $$(obj)/ldoptions
$$(LD) $$(RMODULE_LDFLAGS) --defsym=__heap_size=$(strip $(3)) -o $$@ $(strip $(2))
$$(LD) $$(RMODULE_LDFLAGS) --defsym=__heap_size=$(strip $(3)) -o $$@ --start-group $(strip $(2)) $$(LIBGCC_FILE_NAME) --end-group
$$(NM) -n $$@ > $$(basename $$@).map
endef
else
RMODULE_LDFLAGS := -nostartfiles -Wl,-z,defs -Wl,-Bsymbolic -Wl,-T,$(RMODULE_LDSCRIPT)
# rmodule_link_rules is a function that should be called with:
# (1) the object name to link
# (2) the dependencies
# (3) heap size of the relocatable module
# It will create the necessary Make rules.
define rmodule_link
$(strip $(1)): $(strip $(2)) $$(RMODULE_LDSCRIPT) $$(obj)/ldoptions
$$(CC) $$(CFLAGS) $$(RMODULE_LDFLAGS) -Wl,--defsym=__heap_size=$(strip $(3)) -o $$@ -Wl,--start-group $(strip $(2)) $$(LIBGCC_FILE_NAME) -Wl,--end-group
$$(NM) -n $$@ > $$(basename $$@).map
endef
endif
endif

View file

@ -1,6 +1,3 @@
OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
OUTPUT_ARCH(i386)
/*
* This linker script is used to link rmodules (relocatable modules). It
* links at zero so that relocation fixups are easy when placing the binaries

View file

@ -57,8 +57,14 @@ VBOOT_STUB_DOTO = $(VBOOT_STUB_ELF:.elf=.o)
# Dependency for the vboot rmodules. Ordering matters.
VBOOT_STUB_DEPS += $(obj)/vendorcode/google/chromeos/vboot_wrapper.rmodules.o
VBOOT_STUB_DEPS += $(obj)/lib/memcmp.rmodules.o
ifeq ($(CONFIG_ARCH_X86),y)
VBOOT_STUB_DEPS += $(obj)/arch/x86/lib/memset.rmodules.o
VBOOT_STUB_DEPS += $(obj)/arch/x86/lib/memcpy.rmodules.o
endif
ifeq ($(CONFIG_ARCH_ARMV7),y)
VBOOT_STUB_DEPS += $(obj)/arch/armv7/memset.rmodules.o
VBOOT_STUB_DEPS += $(obj)/arch/armv7/memcpy.rmodules.o
endif
VBOOT_STUB_DEPS += $(VB_LIB)
# Remove the '-include' option since that will break vboot's build and ensure
# vboot_reference can get to coreboot's include files.
@ -66,7 +72,7 @@ VBOOT_CFLAGS += $(patsubst -I%,-I../%,$(filter-out -include $(src)/include/kconf
VBOOT_CFLAGS += -DVBOOT_DEBUG
$(VBOOT_STUB_DOTO): $(VBOOT_STUB_DEPS)
$(CC) $(LDFLAGS) -nostdlib -r -o $@ $^
$(CC) $(CFLAGS) $(LDFLAGS) -nostdlib -r -o $@ $^
# Link the vbootstub module with a 64KiB-byte heap.
$(eval $(call rmodule_link,$(VBOOT_STUB_ELF), $(VBOOT_STUB_DOTO), 0x10000))