From c0930e7be3322b59b3eeb737d726679f1d888ab4 Mon Sep 17 00:00:00 2001 From: ian Date: Mon, 30 Dec 2019 23:20:46 +0000 Subject: [PATCH] Set a "kernbase" symbol in 32-bit arm locore.S and use it with ldscript.arm. This brings arm into line with how every other arch does it. For some reason, only arm lacked a definition of a symbol named kernbase in its locore.S file(s) for use in its ldscript.arm file. Needlessly different means harder to maintain. Using a common symbol name also eases work in progress on a script to help generate arm and arm64 kernels packaged in various ways (like with a header blob needed for a bootloader prepended to the kernel file). --- sys/arm/arm/locore-v4.S | 6 ++++-- sys/arm/arm/locore-v6.S | 3 +++ sys/conf/Makefile.arm | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/sys/arm/arm/locore-v4.S b/sys/arm/arm/locore-v4.S index 572c6c3a04ef..8add9aee98e2 100644 --- a/sys/arm/arm/locore-v4.S +++ b/sys/arm/arm/locore-v4.S @@ -62,9 +62,11 @@ __FBSDID("$FreeBSD$"); */ .text .align 2 + + .globl kernbase + .set kernbase,KERNVIRTADDR + #ifdef PHYSADDR -.globl kernbase -.set kernbase,KERNBASE .globl physaddr .set physaddr,PHYSADDR #endif diff --git a/sys/arm/arm/locore-v6.S b/sys/arm/arm/locore-v6.S index 94737f1c5ccb..d796e6267cdc 100644 --- a/sys/arm/arm/locore-v6.S +++ b/sys/arm/arm/locore-v6.S @@ -59,6 +59,9 @@ __FBSDID("$FreeBSD$"); .text .align 2 + .globl kernbase + .set kernbase,KERNVIRTADDR + #if __ARM_ARCH >= 7 #define HANDLE_HYP \ /* Leave HYP mode */ ;\ diff --git a/sys/conf/Makefile.arm b/sys/conf/Makefile.arm index 0e80fc0575d2..23108641ba0c 100644 --- a/sys/conf/Makefile.arm +++ b/sys/conf/Makefile.arm @@ -61,7 +61,7 @@ KERNVIRTADDR= 0xc0000000 # "ELF for the ARM architecture" for more info on the mapping symbols. SYSTEM_LD= \ ${SYSTEM_LD_BASECMD} \ - --defsym='text_start=${KERNVIRTADDR} + SIZEOF_HEADERS' \ + --defsym='text_start=kernbase + SIZEOF_HEADERS' \ -o ${.TARGET} ${SYSTEM_OBJS} vers.o; \ $(OBJCOPY) \ --wildcard \ @@ -77,7 +77,7 @@ KERNEL_EXTRA_INSTALL+= ${KERNEL_KO}.bin ${KERNEL_KO}.bin: ${SYSTEM_DEP} vers.o @echo "linking ${.TARGET}" @${SYSTEM_LD_BASECMD} \ - --defsym='text_start=${KERNVIRTADDR}' \ + --defsym='text_start=kernbase' \ -o ${.TARGET} ${SYSTEM_OBJS} vers.o ${SIZE} ${.TARGET} @${OBJCOPY} \