git: d08adc0e1cb3 - stable/13 - mips: Fix build of kernel.tramp.bin after upstream merge

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Mon, 06 Dec 2021 16:33:27 UTC
The branch stable/13 has been updated by dim:

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

commit d08adc0e1cb3a66a4351222066de3d5d319606ea
Author:     Jessica Clarke <jrtc27@jrtc27.com>
AuthorDate: 2021-11-11 18:28:24 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2021-12-06 16:30:10 +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
    
    (cherry picked from commit a2fa290024e73107a214e37c257ce93a3f131a41)
---
 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