3b25a6
commit dd2315a866a4ac2b838ea1cb10c5ea1c35d51a2f
3b25a6
Author: Florian Weimer <fweimer@redhat.com>
3b25a6
Date:   Tue Aug 16 08:27:50 2022 +0200
3b25a6
3b25a6
    elf: Run tst-audit-tlsdesc, tst-audit-tlsdesc-dlopen everywhere
3b25a6
    
3b25a6
    The test is valid for all TLS models, but we want to make a reasonable
3b25a6
    effort to test the GNU2 model specifically.  For example, aarch64
3b25a6
    defaults to GNU2, but does not have -mtls-dialect=gnu2, and the test
3b25a6
    was not run there.
3b25a6
    
3b25a6
    Suggested-by: Martin Coufal <mcoufal@redhat.com>
3b25a6
3b25a6
Conflicts:
3b25a6
	elf/Makefile
3b25a6
	  (missing tst-align3 backport, missing libdl integration)
3b25a6
3b25a6
diff --git a/elf/Makefile b/elf/Makefile
3b25a6
index 9e721d5d4e0a1cd9..1dd36ba0486e56a0 100644
3b25a6
--- a/elf/Makefile
3b25a6
+++ b/elf/Makefile
3b25a6
@@ -331,6 +331,8 @@ tests += \
3b25a6
   tst-addr1 \
3b25a6
   tst-align \
3b25a6
   tst-align2 \
3b25a6
+  tst-audit-tlsdesc \
3b25a6
+  tst-audit-tlsdesc-dlopen \
3b25a6
   tst-audit1 \
3b25a6
   tst-audit11 \
3b25a6
   tst-audit12 \
3b25a6
@@ -607,6 +609,8 @@ modules-names = \
3b25a6
   tst-alignmod2 \
3b25a6
   tst-array2dep \
3b25a6
   tst-array5dep \
3b25a6
+  tst-audit-tlsdesc-mod1 \
3b25a6
+  tst-audit-tlsdesc-mod2 \
3b25a6
   tst-audit11mod1 \
3b25a6
   tst-audit11mod2 \
3b25a6
   tst-audit12mod1 \
3b25a6
@@ -640,6 +644,7 @@ modules-names = \
3b25a6
   tst-auditmanymod7 \
3b25a6
   tst-auditmanymod8 \
3b25a6
   tst-auditmanymod9 \
3b25a6
+  tst-auditmod-tlsdesc  \
3b25a6
   tst-auditmod1 \
3b25a6
   tst-auditmod9a \
3b25a6
   tst-auditmod9b \
3b25a6
@@ -809,23 +814,8 @@ modules-names += tst-gnu2-tls1mod
3b25a6
 $(objpfx)tst-gnu2-tls1: $(objpfx)tst-gnu2-tls1mod.so
3b25a6
 tst-gnu2-tls1mod.so-no-z-defs = yes
3b25a6
 CFLAGS-tst-gnu2-tls1mod.c += -mtls-dialect=gnu2
3b25a6
+endif # $(have-mtls-dialect-gnu2)
3b25a6
 
3b25a6
-tests += tst-audit-tlsdesc tst-audit-tlsdesc-dlopen
3b25a6
-modules-names += tst-audit-tlsdesc-mod1 tst-audit-tlsdesc-mod2 tst-auditmod-tlsdesc
3b25a6
-$(objpfx)tst-audit-tlsdesc: $(objpfx)tst-audit-tlsdesc-mod1.so \
3b25a6
-			    $(objpfx)tst-audit-tlsdesc-mod2.so \
3b25a6
-			    $(shared-thread-library)
3b25a6
-CFLAGS-tst-audit-tlsdesc-mod1.c += -mtls-dialect=gnu2
3b25a6
-CFLAGS-tst-audit-tlsdesc-mod2.c += -mtls-dialect=gnu2
3b25a6
-$(objpfx)tst-audit-tlsdesc-dlopen: $(shared-thread-library) $(libdl)
3b25a6
-$(objpfx)tst-audit-tlsdesc-dlopen.out: $(objpfx)tst-audit-tlsdesc-mod1.so \
3b25a6
-				       $(objpfx)tst-audit-tlsdesc-mod2.so
3b25a6
-$(objpfx)tst-audit-tlsdesc-mod1.so: $(objpfx)tst-audit-tlsdesc-mod2.so
3b25a6
-$(objpfx)tst-audit-tlsdesc.out: $(objpfx)tst-auditmod-tlsdesc.so
3b25a6
-tst-audit-tlsdesc-ENV = LD_AUDIT=$(objpfx)tst-auditmod-tlsdesc.so
3b25a6
-$(objpfx)tst-audit-tlsdesc-dlopen.out: $(objpfx)tst-auditmod-tlsdesc.so
3b25a6
-tst-audit-tlsdesc-dlopen-ENV = LD_AUDIT=$(objpfx)tst-auditmod-tlsdesc.so
3b25a6
-endif
3b25a6
 ifeq (yes,$(have-protected-data))
3b25a6
 modules-names += tst-protected1moda tst-protected1modb
3b25a6
 tests += tst-protected1a tst-protected1b
3b25a6
@@ -2559,5 +2549,23 @@ $(objpfx)tst-tls21.out: $(objpfx)tst-tls21mod.so
3b25a6
 $(objpfx)tst-tls21mod.so: $(tst-tls-many-dynamic-modules:%=$(objpfx)%.so)
3b25a6
 
3b25a6
 $(objpfx)tst-rtld-run-static.out: $(objpfx)/ldconfig
3b25a6
+
3b25a6
 $(objpfx)tst-dlmopen-gethostbyname: $(libdl)
3b25a6
 $(objpfx)tst-dlmopen-gethostbyname.out: $(objpfx)tst-dlmopen-gethostbyname-mod.so
3b25a6
+$(objpfx)tst-audit-tlsdesc: $(objpfx)tst-audit-tlsdesc-mod1.so \
3b25a6
+			    $(objpfx)tst-audit-tlsdesc-mod2.so \
3b25a6
+			    $(shared-thread-library)
3b25a6
+ifeq (yes,$(have-mtls-dialect-gnu2))
3b25a6
+# The test is valid for all TLS types, but we want to exercise GNU2
3b25a6
+# TLS if possible.
3b25a6
+CFLAGS-tst-audit-tlsdesc-mod1.c += -mtls-dialect=gnu2
3b25a6
+CFLAGS-tst-audit-tlsdesc-mod2.c += -mtls-dialect=gnu2
3b25a6
+endif
3b25a6
+$(objpfx)tst-audit-tlsdesc-dlopen: $(shared-thread-library) $(libdl)
3b25a6
+$(objpfx)tst-audit-tlsdesc-dlopen.out: $(objpfx)tst-audit-tlsdesc-mod1.so \
3b25a6
+				       $(objpfx)tst-audit-tlsdesc-mod2.so
3b25a6
+$(objpfx)tst-audit-tlsdesc-mod1.so: $(objpfx)tst-audit-tlsdesc-mod2.so
3b25a6
+$(objpfx)tst-audit-tlsdesc.out: $(objpfx)tst-auditmod-tlsdesc.so
3b25a6
+tst-audit-tlsdesc-ENV = LD_AUDIT=$(objpfx)tst-auditmod-tlsdesc.so
3b25a6
+$(objpfx)tst-audit-tlsdesc-dlopen.out: $(objpfx)tst-auditmod-tlsdesc.so
3b25a6
+tst-audit-tlsdesc-dlopen-ENV = LD_AUDIT=$(objpfx)tst-auditmod-tlsdesc.so