Re: git: 20adba8bc1be - main - src.conf: Introduce WITHOUT_MACHDEP knob.

From: Jessica Clarke <jrtc27_at_freebsd.org>
Date: Fri, 09 Sep 2022 06:58:30 UTC
On 9 Sept 2022, at 07:54, Gleb Popov <arrowd@FreeBSD.org> wrote:
> 
> The branch main has been updated by arrowd (ports committer):
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=20adba8bc1beb125d5e5ed8f12e747ae79ca6a10
> 
> commit 20adba8bc1beb125d5e5ed8f12e747ae79ca6a10
> Author:     Gleb Popov <arrowd@FreeBSD.org>
> AuthorDate: 2022-08-08 15:16:00 +0000
> Commit:     Gleb Popov <arrowd@FreeBSD.org>
> CommitDate: 2022-09-09 06:54:28 +0000
> 
>    src.conf: Introduce WITHOUT_MACHDEP knob.

This differs from what you actually did.

>    Summary:
>    This knob can be used to make buildsystem prefer generic C implentations of
>    various functions, instead of machine-specific assembler ones.
> 
>    Test Plan: `make buildworld` on amd64
> 
>    Reviewed by: imp, emaste
> 
>    Differential Revision: https://reviews.freebsd.org/D36076
> 
>    MFC after:      3 days

This is not the right format for commit messages.

> ---
> lib/libc/Makefile                                 | 2 +-
> lib/libmd/Makefile                                | 2 +-
> lib/msun/Makefile                                 | 2 +-
> share/man/man5/src.conf.5                         | 2 ++
> share/mk/src.opts.mk                              | 1 +
> tools/build/options/WITHOUT_MACHDEP_OPTIMIZATIONS | 1 +
> 6 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/libc/Makefile b/lib/libc/Makefile
> index 3667eea15307..a221a5a66c19 100644
> --- a/lib/libc/Makefile
> +++ b/lib/libc/Makefile
> @@ -162,7 +162,7 @@ CFLAGS+= -DSYMBOL_VERSIONING
> 
> # If there are no machine dependent sources, append all the
> # machine-independent sources:
> -.if empty(MDSRCS)
> +.if empty(MDSRCS) || ${MK_MACHDEP_OPTIMIZATIONS} == no

These all have _OPTIMIZATIONS.

> SRCS+=	${MISRCS}
> .else
> # Append machine-dependent sources, then append machine-independent sources
> diff --git a/lib/libmd/Makefile b/lib/libmd/Makefile
> index c98c33bae3f5..8d3a05279004 100644
> --- a/lib/libmd/Makefile
> +++ b/lib/libmd/Makefile
> @@ -103,7 +103,7 @@ CFLAGS.skein_block.c+= -DSKEIN_LOOP=995
> .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
> diff --git a/lib/msun/Makefile b/lib/msun/Makefile
> index 2382a9ae3fdb..e65e9401cdbf 100644
> --- a/lib/msun/Makefile
> +++ b/lib/msun/Makefile
> @@ -151,7 +151,7 @@ COMMON_SRCS+=	catrig.c catrigf.c \
> #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} != no
> .for i in ${ARCH_SRCS}
> COMMON_SRCS:=  ${COMMON_SRCS:N${i:R}.c}
> .endfor
> diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5
> index 36fb474b6597..0ccdfa6cd49c 100644
> --- a/share/man/man5/src.conf.5
> +++ b/share/man/man5/src.conf.5
> @@ -1094,6 +1094,8 @@ and related programs.
> 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.

Except this lacks the suffix, and is clearly not generated from what’s
in-tree given that’s a WITHOUT_MACHDEP_OPTIMIZATIONS file.

Also the description is different.

Jess

> .It Va WITHOUT_MAIL
> Do not build any mail support (MUA or MTA).
> When set, it enforces these options:
> diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk
> index 4ac61f13cee2..a03b8147ecbb 100644
> --- a/share/mk/src.opts.mk
> +++ b/share/mk/src.opts.mk
> @@ -142,6 +142,7 @@ __DEFAULT_YES_OPTIONS = \
>     LOCATE \
>     LPR \
>     LS_COLORS \
> +    MACHDEP_OPTIMIZATIONS \
>     MAIL \
>     MAILWRAPPER \
>     MAKE \
> diff --git a/tools/build/options/WITHOUT_MACHDEP_OPTIMIZATIONS b/tools/build/options/WITHOUT_MACHDEP_OPTIMIZATIONS
> new file mode 100644
> index 000000000000..1c596c998504
> --- /dev/null
> +++ b/tools/build/options/WITHOUT_MACHDEP_OPTIMIZATIONS
> @@ -0,0 +1 @@
> +Prefer machine-independent non-assembler code in libc and libm.