[Midnightbsd-cvs] [MidnightBSD/src] 2306b2: Makefile.inc1: define __MidnightBSD__ for external...

Lucas Holt noreply at github.com
Fri Sep 25 17:28:02 EDT 2026


  Branch: refs/heads/fix-cross-build-midnightbsd-define
  Home:   https://github.com/MidnightBSD/src
  Commit: 2306b2f4e895556a42f8049d1388547cf347d752
      https://github.com/MidnightBSD/src/commit/2306b2f4e895556a42f8049d1388547cf347d752
  Author: Lucas Holt <luke at foolishgames.com>
  Date:   2026-09-25 (Fri, 25 Sep 2026)

  Changed paths:
    M Makefile.inc1

  Log Message:
  -----------
  Makefile.inc1: define __MidnightBSD__ for external cross compilers

An external toolchain (upstream clang on Linux/macOS CI) is driven with
-target *-unknown-freebsd13.4 and predefines __FreeBSD__ but not
__MidnightBSD__. The tree keys on __MidnightBSD__ throughout the kernel
(ACPICA's acenv.h, netmap, ipfilter, dtrace, sys/param.h, ...), so the
cross build died in the first ACPICA header:

    contrib/dev/acpica/include/platform/acenv.h:365:2: error: Unknown target environment

When bsd.compiler.mk reports the external compiler does not know
__MidnightBSD_cc_version, add -D__MidnightBSD__=<N> to XCFLAGS, using the
same value our own clang derives from the triple's OS major version.

AI-Assisted-by: Claude Fable 5.1
Co-Authored-By: Claude Fable 5.1 <noreply at anthropic.com>
Signed-off-by: Lucas Holt <luke at foolishgames.com>


  Commit: 3514aa9a5c278ab01e4269d848bc837963f368c3
      https://github.com/MidnightBSD/src/commit/3514aa9a5c278ab01e4269d848bc837963f368c3
  Author: Lucas Holt <luke at foolishgames.com>
  Date:   2026-09-25 (Fri, 25 Sep 2026)

  Changed paths:
    M sys/compat/linuxkpi/common/include/linux/kernel.h
    M sys/dev/drm2/drm_os_freebsd.h
    M sys/sys/libkern.h

  Log Message:
  -----------
  libkern: add abs64() and drop the private copies in linuxkpi and drm2

cpufreq_dt.c calls abs64(), which this tree only defined privately in
linuxkpi's <linux/kernel.h> and drm2's drm_os_freebsd.h. Every arm64
GENERIC build therefore fails:

    sys/dev/cpufreq/cpufreq_dt.c:116:10: error: call to undeclared function 'abs64'

Provide abs64() in <sys/libkern.h> next to qabs(), as FreeBSD does, and
remove the two duplicate static inlines so headers that include both do
not hit a redefinition error.

Verified: cpufreq_dt.o cross-compiles for aarch64; translation units
including <linux/kernel.h> and <dev/drm2/drmP.h> build with amd64 kernel
flags; sys/modules/linuxkpi linux_compat.o/linux_kmod.o build natively.

AI-Assisted-by: Claude Fable 5.1
Co-Authored-By: Claude Fable 5.1 <noreply at anthropic.com>
Signed-off-by: Lucas Holt <luke at foolishgames.com>


  Commit: c69de4c6172425615f92679b5781bcc3f0cf3049
      https://github.com/MidnightBSD/src/commit/c69de4c6172425615f92679b5781bcc3f0cf3049
  Author: Lucas Holt <luke at foolishgames.com>
  Date:   2026-09-25 (Fri, 25 Sep 2026)

  Changed paths:
    M sys/conf/files.arm64
    R sys/crypto/openssl/aarch64/arm_arch.h
    M sys/crypto/openssl/ossl_aarch64.c

  Log Message:
  -----------
  arm64: drop the stale crypto/openssl/aarch64/arm_arch.h copy

The OpenSSL aarch64 assembly files #include "arm_arch.h", which resolves
to the sibling copy in sys/crypto/openssl/aarch64/ before any -I path.
That copy dates from OpenSSL 1.1 (2018) and lacks the macros the current
3.0 assembly uses, so AARCH64_VALID_CALL_TARGET is left unexpanded and
every arm64 GENERIC build fails:

    sys/crypto/openssl/aarch64/aesv8-armx.S:18:2: error: unrecognized instruction mnemonic

Remove the stale copy so the include resolves to the maintained
sys/crypto/openssl/arm_arch.h, add -I$S/crypto/openssl to the aarch64
OpenSSL assembly rules in files.arm64 as FreeBSD does, and repoint the
one C consumer (ossl_aarch64.c) at the surviving header.

Verified: aesv8-armx.o, ghashv8-armx.o, sha1/sha256/sha512-armv8.o,
poly1305-armv8.o, chacha-armv8.o, ossl_aarch64.o, armv8_crypto.o and
armv8_crypto_wrap.o all cross-compile for aarch64 from a GENERIC+ossl
config; the first two fail identically before the change.

AI-Assisted-by: Claude Fable 5.1
Co-Authored-By: Claude Fable 5.1 <noreply at anthropic.com>
Signed-off-by: Lucas Holt <luke at foolishgames.com>


Compare: https://github.com/MidnightBSD/src/compare/2306b2f4e895%5E...c69de4c61724

To unsubscribe from these emails, change your notification settings at https://github.com/MidnightBSD/src/settings/notifications


More information about the Midnightbsd-cvs mailing list