From 0f2d88d1ebbba796adb0492781b683cbfe25bd2d Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Tue, 7 Dec 2021 01:11:10 +0200 Subject: [PATCH] amd64: Only build aout.ko when COMPAT_FREEBSD32 is enabled a.out.ko is useless without COMPAT_FREEBSD32, and since vdso support was added, it requires a header built during depend phase, from the COMPAT option. Reported by: glebius Reviewed by: emaste, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D33311 --- sys/conf/kern.post.mk | 4 ++++ sys/conf/kern.pre.mk | 2 ++ sys/modules/Makefile | 2 ++ 3 files changed, 8 insertions(+) diff --git a/sys/conf/kern.post.mk b/sys/conf/kern.post.mk index bb25c7277d85..087beb73f9ae 100644 --- a/sys/conf/kern.post.mk +++ b/sys/conf/kern.post.mk @@ -50,6 +50,10 @@ MKMODULESENV+= SAN_CFLAGS="${SAN_CFLAGS}" MKMODULESENV+= GCOV_CFLAGS="${GCOV_CFLAGS}" .endif +.if !empty(COMPAT_FREEBSD32_ENABLED) +MKMODULESENV+= COMPAT_FREEBSD32_ENABLED="yes" +.endif + # Allow overriding the kernel debug directory, so kernel and user debug may be # installed in different directories. Setting it to "" restores the historical # behavior of installing debug files in the kernel directory. diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk index 6e70513dfdf9..0daf5a54938b 100644 --- a/sys/conf/kern.pre.mk +++ b/sys/conf/kern.pre.mk @@ -93,6 +93,8 @@ CFLAGS+= -fno-common # XXX LOCORE means "don't declare C stuff" not "for locore.s". ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${CFLAGS} ${ASM_CFLAGS.${.IMPSRC:T}} +COMPAT_FREEBSD32_ENABLED!= grep COMPAT_FREEBSD32 opt_global.h || true ; echo + KASAN_ENABLED!= grep KASAN opt_global.h || true ; echo .if !empty(KASAN_ENABLED) SAN_CFLAGS+= -DSAN_NEEDS_INTERCEPTORS -DSAN_INTERCEPTOR_PREFIX=kasan \ diff --git a/sys/modules/Makefile b/sys/modules/Makefile index 5fd6625bfb05..150fd405dc47 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -623,7 +623,9 @@ _neta= neta .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" _agp= agp +.if ${MACHINE_CPUARCH} == "i386" || !empty(COMPAT_FREEBSD32_ENABLED) _aout= aout +.endif _bios= bios .if ${MK_SOURCELESS_UCODE} != "no" _bxe= bxe