@@ -5,7 +5,6 @@
#
bits = 32
ldarch = elf32-littlearm
-kernel_offset = 0x10000
machine = -marm
# stack.o relies on frame pointers.
@@ -14,6 +13,11 @@ KEEP_FRAME_POINTER := y
CFLAGS += $(machine)
CFLAGS += -mcpu=$(PROCESSOR)
+arch_LDFLAGS = -Ttext=40010000
+
+define arch_elf_check =
+endef
+
cstart.o = $(TEST_DIR)/cstart.o
cflatobjs += lib/arm/spinlock.o
cflatobjs += lib/arm/processor.o
@@ -5,7 +5,11 @@
#
bits = 64
ldarch = elf64-littleaarch64
-kernel_offset = 0x80000
+
+arch_LDFLAGS = -Ttext=40080000
+
+define arch_elf_check =
+endef
cstart.o = $(TEST_DIR)/cstart64.o
cflatobjs += lib/arm64/processor.o
@@ -4,11 +4,6 @@
# Authors: Andrew Jones <drjones@redhat.com>
#
-ifeq ($(LOADADDR),)
- # qemu mach-virt default load address
- LOADADDR = 0x40000000
-endif
-
tests-common = $(TEST_DIR)/selftest.flat
tests-common += $(TEST_DIR)/spinlock-test.flat
tests-common += $(TEST_DIR)/pci-test.flat
@@ -23,7 +18,6 @@ all: directories $(tests-all)
$(TEST_DIR)/sieve.elf: AUXFLAGS = 0x1
##################################################################
-phys_base = $(LOADADDR)
AUXFLAGS ?= 0x0
CFLAGS += -std=gnu99
@@ -64,17 +58,18 @@ libeabi = lib/arm/libeabi.a
eabiobjs = lib/arm/eabi_compat.o
libgcc := $(shell $(CC) $(machine) --print-libgcc-file-name)
-start_addr := $(shell printf "%x\n" $$(( $(phys_base) + $(kernel_offset) )))
FLATLIBS = $(libcflat) $(LIBFDT_archive) $(libgcc) $(libeabi)
-%.elf: LDFLAGS = $(CFLAGS) -nostdlib
+%.elf: LDFLAGS = -nostdlib $(arch_LDFLAGS)
%.elf: %.o $(FLATLIBS) $(SRCDIR)/arm/flat.lds $(cstart.o)
- $(CC) $(LDFLAGS) -o $@ \
- -Wl,-T,$(SRCDIR)/arm/flat.lds,--build-id=none,-Ttext=$(start_addr) \
- $(filter %.o, $^) $(FLATLIBS) \
- $(SRCDIR)/lib/auxinfo.c -DPROGNAME=\"$(@:.elf=.flat)\" -DAUXFLAGS=$(AUXFLAGS)
+ $(CC) $(CFLAGS) -c -o $(@:.elf=.aux.o) $(SRCDIR)/lib/auxinfo.c \
+ -DPROGNAME=\"$(@:.elf=.flat)\" -DAUXFLAGS=$(AUXFLAGS)
+ $(LD) $(LDFLAGS) -o $@ -T $(SRCDIR)/arm/flat.lds \
+ $(filter %.o, $^) $(FLATLIBS) $(@:.elf=.aux.o)
+ $(RM) $(@:.elf=.aux.o)
%.flat: %.elf
+ $(call arch_elf_check, $^)
$(OBJCOPY) -O binary $^ $@
$(libeabi): $(eabiobjs)
Signed-off-by: Andrew Jones <drjones@redhat.com> --- arm/Makefile.arm | 6 +++++- arm/Makefile.arm64 | 6 +++++- arm/Makefile.common | 19 +++++++------------ 3 files changed, 17 insertions(+), 14 deletions(-)