git: a2fa290024e7 - main - mips: Fix build of kernel.tramp.bin after upstream merge

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Sat, 13 Nov 2021 20:57:15 UTC
The branch main has been updated by dim:

URL: https://cgit.FreeBSD.org/src/commit/?id=a2fa290024e73107a214e37c257ce93a3f131a41

commit a2fa290024e73107a214e37c257ce93a3f131a41
Author:     Jessica Clarke <jrtc27@jrtc27.com>
AuthorDate: 2021-11-11 18:28:24 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2021-11-13 20:52:26 +0000

    mips: Fix build of kernel.tramp.bin after upstream merge
    
    Since the upstream merge we end up with the compiler generating calls to
    memcpy (and it appears upstream LLVM does too, so this will probably
    also be a problem upstream when the LLVM 13 import is finished). Like
    the kernel we should just compile this file with -ffreestanding to avoid
    such surprises.
    
    Note that elf_trampoline.c does actually provide a memcpy, but it's
    static. That's a bit weird, and means by the time the memcpy calls are
    generated by the compiler the explicit ones have already been inlined
    and the function itself GC'ed, but since using -ffreestanding is the
    right thing to do for this kind of code anyway, that doesn't actually
    matter.
    
    Obtained from:  https://github.com/CTSRD-CHERI/cheribsd/commit/219ddb6293c
---
 sys/conf/Makefile.mips | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/conf/Makefile.mips b/sys/conf/Makefile.mips
index add27c1752a1..e8dd61d10a1d 100644
--- a/sys/conf/Makefile.mips
+++ b/sys/conf/Makefile.mips
@@ -57,6 +57,8 @@ TRAMP_ARCH_FLAGS?=$(ARCH_FLAGS)
 TRAMP_EXTRA_FLAGS=${EXTRA_FLAGS} ${TRAMP_ARCH_FLAGS}
 # Kernel code is always compiled with soft-float on MIPS
 TRAMP_EXTRA_FLAGS+=-msoft-float
+# No standard library available
+TRAMP_EXTRA_FLAGS+=-ffreestanding
 .if ${MACHINE_ARCH:Mmips64*} != ""
 TRAMP_ELFSIZE=64
 .else