From 188d3a278e7c226d175ade2a1097ea6ea6d96791 Mon Sep 17 00:00:00 2001 From: Adrian Chadd Date: Mon, 16 May 2016 23:56:31 +0000 Subject: [PATCH] [mips] Improve MIPS trampoline code This patch fix trampoline build. inckern.S increases stack and calls _startC of elf_trampoline, so inckern.S should be called before elf_trampoline. gcc4.2 puts text (code) into image according to order of source files in this call, so order has changed. In addition make will install trampoline kernel. It allows to use kernel for firmware build. Submitted by: Michael Zhilin Differential Revision: https://reviews.freebsd.org/D6242 --- sys/conf/Makefile.mips | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/conf/Makefile.mips b/sys/conf/Makefile.mips index 09eca75299e..d1e69239080 100644 --- a/sys/conf/Makefile.mips +++ b/sys/conf/Makefile.mips @@ -62,6 +62,7 @@ ASM_CFLAGS+=${CFLAGS} -D_LOCORE -DLOCORE .if !defined(WITHOUT_KERNEL_TRAMPOLINE) KERNEL_EXTRA=trampoline +KERNEL_EXTRA_INSTALL=${KERNEL_KO}.tramp.bin trampoline: ${KERNEL_KO}.tramp.bin ${KERNEL_KO}.tramp.bin: ${KERNEL_KO} $S/$M/$M/elf_trampoline.c \ $S/$M/$M/inckern.S @@ -72,7 +73,7 @@ ${KERNEL_KO}.tramp.bin: ${KERNEL_KO} $S/$M/$M/elf_trampoline.c \ ${CC} -O -nostdlib -I. -I$S ${TRAMP_EXTRA_FLAGS} ${TRAMP_LDFLAGS} -Xlinker \ -T -Xlinker ${LDSCRIPT_NAME}.tramp.noheader \ -DKERNNAME="\"${KERNEL_KO}.tmp\"" -DELFSIZE=${TRAMP_ELFSIZE} \ - $S/$M/$M/elf_trampoline.c $S/$M/$M/inckern.S \ + $S/$M/$M/inckern.S $S/$M/$M/elf_trampoline.c \ -o ${KERNEL_KO}.tramp.elf ${OBJCOPY} -S -O binary ${KERNEL_KO}.tramp.elf \ ${KERNEL_KO}.tramp.bin