Index: lib/libc/Makefile =================================================================== --- lib/libc/Makefile +++ lib/libc/Makefile @@ -162,7 +162,7 @@ # If there are no machine dependent sources, append all the # machine-independent sources: -.if empty(MDSRCS) +.if empty(MDSRCS) || ${MK_MACHDEP_OPTIMIZATIONS} == no SRCS+= ${MISRCS} .else # Append machine-dependent sources, then append machine-independent sources Index: lib/libmd/Makefile =================================================================== --- lib/libmd/Makefile +++ lib/libmd/Makefile @@ -103,7 +103,7 @@ .PATH: ${SRCTOP}/sys/crypto/skein ${SRCTOP}/sys/crypto/skein/${MACHINE_ARCH} USE_ASM_SOURCES?=1 -.if defined(BOOTSTRAPPING) +.if defined(BOOTSTRAPPING) || ${MK_MACHDEP_OPTIMIZATIONS} == no # Don't build ASM sources when bootstrapping to avoid toolchain dependencies USE_ASM_SOURCES:=0 .endif Index: lib/msun/Makefile =================================================================== --- lib/msun/Makefile +++ lib/msun/Makefile @@ -151,7 +151,7 @@ #COMMON_SRCS+= s_fabs.c s_frexp.c s_isnan.c s_ldexp.c s_modf.c # Exclude the generic versions of what we provide in the MD area. -.if defined(ARCH_SRCS) +.if defined(ARCH_SRCS) && ${MK_MACHDEP_OPTIMIZATIONS} == yes .for i in ${ARCH_SRCS} COMMON_SRCS:= ${COMMON_SRCS:N${i:R}.c} .endfor Index: share/man/man5/src.conf.5 =================================================================== --- share/man/man5/src.conf.5 +++ share/man/man5/src.conf.5 @@ -1094,6 +1094,8 @@ Build .Xr ls 1 without support for colors to distinguish file types. +.It Va WITHOUT_MACHDEP +Prefer machine-independent non-assembler code across the code base. .It Va WITHOUT_MAIL Do not build any mail support (MUA or MTA). When set, it enforces these options: Index: share/mk/src.opts.mk =================================================================== --- share/mk/src.opts.mk +++ share/mk/src.opts.mk @@ -142,6 +142,7 @@ LOCATE \ LPR \ LS_COLORS \ + MACHDEP_OPTIMIZATIONS \ MAIL \ MAILWRAPPER \ MAKE \ Index: tools/build/options/WITHOUT_MACHDEP_OPTIMIZATIONS =================================================================== --- /dev/null +++ tools/build/options/WITHOUT_MACHDEP_OPTIMIZATIONS @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Prefer machine-independent non-assembler code across the code base.