build: Properly generate .d dependency files [BZ #28922]

Message ID 20220224210545.2036071-1-hjl.tools@gmail.com
State Superseded
Headers
Series build: Properly generate .d dependency files [BZ #28922] |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent
dj/TryBot-32bit success Build for i686

Commit Message

H.J. Lu Feb. 24, 2022, 9:05 p.m. UTC
  1. Also generate .d dependency files for $(tests-container) and
$(tests-printers).
2. elf: Add tst-auditmod17.os to extra-test-objs.
3. iconv: Add tst-gconv-init-failure-mod.os to extra-test-objs.
4. malloc: Rename extra-tests-objs to extra-test-objs.
5. linux: Add tst-sysconf-iov_max-uapi.o to extra-test-objs.
6. x86_64: Add tst-x86_64mod-1.o, tst-platformmod-2.o, test-libmvec.o,
test-libmvec-avx.o, test-libmvec-avx2.o and test-libmvec-avx512f.o to
extra-test-objs.
---
 Makerules                        | 1 +
 elf/Makefile                     | 3 +++
 iconv/Makefile                   | 1 +
 malloc/Makefile                  | 2 +-
 sysdeps/unix/sysv/linux/Makefile | 3 +++
 sysdeps/x86_64/Makefile          | 2 ++
 sysdeps/x86_64/fpu/Makefile      | 6 ++++++
 7 files changed, 17 insertions(+), 1 deletion(-)
  

Comments

Carlos O'Donell Feb. 24, 2022, 9:22 p.m. UTC | #1
On 2/24/22 16:05, H.J. Lu via Libc-alpha wrote:
> 1. Also generate .d dependency files for $(tests-container) and
> $(tests-printers).
> 2. elf: Add tst-auditmod17.os to extra-test-objs.
> 3. iconv: Add tst-gconv-init-failure-mod.os to extra-test-objs.
> 4. malloc: Rename extra-tests-objs to extra-test-objs.
> 5. linux: Add tst-sysconf-iov_max-uapi.o to extra-test-objs.
> 6. x86_64: Add tst-x86_64mod-1.o, tst-platformmod-2.o, test-libmvec.o,
> test-libmvec-avx.o, test-libmvec-avx2.o and test-libmvec-avx512f.o to
> extra-test-objs.



> ---
>  Makerules                        | 1 +
>  elf/Makefile                     | 3 +++
>  iconv/Makefile                   | 1 +
>  malloc/Makefile                  | 2 +-
>  sysdeps/unix/sysv/linux/Makefile | 3 +++
>  sysdeps/x86_64/Makefile          | 2 ++
>  sysdeps/x86_64/fpu/Makefile      | 6 ++++++
>  7 files changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/Makerules b/Makerules
> index 5de2cec6be..428464f092 100644
> --- a/Makerules
> +++ b/Makerules
> @@ -770,6 +770,7 @@ endif
>  	     $(patsubst %.oS,%.d,$(filter %.oS,$(extra-objs))) \
>  	     $(patsubst %.o,%.d,$(filter %.o,$(extra-test-objs:.os=.o))) \
>  	     $(addsuffix .d,$(tests) $(tests-internal) $(xtests) \
> +		$(tests-container) $(tests-printers) \
>  		$(test-srcs) $(tests-time64) $(xtests-time64))
>  ifeq ($(build-programs),yes)
>  +depfiles += $(addsuffix .d,$(others) $(sysdep-others))
> diff --git a/elf/Makefile b/elf/Makefile
> index bff94954c9..281551d380 100644
> --- a/elf/Makefile
> +++ b/elf/Makefile
> @@ -888,6 +888,9 @@ modules-names += \
>  modules-names-tests = $(filter-out ifuncmod% tst-tlsmod%,\
>  				   $(modules-names))
>  
> +# For +depfiles in Makerules.
> +extra-test-objs += tst-auditmod17.os
> +
>  ifeq (yes,$(have-mtls-dialect-gnu2))
>  tests += tst-gnu2-tls1
>  modules-names += tst-gnu2-tls1mod
> diff --git a/iconv/Makefile b/iconv/Makefile
> index 5aeed346ef..a0d90cfeac 100644
> --- a/iconv/Makefile
> +++ b/iconv/Makefile
> @@ -86,6 +86,7 @@ ifeq (yes,$(build-shared))
>  tests += tst-gconv-init-failure
>  modules-names += tst-gconv-init-failure-mod
>  modules-names-tests += tst-gconv-init-failure-mod
> +extra-test-objs += tst-gconv-init-failure-mod.os
>  $(objpfx)tst-gconv-init-failure-mod.so: $(libsupport)
>  $(objpfx)tst-gconv-init-failure.out: \
>   $(objpfx)gconv-modules $(objpfx)tst-gconv-init-failure-mod.so
> diff --git a/malloc/Makefile b/malloc/Makefile
> index 2329cf718a..4e32de2a0b 100644
> --- a/malloc/Makefile
> +++ b/malloc/Makefile
> @@ -145,7 +145,7 @@ extra-libs = libmemusage libc_malloc_debug
>  extra-libs-others = $(extra-libs)
>  
>  # Helper objects for some tests.
> -extra-tests-objs += \
> +extra-test-objs += \
>    tst-interpose-aux-nothread.o \
>    tst-interpose-aux-thread.o \
>  
> diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
> index 7122f55975..ca953804d0 100644
> --- a/sysdeps/unix/sysv/linux/Makefile
> +++ b/sysdeps/unix/sysv/linux/Makefile
> @@ -128,6 +128,9 @@ tests += tst-clone tst-clone2 tst-clone3 tst-fanotify tst-personality \
>    tst-epoll \
>    # tests
>  
> +# For +depfiles in Makerules.
> +extra-test-objs += tst-sysconf-iov_max-uapi.o
> +
>  # Test for the symbol version of fcntl that was replaced in glibc 2.28.
>  ifeq ($(have-GLIBC_2.27)$(build-shared),yesyes)
>  tests += tst-ofdlocks-compat
> diff --git a/sysdeps/x86_64/Makefile b/sysdeps/x86_64/Makefile
> index 7a4b576356..79365aff2a 100644
> --- a/sysdeps/x86_64/Makefile
> +++ b/sysdeps/x86_64/Makefile
> @@ -52,6 +52,7 @@ CFLAGS-tst-quad2pie.c = $(PIE-ccflag)
>  
>  tests += tst-x86_64-1
>  modules-names += x86_64/tst-x86_64mod-1
> +extra-test-objs += tst-x86_64mod-1.o
>  LDFLAGS-tst-x86_64mod-1.so = -Wl,-soname,tst-x86_64mod-1.so
>  ifneq (no,$(have-tunables))
>  # Test the state size for XSAVE when XSAVEC is disabled.
> @@ -63,6 +64,7 @@ $(objpfx)tst-x86_64-1: $(objpfx)x86_64/tst-x86_64mod-1.so
>  ifneq (no,$(have-tunables))
>  tests += tst-platform-1
>  modules-names += tst-platformmod-1 x86_64/tst-platformmod-2
> +extra-test-objs += tst-platformmod-2.o
>  CFLAGS-tst-platform-1.c = -mno-avx
>  CFLAGS-tst-platformmod-1.c = -mno-avx
>  CFLAGS-tst-platformmod-2.c = -mno-avx
> diff --git a/sysdeps/x86_64/fpu/Makefile b/sysdeps/x86_64/fpu/Makefile
> index 8278ce104a..2d1ab9e468 100644
> --- a/sysdeps/x86_64/fpu/Makefile
> +++ b/sysdeps/x86_64/fpu/Makefile
> @@ -37,6 +37,12 @@ tests += \
>    $(libmvec-abi-func-avx2-tests) \
>    $(libmvec-abi-func-avx512f-tests)
>  
> +extra-test-objs += \
> +  test-libmvec.o \
> +  test-libmvec-avx.o \
> +  test-libmvec-avx2.o \
> +  test-libmvec-avx512f.o

Can we output this into libmvec.mk?

Can we avoid a hardcoded list?

I assume this list is derived from:
116          for i in "" "-avx" "-avx2" "-avx512f"; do \
117            for t in $(libmvec-abi-func-tests); do \
118              echo "\$$(objpfx)$$t$$i: \\"; \
119              echo "  \$$(objpfx)$$t$$i.o \\"; \
120              echo "  \$$(objpfx)test-libmvec$$i.o \$$(libmvec)"; \
121              echo; \
122            done; \

> +
>  double-vlen2-funcs = $(libmvec-funcs)
>  double-vlen4-funcs = $(libmvec-funcs)
>  double-vlen4-avx2-funcs = $(libmvec-funcs)
  
H.J. Lu Feb. 24, 2022, 10:11 p.m. UTC | #2
On Thu, Feb 24, 2022 at 1:22 PM Carlos O'Donell <carlos@redhat.com> wrote:
>
> On 2/24/22 16:05, H.J. Lu via Libc-alpha wrote:
> > 1. Also generate .d dependency files for $(tests-container) and
> > $(tests-printers).
> > 2. elf: Add tst-auditmod17.os to extra-test-objs.
> > 3. iconv: Add tst-gconv-init-failure-mod.os to extra-test-objs.
> > 4. malloc: Rename extra-tests-objs to extra-test-objs.
> > 5. linux: Add tst-sysconf-iov_max-uapi.o to extra-test-objs.
> > 6. x86_64: Add tst-x86_64mod-1.o, tst-platformmod-2.o, test-libmvec.o,
> > test-libmvec-avx.o, test-libmvec-avx2.o and test-libmvec-avx512f.o to
> > extra-test-objs.
>
>
>
> > ---
> >  Makerules                        | 1 +
> >  elf/Makefile                     | 3 +++
> >  iconv/Makefile                   | 1 +
> >  malloc/Makefile                  | 2 +-
> >  sysdeps/unix/sysv/linux/Makefile | 3 +++
> >  sysdeps/x86_64/Makefile          | 2 ++
> >  sysdeps/x86_64/fpu/Makefile      | 6 ++++++
> >  7 files changed, 17 insertions(+), 1 deletion(-)
> >
> > diff --git a/Makerules b/Makerules
> > index 5de2cec6be..428464f092 100644
> > --- a/Makerules
> > +++ b/Makerules
> > @@ -770,6 +770,7 @@ endif
> >            $(patsubst %.oS,%.d,$(filter %.oS,$(extra-objs))) \
> >            $(patsubst %.o,%.d,$(filter %.o,$(extra-test-objs:.os=.o))) \
> >            $(addsuffix .d,$(tests) $(tests-internal) $(xtests) \
> > +             $(tests-container) $(tests-printers) \
> >               $(test-srcs) $(tests-time64) $(xtests-time64))
> >  ifeq ($(build-programs),yes)
> >  +depfiles += $(addsuffix .d,$(others) $(sysdep-others))
> > diff --git a/elf/Makefile b/elf/Makefile
> > index bff94954c9..281551d380 100644
> > --- a/elf/Makefile
> > +++ b/elf/Makefile
> > @@ -888,6 +888,9 @@ modules-names += \
> >  modules-names-tests = $(filter-out ifuncmod% tst-tlsmod%,\
> >                                  $(modules-names))
> >
> > +# For +depfiles in Makerules.
> > +extra-test-objs += tst-auditmod17.os
> > +
> >  ifeq (yes,$(have-mtls-dialect-gnu2))
> >  tests += tst-gnu2-tls1
> >  modules-names += tst-gnu2-tls1mod
> > diff --git a/iconv/Makefile b/iconv/Makefile
> > index 5aeed346ef..a0d90cfeac 100644
> > --- a/iconv/Makefile
> > +++ b/iconv/Makefile
> > @@ -86,6 +86,7 @@ ifeq (yes,$(build-shared))
> >  tests += tst-gconv-init-failure
> >  modules-names += tst-gconv-init-failure-mod
> >  modules-names-tests += tst-gconv-init-failure-mod
> > +extra-test-objs += tst-gconv-init-failure-mod.os
> >  $(objpfx)tst-gconv-init-failure-mod.so: $(libsupport)
> >  $(objpfx)tst-gconv-init-failure.out: \
> >   $(objpfx)gconv-modules $(objpfx)tst-gconv-init-failure-mod.so
> > diff --git a/malloc/Makefile b/malloc/Makefile
> > index 2329cf718a..4e32de2a0b 100644
> > --- a/malloc/Makefile
> > +++ b/malloc/Makefile
> > @@ -145,7 +145,7 @@ extra-libs = libmemusage libc_malloc_debug
> >  extra-libs-others = $(extra-libs)
> >
> >  # Helper objects for some tests.
> > -extra-tests-objs += \
> > +extra-test-objs += \
> >    tst-interpose-aux-nothread.o \
> >    tst-interpose-aux-thread.o \
> >
> > diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
> > index 7122f55975..ca953804d0 100644
> > --- a/sysdeps/unix/sysv/linux/Makefile
> > +++ b/sysdeps/unix/sysv/linux/Makefile
> > @@ -128,6 +128,9 @@ tests += tst-clone tst-clone2 tst-clone3 tst-fanotify tst-personality \
> >    tst-epoll \
> >    # tests
> >
> > +# For +depfiles in Makerules.
> > +extra-test-objs += tst-sysconf-iov_max-uapi.o
> > +
> >  # Test for the symbol version of fcntl that was replaced in glibc 2.28.
> >  ifeq ($(have-GLIBC_2.27)$(build-shared),yesyes)
> >  tests += tst-ofdlocks-compat
> > diff --git a/sysdeps/x86_64/Makefile b/sysdeps/x86_64/Makefile
> > index 7a4b576356..79365aff2a 100644
> > --- a/sysdeps/x86_64/Makefile
> > +++ b/sysdeps/x86_64/Makefile
> > @@ -52,6 +52,7 @@ CFLAGS-tst-quad2pie.c = $(PIE-ccflag)
> >
> >  tests += tst-x86_64-1
> >  modules-names += x86_64/tst-x86_64mod-1
> > +extra-test-objs += tst-x86_64mod-1.o
> >  LDFLAGS-tst-x86_64mod-1.so = -Wl,-soname,tst-x86_64mod-1.so
> >  ifneq (no,$(have-tunables))
> >  # Test the state size for XSAVE when XSAVEC is disabled.
> > @@ -63,6 +64,7 @@ $(objpfx)tst-x86_64-1: $(objpfx)x86_64/tst-x86_64mod-1.so
> >  ifneq (no,$(have-tunables))
> >  tests += tst-platform-1
> >  modules-names += tst-platformmod-1 x86_64/tst-platformmod-2
> > +extra-test-objs += tst-platformmod-2.o
> >  CFLAGS-tst-platform-1.c = -mno-avx
> >  CFLAGS-tst-platformmod-1.c = -mno-avx
> >  CFLAGS-tst-platformmod-2.c = -mno-avx
> > diff --git a/sysdeps/x86_64/fpu/Makefile b/sysdeps/x86_64/fpu/Makefile
> > index 8278ce104a..2d1ab9e468 100644
> > --- a/sysdeps/x86_64/fpu/Makefile
> > +++ b/sysdeps/x86_64/fpu/Makefile
> > @@ -37,6 +37,12 @@ tests += \
> >    $(libmvec-abi-func-avx2-tests) \
> >    $(libmvec-abi-func-avx512f-tests)
> >
> > +extra-test-objs += \
> > +  test-libmvec.o \
> > +  test-libmvec-avx.o \
> > +  test-libmvec-avx2.o \
> > +  test-libmvec-avx512f.o
>
> Can we output this into libmvec.mk?
>
> Can we avoid a hardcoded list?
>
> I assume this list is derived from:
> 116          for i in "" "-avx" "-avx2" "-avx512f"; do \
> 117            for t in $(libmvec-abi-func-tests); do \
> 118              echo "\$$(objpfx)$$t$$i: \\"; \
> 119              echo "  \$$(objpfx)$$t$$i.o \\"; \
> 120              echo "  \$$(objpfx)test-libmvec$$i.o \$$(libmvec)"; \
> 121              echo; \
> 122            done; \

Fixed in the v2 patch:

https://sourceware.org/pipermail/libc-alpha/2022-February/136695.html

> > +
> >  double-vlen2-funcs = $(libmvec-funcs)
> >  double-vlen4-funcs = $(libmvec-funcs)
> >  double-vlen4-avx2-funcs = $(libmvec-funcs)
>

Thanks.
  

Patch

diff --git a/Makerules b/Makerules
index 5de2cec6be..428464f092 100644
--- a/Makerules
+++ b/Makerules
@@ -770,6 +770,7 @@  endif
 	     $(patsubst %.oS,%.d,$(filter %.oS,$(extra-objs))) \
 	     $(patsubst %.o,%.d,$(filter %.o,$(extra-test-objs:.os=.o))) \
 	     $(addsuffix .d,$(tests) $(tests-internal) $(xtests) \
+		$(tests-container) $(tests-printers) \
 		$(test-srcs) $(tests-time64) $(xtests-time64))
 ifeq ($(build-programs),yes)
 +depfiles += $(addsuffix .d,$(others) $(sysdep-others))
diff --git a/elf/Makefile b/elf/Makefile
index bff94954c9..281551d380 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -888,6 +888,9 @@  modules-names += \
 modules-names-tests = $(filter-out ifuncmod% tst-tlsmod%,\
 				   $(modules-names))
 
+# For +depfiles in Makerules.
+extra-test-objs += tst-auditmod17.os
+
 ifeq (yes,$(have-mtls-dialect-gnu2))
 tests += tst-gnu2-tls1
 modules-names += tst-gnu2-tls1mod
diff --git a/iconv/Makefile b/iconv/Makefile
index 5aeed346ef..a0d90cfeac 100644
--- a/iconv/Makefile
+++ b/iconv/Makefile
@@ -86,6 +86,7 @@  ifeq (yes,$(build-shared))
 tests += tst-gconv-init-failure
 modules-names += tst-gconv-init-failure-mod
 modules-names-tests += tst-gconv-init-failure-mod
+extra-test-objs += tst-gconv-init-failure-mod.os
 $(objpfx)tst-gconv-init-failure-mod.so: $(libsupport)
 $(objpfx)tst-gconv-init-failure.out: \
  $(objpfx)gconv-modules $(objpfx)tst-gconv-init-failure-mod.so
diff --git a/malloc/Makefile b/malloc/Makefile
index 2329cf718a..4e32de2a0b 100644
--- a/malloc/Makefile
+++ b/malloc/Makefile
@@ -145,7 +145,7 @@  extra-libs = libmemusage libc_malloc_debug
 extra-libs-others = $(extra-libs)
 
 # Helper objects for some tests.
-extra-tests-objs += \
+extra-test-objs += \
   tst-interpose-aux-nothread.o \
   tst-interpose-aux-thread.o \
 
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 7122f55975..ca953804d0 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -128,6 +128,9 @@  tests += tst-clone tst-clone2 tst-clone3 tst-fanotify tst-personality \
   tst-epoll \
   # tests
 
+# For +depfiles in Makerules.
+extra-test-objs += tst-sysconf-iov_max-uapi.o
+
 # Test for the symbol version of fcntl that was replaced in glibc 2.28.
 ifeq ($(have-GLIBC_2.27)$(build-shared),yesyes)
 tests += tst-ofdlocks-compat
diff --git a/sysdeps/x86_64/Makefile b/sysdeps/x86_64/Makefile
index 7a4b576356..79365aff2a 100644
--- a/sysdeps/x86_64/Makefile
+++ b/sysdeps/x86_64/Makefile
@@ -52,6 +52,7 @@  CFLAGS-tst-quad2pie.c = $(PIE-ccflag)
 
 tests += tst-x86_64-1
 modules-names += x86_64/tst-x86_64mod-1
+extra-test-objs += tst-x86_64mod-1.o
 LDFLAGS-tst-x86_64mod-1.so = -Wl,-soname,tst-x86_64mod-1.so
 ifneq (no,$(have-tunables))
 # Test the state size for XSAVE when XSAVEC is disabled.
@@ -63,6 +64,7 @@  $(objpfx)tst-x86_64-1: $(objpfx)x86_64/tst-x86_64mod-1.so
 ifneq (no,$(have-tunables))
 tests += tst-platform-1
 modules-names += tst-platformmod-1 x86_64/tst-platformmod-2
+extra-test-objs += tst-platformmod-2.o
 CFLAGS-tst-platform-1.c = -mno-avx
 CFLAGS-tst-platformmod-1.c = -mno-avx
 CFLAGS-tst-platformmod-2.c = -mno-avx
diff --git a/sysdeps/x86_64/fpu/Makefile b/sysdeps/x86_64/fpu/Makefile
index 8278ce104a..2d1ab9e468 100644
--- a/sysdeps/x86_64/fpu/Makefile
+++ b/sysdeps/x86_64/fpu/Makefile
@@ -37,6 +37,12 @@  tests += \
   $(libmvec-abi-func-avx2-tests) \
   $(libmvec-abi-func-avx512f-tests)
 
+extra-test-objs += \
+  test-libmvec.o \
+  test-libmvec-avx.o \
+  test-libmvec-avx2.o \
+  test-libmvec-avx512f.o
+
 double-vlen2-funcs = $(libmvec-funcs)
 double-vlen4-funcs = $(libmvec-funcs)
 double-vlen4-avx2-funcs = $(libmvec-funcs)