Re: git: 3a4b04e82df6 - main - depend-cleanup.sh: Simplify handling for stale syscall.S

From: Jessica Clarke <jrtc27_at_freebsd.org>
Date: Tue, 10 Sep 2024 16:50:49 UTC
On 5 Aug 2024, at 20:49, John Baldwin <jhb@FreeBSD.org> wrote:
> 
> The branch main has been updated by jhb:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=3a4b04e82df6bb9b28aa0c3c670c19063843d644
> 
> commit 3a4b04e82df6bb9b28aa0c3c670c19063843d644
> Author:     John Baldwin <jhb@FreeBSD.org>
> AuthorDate: 2024-08-05 19:49:06 +0000
> Commit:     John Baldwin <jhb@FreeBSD.org>
> CommitDate: 2024-08-05 19:49:06 +0000
> 
>    depend-cleanup.sh: Simplify handling for stale syscall.S
> 
>    Remove the outer grep and depend on the greps in clean_dep instead.
> 
>    Reviewed by:    brooks, imp
>    Obtained from:  CheriBSD
>    Sponsored by:   AFRL, DARPA
>    Differential Revision:  https://reviews.freebsd.org/D46103
> ---
> tools/build/depend-cleanup.sh | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/tools/build/depend-cleanup.sh b/tools/build/depend-cleanup.sh
> index b93d50a57ff4..b7231422c5ed 100755
> --- a/tools/build/depend-cleanup.sh
> +++ b/tools/build/depend-cleanup.sh
> @@ -171,9 +171,7 @@ clean_dep   lib/libc        statfs        c
> # 20240308  e6ffc7669a56    Remove pointless MD syscall(2)
> # 20240308  0ee0ae237324    Remove pointless MD syscall(2)
> # 20240308  7b3836c28188    Remove pointless MD syscall(2)
> -if [ ${MACHINE} != i386 -a -f "$OBJTOP"/lib/libsys/.depend.syscall.o ] && \
> -    grep -q -e 'libsys/[^ /]*/syscall.S' "$OBJTOP"/lib/libsys/.depend.syscall.*; then
> - echo "Removing stale <arch>/syscall.S depends"
> +if [ ${MACHINE} != i386 ]; then
> clean_dep   lib/libsys  syscall S
> clean_dep   lib/libc    syscall S
> fi

Aside from causing the files to be removed for amd64 lib32 as
documented in the revision (but not, sadly, in the commit or file
here), this causes them to also be removed for any non-i386
architecture. This is because "syscall.S" still features in the .depend
file, just as:

    syscall.o: syscall.S

given the source exists in the .OBJDIR, rather than:

    syscall.o \
      /path/to/src/lib/libc/MACHINE/sys/syscall.S

or

    syscall.o \
      /path/to/src/lib/libsys/MACHINE/syscall.S

You can test this for yourself with:

    MACHINE=... MACHINE_ARCH=... ALL_libcompats="32" \
      tools/build/depend-cleanup.sh -n /path/to/objtop

(which I added last year for precisely this purpose)

Jess