public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [RFC 0/9] Remove legacy platform bits and cleanups
@ 2024-06-07 11:42 Stefan Liebler
  2024-06-07 11:42 ` [RFC 1/9] x86: Remove HWCAP_START and HWCAP_COUNT Stefan Liebler
                   ` (10 more replies)
  0 siblings, 11 replies; 30+ messages in thread
From: Stefan Liebler @ 2024-06-07 11:42 UTC (permalink / raw)
  To: libc-alpha; +Cc: fweimer, devel, adhemerval.zanella, bergner, Stefan Liebler

This patch series is the result of:
"Question regarding platform-bits in ld.so.cache"
https://sourceware.org/pipermail/libc-alpha/2024-May/156793.html

According to the NEWS entry for glibc 2.37:
glibc commit "Add NEWS entry for legacy hwcaps removal"
https://sourceware.org/git/?p=glibc.git;a=commit;h=78d9a1620b840deb0880686e4159eaf70708866a
The dynamic linker no longer no longer loads shared objects from ... or
the subdirectory that corresponds to the AT_PLATFORM system name ...

According to Florian Weimer, it was an oversight and the usage of
_dl_string_platform(), _DL_PLATFORMS_COUNT and _DL_HWCAP_PLATFORM
should be removed in elf/dl-cache.c:search_cache().

This is done in the second patch of this series:
elf: Remove loading legacy hwcaps/platform entries in dynamic loader

The first patch is another oversight and HWCAP_START/HWCAP_COUNT on
x86 is not needed anymore after commit
ab40f20364f4a417a63dd51fdd943742070bfe96
"elf: Remove _dl_string_hwcap".

The remaining patches could cleanup even more things. But I've
currently marked this series as RFC as there are open questions.

- "elf: Remove _dl_string_platform"
_dl_string_platform() is now only used in the ld.so diagnostics output
on all architectures despite of powerpc where the result is stored in
tcb. Thus we could remove it everywhere else.

If it is okay for powerpc to remove the ld.so diagnostics output, the
arch-specific dl-procinfo.h files does not need _dl_string_platform()
anymore and we can just remove it.

If we keep the ld.so diagnostics output, we could just use the generic
macro-defintion in all the other arch-specific dl-procinfo.h files:
#define _dl_string_platform(str) (-1)


- "elf: Remove platform strings in dl-procinfo.c"
If _dl_string_platform() or the implementation is removed, the strings
are also not used anymore and can be removed. Of course not for powerpc.


- "elf: Remove _DL_HWCAP_PLATFORM"
Those macros are not used anymore after removal in
elf/dl-cache.c:search_cache(), _dl_string_platform().


- "elf: Remove _DL_FIRST_PLATFORM"
Those macros are not used anymore after removal in
_dl_string_platform().


- "elf: Remove _DL_PLATFORMS_COUNT"
Those macros are not used anymore after removal in
elf/dl-cache.c:search_cache() and _dl_string_platform().


- "elf: Remove LD_HWCAP_MASK / tunable glibc.cpu.hwcap_mask"
The environment variable LD_HWCAP_MASK / glibc-tunable
glibc.cpu.hwcap_mask is not used anymore after removal in
elf/dl-cache.c:search_cache() despite of sparc32 where it is used in
elf_machine_matches_host().

If sparc32 does not need it anymore, we can get rid of it at all.

Otherwise we could also move LD_HWCAP_MASK / tunable
glibc.cpu.hwcap_mask to be sparc32 specific?


- "elf: Remove HWCAP_IMPORTANT"
This is only dumped in the ld.so diagnostic output and was used as
default-value for LD_HWCAP_MASK / tunable glibc.cpu.hwcap_mask.


Stefan Liebler (9):
  x86: Remove HWCAP_START and HWCAP_COUNT
  elf: Remove loading legacy hwcaps/platform entries in dynamic loader
  elf: Remove _dl_string_platform
  elf: Remove platform strings in dl-procinfo.c
  elf: Remove _DL_HWCAP_PLATFORM
  elf: Remove _DL_FIRST_PLATFORM
  elf: Remove _DL_PLATFORMS_COUNT
  elf: Remove LD_HWCAP_MASK / tunable glibc.cpu.hwcap_mask
  elf: Remove HWCAP_IMPORTANT

 elf/dl-cache.c                                | 22 +------
 elf/dl-diagnostics.c                          |  3 -
 elf/dl-tunables.list                          |  7 ---
 elf/tst-env-setuid.c                          |  1 -
 manual/README.tunables                        | 12 ++--
 manual/tunables.texi                          | 11 ----
 sysdeps/alpha/dl-procinfo.c                   | 62 -------------------
 sysdeps/alpha/dl-procinfo.h                   | 24 -------
 sysdeps/csky/dl-procinfo.c                    | 62 -------------------
 sysdeps/csky/dl-procinfo.h                    | 23 -------
 sysdeps/generic/dl-procinfo.h                 |  8 ---
 sysdeps/generic/unsecvars.h                   |  1 -
 sysdeps/mips/dl-procinfo.c                    | 62 -------------------
 sysdeps/mips/dl-procinfo.h                    | 24 -------
 sysdeps/powerpc/dl-procinfo.h                 |  8 ---
 sysdeps/s390/dl-procinfo-s390.c               |  6 --
 sysdeps/s390/dl-procinfo.h                    | 29 ---------
 sysdeps/sparc/dl-procinfo.h                   | 10 ---
 sysdeps/sparc/sparc32/dl-machine.h            |  6 --
 sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h |  8 ---
 sysdeps/unix/sysv/linux/arm/dl-procinfo.h     |  7 ---
 sysdeps/x86/dl-hwcap.h                        | 25 --------
 sysdeps/x86/dl-procinfo.c                     | 21 +------
 sysdeps/x86/dl-procinfo.h                     | 22 -------
 sysdeps/x86_64/dl-procruntime.c               |  5 +-
 25 files changed, 13 insertions(+), 456 deletions(-)
 delete mode 100644 sysdeps/alpha/dl-procinfo.c
 delete mode 100644 sysdeps/csky/dl-procinfo.c
 delete mode 100644 sysdeps/mips/dl-procinfo.c

-- 
2.45.0


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [RFC 1/9] x86: Remove HWCAP_START and HWCAP_COUNT
  2024-06-07 11:42 [RFC 0/9] Remove legacy platform bits and cleanups Stefan Liebler
@ 2024-06-07 11:42 ` Stefan Liebler
  2024-06-11 18:14   ` Adhemerval Zanella Netto
  2024-06-07 11:42 ` [RFC 2/9] elf: Remove loading legacy hwcaps/platform entries in dynamic loader Stefan Liebler
                   ` (9 subsequent siblings)
  10 siblings, 1 reply; 30+ messages in thread
From: Stefan Liebler @ 2024-06-07 11:42 UTC (permalink / raw)
  To: libc-alpha; +Cc: fweimer, devel, adhemerval.zanella, bergner, Stefan Liebler

Both defines are not used anymore.  Those were only used for
_dl_string_hwcap(), which itself was removed with commit
ab40f20364f4a417a63dd51fdd943742070bfe96
"elf: Remove _dl_string_hwcap"

Just clean up.
---
 sysdeps/x86/dl-hwcap.h | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/sysdeps/x86/dl-hwcap.h b/sysdeps/x86/dl-hwcap.h
index 21dd24d5d2..e14e755bd7 100644
--- a/sysdeps/x86/dl-hwcap.h
+++ b/sysdeps/x86/dl-hwcap.h
@@ -23,23 +23,17 @@
    to cover all platforms and hardware capabilities.  */
 # define HWCAP_PLATFORMS_START	0
 # define HWCAP_PLATFORMS_COUNT	4
-# define HWCAP_START		0
-# define HWCAP_COUNT		3
 # define HWCAP_IMPORTANT \
   (HWCAP_X86_SSE2 | HWCAP_X86_64 | HWCAP_X86_AVX512_1)
 #elif defined __x86_64__
 /* For 64 bit, only cover x86-64 platforms and capabilities.  */
 # define HWCAP_PLATFORMS_START	2
 # define HWCAP_PLATFORMS_COUNT	4
-# define HWCAP_START		1
-# define HWCAP_COUNT		3
 # define HWCAP_IMPORTANT	(HWCAP_X86_64 | HWCAP_X86_AVX512_1)
 #else
 /* For 32 bit, only cover i586, i686 and SSE2.  */
 # define HWCAP_PLATFORMS_START	0
 # define HWCAP_PLATFORMS_COUNT	2
-# define HWCAP_START		0
-# define HWCAP_COUNT		1
 # define HWCAP_IMPORTANT	(HWCAP_X86_SSE2)
 #endif
 
-- 
2.45.0


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [RFC 2/9] elf: Remove loading legacy hwcaps/platform entries in dynamic loader
  2024-06-07 11:42 [RFC 0/9] Remove legacy platform bits and cleanups Stefan Liebler
  2024-06-07 11:42 ` [RFC 1/9] x86: Remove HWCAP_START and HWCAP_COUNT Stefan Liebler
@ 2024-06-07 11:42 ` Stefan Liebler
  2024-06-11 18:57   ` Adhemerval Zanella Netto
  2024-06-07 11:42 ` [RFC 3/9] elf: Remove _dl_string_platform Stefan Liebler
                   ` (8 subsequent siblings)
  10 siblings, 1 reply; 30+ messages in thread
From: Stefan Liebler @ 2024-06-07 11:42 UTC (permalink / raw)
  To: libc-alpha; +Cc: fweimer, devel, adhemerval.zanella, bergner, Stefan Liebler

The legacy hwcaps mechanism was removed with glibc 2.37:
See this commit series:
- d178c67535f0d159df73843e7c18cbdb39b4d25d
x86_64: Remove platform directory library loading test
- 6099908fb84debee4c3bcb05d88769410c2aecd1
elf: Remove legacy hwcaps support from the dynamic loader
- b78ff5a25dc8ba9d8c6df10bb0a533254bdd193f
elf: Remove legacy hwcaps support from ldconfig
- 4a7094119ce05cadf927f52cc5d723e2195e65f9
elf: Remove hwcap parameter from add_to_cache signature
- cfbf883db36727a84ef7929af49ef68c195b5972
elf: Remove hwcap and bits_hwcap fields from struct cache_entry
- 78d9a1620b840deb0880686e4159eaf70708866a
Add NEWS entry for legacy hwcaps removal
- ab40f20364f4a417a63dd51fdd943742070bfe96
elf: Remove _dl_string_hwcap
- e76369ed6371734f77f468eab097ef4e5b5db1c5
elf: Simplify output of hwcap subdirectories in ld.so help

According to Florian Weimer, this was an oversight and should also
have been removed.

As ldconfig does not generate ld.so.cache entries with hwcap/platform
bits in the hwcap-field anymore, this patch now skips those entries.
Thus currently only named-hwcap-entries and the default entries are
allowed.
For named-hwcap entries bit 62 is set and also the isa-level bits can
be set.
For the default entries the hwcap-field is 0.
---
 elf/dl-cache.c | 22 +++-------------------
 1 file changed, 3 insertions(+), 19 deletions(-)

diff --git a/elf/dl-cache.c b/elf/dl-cache.c
index 85f3f179ed..7c7dc58745 100644
--- a/elf/dl-cache.c
+++ b/elf/dl-cache.c
@@ -27,10 +27,6 @@
 #include <dl-hwcaps.h>
 #include <dl-isa-level.h>
 
-#ifndef _DL_PLATFORMS_COUNT
-# define _DL_PLATFORMS_COUNT 0
-#endif
-
 /* This is the starting address and the size of the mmap()ed file.  */
 static struct cache_file *cache;
 static struct cache_file_new *cache_new;
@@ -201,15 +197,6 @@ search_cache (const char *string_table, uint32_t string_table_size,
 	      struct file_entry *libs, uint32_t nlibs, uint32_t entry_size,
 	      const char *name)
 {
-  /* Used by the HWCAP check in the struct file_entry_new case.  */
-  uint64_t platform = _dl_string_platform (GLRO (dl_platform));
-  if (platform != (uint64_t) -1)
-    platform = 1ULL << platform;
-  uint64_t hwcap_mask = TUNABLE_GET (glibc, cpu, hwcap_mask, uint64_t, NULL);
-#define _DL_HWCAP_TLS_MASK (1LL << 63)
-  uint64_t hwcap_exclude = ~((GLRO (dl_hwcap) & hwcap_mask)
-			     | _DL_HWCAP_PLATFORM | _DL_HWCAP_TLS_MASK);
-
   int left = 0;
   int right = nlibs - 1;
   const char *best = NULL;
@@ -295,12 +282,9 @@ search_cache (const char *string_table, uint32_t string_table_size,
 		      if (!named_hwcap && best != NULL)
 			break;
 
-		      if ((libnew->hwcap & hwcap_exclude) && !named_hwcap)
-			continue;
-		      if (_DL_PLATFORMS_COUNT
-			  && (libnew->hwcap & _DL_HWCAP_PLATFORM) != 0
-			  && ((libnew->hwcap & _DL_HWCAP_PLATFORM)
-			      != platform))
+		      /* Skip entries with the legacy hwcap/platform mechanism
+			 which was removed with glibc 2.37.  */
+		      if (!named_hwcap && libnew->hwcap != 0)
 			continue;
 
 #ifdef SHARED
-- 
2.45.0


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [RFC 3/9] elf: Remove _dl_string_platform
  2024-06-07 11:42 [RFC 0/9] Remove legacy platform bits and cleanups Stefan Liebler
  2024-06-07 11:42 ` [RFC 1/9] x86: Remove HWCAP_START and HWCAP_COUNT Stefan Liebler
  2024-06-07 11:42 ` [RFC 2/9] elf: Remove loading legacy hwcaps/platform entries in dynamic loader Stefan Liebler
@ 2024-06-07 11:42 ` Stefan Liebler
  2024-06-11 19:09   ` Adhemerval Zanella Netto
  2024-06-07 11:42 ` [RFC 4/9] elf: Remove platform strings in dl-procinfo.c Stefan Liebler
                   ` (7 subsequent siblings)
  10 siblings, 1 reply; 30+ messages in thread
From: Stefan Liebler @ 2024-06-07 11:42 UTC (permalink / raw)
  To: libc-alpha; +Cc: fweimer, devel, adhemerval.zanella, bergner, Stefan Liebler

Despite of powerpc where the returned integer is stored in tcb,
and the diagnostics output, there is no user anymore.

Thus this patch removes the diagnostics output and
_dl_string_platform for all other platforms.
---
 elf/dl-diagnostics.c                          |  2 --
 sysdeps/alpha/dl-procinfo.h                   | 15 ---------------
 sysdeps/csky/dl-procinfo.h                    | 15 ---------------
 sysdeps/generic/dl-procinfo.h                 |  2 --
 sysdeps/mips/dl-procinfo.h                    | 15 ---------------
 sysdeps/s390/dl-procinfo.h                    | 15 ---------------
 sysdeps/sparc/dl-procinfo.h                   |  2 --
 sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h |  2 --
 sysdeps/unix/sysv/linux/arm/dl-procinfo.h     |  2 --
 sysdeps/x86/dl-procinfo.h                     | 15 ---------------
 10 files changed, 85 deletions(-)

diff --git a/elf/dl-diagnostics.c b/elf/dl-diagnostics.c
index aaf67b87e8..e69463b2bd 100644
--- a/elf/dl-diagnostics.c
+++ b/elf/dl-diagnostics.c
@@ -245,8 +245,6 @@ _dl_print_diagnostics (char **environ)
   _dl_diagnostics_print_labeled_string ("dl_platform", GLRO (dl_platform));
   _dl_diagnostics_print_labeled_string
     ("dl_profile_output", GLRO (dl_profile_output));
-  _dl_diagnostics_print_labeled_value
-    ("dl_string_platform", _dl_string_platform ( GLRO (dl_platform)));
 
   _dl_diagnostics_print_labeled_string ("dso.ld", LD_SO);
   _dl_diagnostics_print_labeled_string ("dso.libc", LIBC_SO);
diff --git a/sysdeps/alpha/dl-procinfo.h b/sysdeps/alpha/dl-procinfo.h
index f1e2e98e08..bc4db868a9 100644
--- a/sysdeps/alpha/dl-procinfo.h
+++ b/sysdeps/alpha/dl-procinfo.h
@@ -27,21 +27,6 @@
 
 #define _DL_PLATFORMS_COUNT   5
 
-static inline int
-__attribute__ ((unused, always_inline))
-_dl_string_platform (const char *str)
-{
-  int i;
-
-  if (str != NULL)
-    for (i = 0; i < _DL_PLATFORMS_COUNT; ++i)
-      {
-        if (strcmp (str, GLRO(dl_alpha_platforms)[i]) == 0)
-          return i;
-      }
-  return -1;
-};
-
 /* We cannot provide a general printing function.  */
 #define _dl_procinfo(type, word) -1
 
diff --git a/sysdeps/csky/dl-procinfo.h b/sysdeps/csky/dl-procinfo.h
index 77621e4b20..a54e8de446 100644
--- a/sysdeps/csky/dl-procinfo.h
+++ b/sysdeps/csky/dl-procinfo.h
@@ -27,21 +27,6 @@
 
 #define _DL_PLATFORMS_COUNT   4
 
-static inline int
-__attribute__ ((unused, always_inline))
-_dl_string_platform (const char *str)
-{
-  int i;
-
-  if (str != NULL)
-    for (i = 0; i < _DL_PLATFORMS_COUNT; ++i)
-      {
-        if (strcmp (str, GLRO(dl_csky_platforms)[i]) == 0)
-          return i;
-      }
-  return -1;
-};
-
 /* We cannot provide a general printing function.  */
 #define _dl_procinfo(word, val) -1
 
diff --git a/sysdeps/generic/dl-procinfo.h b/sysdeps/generic/dl-procinfo.h
index c4818497c8..00e1ae7b2f 100644
--- a/sysdeps/generic/dl-procinfo.h
+++ b/sysdeps/generic/dl-procinfo.h
@@ -34,6 +34,4 @@
 /* We don't have any hardware capabilities.  */
 #define _DL_HWCAP_COUNT 0
 
-#define _dl_string_platform(str) (-1)
-
 #endif /* dl-procinfo.h */
diff --git a/sysdeps/mips/dl-procinfo.h b/sysdeps/mips/dl-procinfo.h
index 6655e68f54..3199434390 100644
--- a/sysdeps/mips/dl-procinfo.h
+++ b/sysdeps/mips/dl-procinfo.h
@@ -27,21 +27,6 @@
 
 #define _DL_PLATFORMS_COUNT   4
 
-static inline int
-__attribute__ ((unused, always_inline))
-_dl_string_platform (const char *str)
-{
-  int i;
-
-  if (str != NULL)
-    for (i = 0; i < _DL_PLATFORMS_COUNT; ++i)
-      {
-        if (strcmp (str, GLRO(dl_mips_platforms)[i]) == 0)
-          return i;
-      }
-  return -1;
-};
-
 /* We cannot provide a general printing function.  */
 #define _dl_procinfo(type, word) -1
 
diff --git a/sysdeps/s390/dl-procinfo.h b/sysdeps/s390/dl-procinfo.h
index 38e77f7ad9..ffeb655ad0 100644
--- a/sysdeps/s390/dl-procinfo.h
+++ b/sysdeps/s390/dl-procinfo.h
@@ -83,19 +83,4 @@ _dl_hwcap_string (int idx)
   return _dl_s390_cap_flags[idx];
 };
 
-static inline int
-__attribute__ ((unused, always_inline))
-_dl_string_platform (const char *str)
-{
-  int i;
-
-  if (str != NULL)
-    for (i = 0; i < _DL_PLATFORMS_COUNT; ++i)
-      {
-	if (strcmp (str, _dl_s390_platforms[i]) == 0)
-	  return _DL_FIRST_PLATFORM + i;
-      }
-  return -1;
-};
-
 #endif /* dl-procinfo.h */
diff --git a/sysdeps/sparc/dl-procinfo.h b/sysdeps/sparc/dl-procinfo.h
index 61cd296de0..dbb1a4d324 100644
--- a/sysdeps/sparc/dl-procinfo.h
+++ b/sysdeps/sparc/dl-procinfo.h
@@ -60,6 +60,4 @@ _dl_hwcap_string (int idx)
 /* There're no platforms to filter out.  */
 #define _DL_HWCAP_PLATFORM 0
 
-#define _dl_string_platform(str) (-1)
-
 #endif /* dl-procinfo.h */
diff --git a/sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h b/sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h
index 6a3fb78c47..0ed89c5e41 100644
--- a/sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h
+++ b/sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h
@@ -40,6 +40,4 @@ _dl_hwcap_string (int idx)
 /* There're no platforms to filter out.  */
 #define _DL_HWCAP_PLATFORM 0
 
-#define _dl_string_platform(str) (-1)
-
 #endif /* dl-procinfo.h */
diff --git a/sysdeps/unix/sysv/linux/arm/dl-procinfo.h b/sysdeps/unix/sysv/linux/arm/dl-procinfo.h
index 49cf0008b2..2a1c5985ee 100644
--- a/sysdeps/unix/sysv/linux/arm/dl-procinfo.h
+++ b/sysdeps/unix/sysv/linux/arm/dl-procinfo.h
@@ -75,6 +75,4 @@ _dl_procinfo (unsigned int type, unsigned long int word)
 
 #define HWCAP_IMPORTANT		(HWCAP_ARM_VFP | HWCAP_ARM_NEON)
 
-#define _dl_string_platform(str) (-1)
-
 #endif /* dl-procinfo.h */
diff --git a/sysdeps/x86/dl-procinfo.h b/sysdeps/x86/dl-procinfo.h
index 3902925be4..b2184b8f5d 100644
--- a/sysdeps/x86/dl-procinfo.h
+++ b/sysdeps/x86/dl-procinfo.h
@@ -30,19 +30,4 @@
 #define _DL_HWCAP_PLATFORM	(((1ULL << _DL_PLATFORMS_COUNT) - 1) \
 				 << _DL_FIRST_PLATFORM)
 
-static inline int
-__attribute__ ((unused, always_inline))
-_dl_string_platform (const char *str)
-{
-  int i;
-
-  if (str != NULL)
-    for (i = HWCAP_PLATFORMS_START; i < HWCAP_PLATFORMS_COUNT; ++i)
-      {
-	if (strcmp (str, GLRO(dl_x86_platforms)[i]) == 0)
-	  return _DL_FIRST_PLATFORM + i;
-      }
-  return -1;
-};
-
 #endif /* dl-procinfo.h */
-- 
2.45.0


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [RFC 4/9] elf: Remove platform strings in dl-procinfo.c
  2024-06-07 11:42 [RFC 0/9] Remove legacy platform bits and cleanups Stefan Liebler
                   ` (2 preceding siblings ...)
  2024-06-07 11:42 ` [RFC 3/9] elf: Remove _dl_string_platform Stefan Liebler
@ 2024-06-07 11:42 ` Stefan Liebler
  2024-06-11 19:20   ` Adhemerval Zanella Netto
  2024-06-07 11:42 ` [RFC 5/9] elf: Remove _DL_HWCAP_PLATFORM Stefan Liebler
                   ` (6 subsequent siblings)
  10 siblings, 1 reply; 30+ messages in thread
From: Stefan Liebler @ 2024-06-07 11:42 UTC (permalink / raw)
  To: libc-alpha; +Cc: fweimer, devel, adhemerval.zanella, bergner, Stefan Liebler

Remove the platform strings in dl-procinfo.c where also
the implementation of _dl_string_platform() was removed.
---
 sysdeps/alpha/dl-procinfo.c     | 62 ---------------------------------
 sysdeps/csky/dl-procinfo.c      | 62 ---------------------------------
 sysdeps/mips/dl-procinfo.c      | 62 ---------------------------------
 sysdeps/s390/dl-procinfo-s390.c |  6 ----
 sysdeps/s390/dl-procinfo.h      |  1 -
 sysdeps/x86/dl-procinfo.c       | 16 ---------
 6 files changed, 209 deletions(-)
 delete mode 100644 sysdeps/alpha/dl-procinfo.c
 delete mode 100644 sysdeps/csky/dl-procinfo.c
 delete mode 100644 sysdeps/mips/dl-procinfo.c

diff --git a/sysdeps/alpha/dl-procinfo.c b/sysdeps/alpha/dl-procinfo.c
deleted file mode 100644
index 633dcbf974..0000000000
--- a/sysdeps/alpha/dl-procinfo.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Data for Alpha version of processor capability information.
-   Copyright (C) 2008-2024 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library.  If not, see
-   <https://www.gnu.org/licenses/>.  */
-
-/* This information must be kept in sync with the _DL_PLATFORM_COUNT
-   definitions in procinfo.h.
-
-   If anything should be added here check whether the size of each string
-   is still ok with the given array size.
-
-   All the #ifdefs in the definitions are quite irritating but
-   necessary if we want to avoid duplicating the information.  There
-   are three different modes:
-
-   - PROCINFO_DECL is defined.  This means we are only interested in
-     declarations.
-
-   - PROCINFO_DECL is not defined:
-
-     + if SHARED is defined the file is included in an array
-       initializer.  The .element = { ... } syntax is needed.
-
-     + if SHARED is not defined a normal array initialization is
-       needed.
-  */
-
-#ifndef PROCINFO_CLASS
-#define PROCINFO_CLASS
-#endif
-
-#if !defined PROCINFO_DECL && defined SHARED
-  ._dl_alpha_platforms
-#else
-PROCINFO_CLASS const char _dl_alpha_platforms[5][5]
-#endif
-#ifndef PROCINFO_DECL
-= {
-    "ev4", "ev5", "ev56", "ev6", "ev67"
-  }
-#endif
-#if !defined SHARED || defined PROCINFO_DECL
-;
-#else
-,
-#endif
-
-#undef PROCINFO_DECL
-#undef PROCINFO_CLASS
diff --git a/sysdeps/csky/dl-procinfo.c b/sysdeps/csky/dl-procinfo.c
deleted file mode 100644
index 0c81518cff..0000000000
--- a/sysdeps/csky/dl-procinfo.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Data for C-SKY version of processor capability information.
-   Copyright (C) 2018-2024 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library.  If not, see
-   <https://www.gnu.org/licenses/>.  */
-
-/* This information must be kept in sync with the _DL_PLATFORM_COUNT
-   definitions in procinfo.h.
-
-   If anything should be added here check whether the size of each string
-   is still ok with the given array size.
-
-   All the #ifdefs in the definitions are quite irritating but
-   necessary if we want to avoid duplicating the information.  There
-   are three different modes:
-
-   - PROCINFO_DECL is defined.  This means we are only interested in
-     declarations.
-
-   - PROCINFO_DECL is not defined:
-
-     + if SHARED is defined the file is included in an array
-       initializer.  The .element = { ... } syntax is needed.
-
-     + if SHARED is not defined a normal array initialization is
-       needed.
-  */
-
-#ifndef PROCINFO_CLASS
-# define PROCINFO_CLASS
-#endif
-
-#if !defined PROCINFO_DECL && defined SHARED
-  ._dl_csky_platforms
-#else
-PROCINFO_CLASS const char _dl_csky_platforms[4][6]
-#endif
-#ifndef PROCINFO_DECL
-= {
-    "ck610", "ck807", "ck810", "ck860"
-  }
-#endif
-#if !defined SHARED || defined PROCINFO_DECL
-;
-#else
-,
-#endif
-
-#undef PROCINFO_DECL
-#undef PROCINFO_CLASS
diff --git a/sysdeps/mips/dl-procinfo.c b/sysdeps/mips/dl-procinfo.c
deleted file mode 100644
index 0b1dfeea2d..0000000000
--- a/sysdeps/mips/dl-procinfo.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Data for Mips version of processor capability information.
-   Copyright (C) 2007-2024 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library.  If not, see
-   <https://www.gnu.org/licenses/>.  */
-
-/* This information must be kept in sync with the _DL_PLATFORM_COUNT
-   definitions in procinfo.h.
-
-   If anything should be added here check whether the size of each string
-   is still ok with the given array size.
-
-   All the #ifdefs in the definitions are quite irritating but
-   necessary if we want to avoid duplicating the information.  There
-   are three different modes:
-
-   - PROCINFO_DECL is defined.  This means we are only interested in
-     declarations.
-
-   - PROCINFO_DECL is not defined:
-
-     + if SHARED is defined the file is included in an array
-       initializer.  The .element = { ... } syntax is needed.
-
-     + if SHARED is not defined a normal array initialization is
-       needed.
-  */
-
-#ifndef PROCINFO_CLASS
-#define PROCINFO_CLASS
-#endif
-
-#if !defined PROCINFO_DECL && defined SHARED
-  ._dl_mips_platforms
-#else
-PROCINFO_CLASS const char _dl_mips_platforms[4][11]
-#endif
-#ifndef PROCINFO_DECL
-= {
-    "loongson2e", "loongson2f", "octeon", "octeon2"
-  }
-#endif
-#if !defined SHARED || defined PROCINFO_DECL
-;
-#else
-,
-#endif
-
-#undef PROCINFO_DECL
-#undef PROCINFO_CLASS
diff --git a/sysdeps/s390/dl-procinfo-s390.c b/sysdeps/s390/dl-procinfo-s390.c
index 2821e40cb1..652f6067a3 100644
--- a/sysdeps/s390/dl-procinfo-s390.c
+++ b/sysdeps/s390/dl-procinfo-s390.c
@@ -24,9 +24,3 @@ const char _dl_s390_cap_flags[_DL_HWCAP_COUNT][9] =
     "highgprs", "te", "vx", "vxd", "vxe", "gs", "vxe2", "vxp", "sort", "dflt",
     "vxp2", "nnpa", "pcimio", "sie"
   };
-
-const char _dl_s390_platforms[_DL_PLATFORMS_COUNT][7] =
-  {
-    "g5", "z900", "z990", "z9-109", "z10", "z196", "zEC12", "z13", "z14", "z15",
-    "z16"
-  };
diff --git a/sysdeps/s390/dl-procinfo.h b/sysdeps/s390/dl-procinfo.h
index ffeb655ad0..63c9889f94 100644
--- a/sysdeps/s390/dl-procinfo.h
+++ b/sysdeps/s390/dl-procinfo.h
@@ -24,7 +24,6 @@
 extern const char _dl_s390_cap_flags[_DL_HWCAP_COUNT][9] attribute_hidden;
 
 #define _DL_PLATFORMS_COUNT	11
-extern const char _dl_s390_platforms[_DL_PLATFORMS_COUNT][7] attribute_hidden;
 
 /* The kernel provides up to 32 capability bits with elf_hwcap.  */
 #define _DL_FIRST_PLATFORM	32
diff --git a/sysdeps/x86/dl-procinfo.c b/sysdeps/x86/dl-procinfo.c
index 5920d4b320..165ffd89a9 100644
--- a/sysdeps/x86/dl-procinfo.c
+++ b/sysdeps/x86/dl-procinfo.c
@@ -71,22 +71,6 @@ PROCINFO_CLASS const char _dl_x86_hwcap_flags[3][9]
 ,
 #endif
 
-#if !defined PROCINFO_DECL && defined SHARED
-  ._dl_x86_platforms
-#else
-PROCINFO_CLASS const char _dl_x86_platforms[4][9]
-#endif
-#ifndef PROCINFO_DECL
-= {
-    "i586", "i686", "haswell", "xeon_phi"
-  }
-#endif
-#if !defined SHARED || defined PROCINFO_DECL
-;
-#else
-,
-#endif
-
 #if defined SHARED && !IS_IN (ldconfig)
 # if !defined PROCINFO_DECL
   ._dl_x86_tlsdesc_dynamic
-- 
2.45.0


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [RFC 5/9] elf: Remove _DL_HWCAP_PLATFORM
  2024-06-07 11:42 [RFC 0/9] Remove legacy platform bits and cleanups Stefan Liebler
                   ` (3 preceding siblings ...)
  2024-06-07 11:42 ` [RFC 4/9] elf: Remove platform strings in dl-procinfo.c Stefan Liebler
@ 2024-06-07 11:42 ` Stefan Liebler
  2024-06-11 19:28   ` Adhemerval Zanella Netto
  2024-06-07 11:42 ` [RFC 6/9] elf: Remove _DL_FIRST_PLATFORM Stefan Liebler
                   ` (5 subsequent siblings)
  10 siblings, 1 reply; 30+ messages in thread
From: Stefan Liebler @ 2024-06-07 11:42 UTC (permalink / raw)
  To: libc-alpha; +Cc: fweimer, devel, adhemerval.zanella, bergner, Stefan Liebler

Remove the definitions of _DL_HWCAP_PLATFORM as those are not used
anymore after removal in elf/dl-cache.c:search_cache().
---
 sysdeps/alpha/dl-procinfo.h                   | 3 ---
 sysdeps/csky/dl-procinfo.h                    | 2 --
 sysdeps/generic/dl-procinfo.h                 | 3 ---
 sysdeps/mips/dl-procinfo.h                    | 3 ---
 sysdeps/powerpc/dl-procinfo.h                 | 3 ---
 sysdeps/s390/dl-procinfo.h                    | 3 ---
 sysdeps/sparc/dl-procinfo.h                   | 3 ---
 sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h | 3 ---
 sysdeps/unix/sysv/linux/arm/dl-procinfo.h     | 3 ---
 sysdeps/x86/dl-procinfo.h                     | 3 ---
 10 files changed, 29 deletions(-)

diff --git a/sysdeps/alpha/dl-procinfo.h b/sysdeps/alpha/dl-procinfo.h
index bc4db868a9..90f83ec24e 100644
--- a/sysdeps/alpha/dl-procinfo.h
+++ b/sysdeps/alpha/dl-procinfo.h
@@ -22,9 +22,6 @@
 #include <ldsodefs.h>
 
 
-/* Mask to filter out platforms.  */
-#define _DL_HWCAP_PLATFORM    (-1ULL)
-
 #define _DL_PLATFORMS_COUNT   5
 
 /* We cannot provide a general printing function.  */
diff --git a/sysdeps/csky/dl-procinfo.h b/sysdeps/csky/dl-procinfo.h
index a54e8de446..803441f52c 100644
--- a/sysdeps/csky/dl-procinfo.h
+++ b/sysdeps/csky/dl-procinfo.h
@@ -22,8 +22,6 @@
 
 #include <ldsodefs.h>
 
-/* Mask to filter out platforms.  */
-#define _DL_HWCAP_PLATFORM    (-1ULL)
 
 #define _DL_PLATFORMS_COUNT   4
 
diff --git a/sysdeps/generic/dl-procinfo.h b/sysdeps/generic/dl-procinfo.h
index 00e1ae7b2f..1778fd1057 100644
--- a/sysdeps/generic/dl-procinfo.h
+++ b/sysdeps/generic/dl-procinfo.h
@@ -28,9 +28,6 @@
 /* By default there is no important hardware capability.  */
 #define HWCAP_IMPORTANT (0)
 
-/* There're no platforms to filter out.  */
-#define _DL_HWCAP_PLATFORM 0
-
 /* We don't have any hardware capabilities.  */
 #define _DL_HWCAP_COUNT 0
 
diff --git a/sysdeps/mips/dl-procinfo.h b/sysdeps/mips/dl-procinfo.h
index 3199434390..7185542eac 100644
--- a/sysdeps/mips/dl-procinfo.h
+++ b/sysdeps/mips/dl-procinfo.h
@@ -22,9 +22,6 @@
 #include <ldsodefs.h>
 
 
-/* Mask to filter out platforms.  */
-#define _DL_HWCAP_PLATFORM    (-1ULL)
-
 #define _DL_PLATFORMS_COUNT   4
 
 /* We cannot provide a general printing function.  */
diff --git a/sysdeps/powerpc/dl-procinfo.h b/sysdeps/powerpc/dl-procinfo.h
index b36697ba44..5b628a27ca 100644
--- a/sysdeps/powerpc/dl-procinfo.h
+++ b/sysdeps/powerpc/dl-procinfo.h
@@ -41,9 +41,6 @@
 #define _DL_PLATFORMS_COUNT	17
 
 #define _DL_FIRST_PLATFORM	32
-/* Mask to filter out platforms.  */
-#define _DL_HWCAP_PLATFORM	(((1ULL << _DL_PLATFORMS_COUNT) - 1) \
-				<< _DL_FIRST_PLATFORM)
 
 /* Platform bits (relative to _DL_FIRST_PLATFORM).  */
 #define PPC_PLATFORM_POWER4		0
diff --git a/sysdeps/s390/dl-procinfo.h b/sysdeps/s390/dl-procinfo.h
index 63c9889f94..bb5f9c7863 100644
--- a/sysdeps/s390/dl-procinfo.h
+++ b/sysdeps/s390/dl-procinfo.h
@@ -27,9 +27,6 @@ extern const char _dl_s390_cap_flags[_DL_HWCAP_COUNT][9] attribute_hidden;
 
 /* The kernel provides up to 32 capability bits with elf_hwcap.  */
 #define _DL_FIRST_PLATFORM	32
-/* Mask to filter out platforms.  */
-#define _DL_HWCAP_PLATFORM	(((1ULL << _DL_PLATFORMS_COUNT) - 1) \
-				 << _DL_FIRST_PLATFORM)
 
 /* Hardware capability bit numbers are derived directly from the
    facility indications as stored by the "store facility list" (STFL)
diff --git a/sysdeps/sparc/dl-procinfo.h b/sysdeps/sparc/dl-procinfo.h
index dbb1a4d324..bd1cb65596 100644
--- a/sysdeps/sparc/dl-procinfo.h
+++ b/sysdeps/sparc/dl-procinfo.h
@@ -57,7 +57,4 @@ _dl_hwcap_string (int idx)
 #define HWCAP_IMPORTANT		(HWCAP_IMPORTANT_V9 | HWCAP_SPARC_ULTRA3 \
 				 | HWCAP_SPARC_BLKINIT | HWCAP_SPARC_N2)
 
-/* There're no platforms to filter out.  */
-#define _DL_HWCAP_PLATFORM 0
-
 #endif /* dl-procinfo.h */
diff --git a/sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h b/sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h
index 0ed89c5e41..17893a5225 100644
--- a/sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h
+++ b/sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h
@@ -37,7 +37,4 @@ _dl_hwcap_string (int idx)
   return (unsigned)idx < _DL_HWCAP_COUNT ? GLRO(dl_aarch64_cap_flags)[idx] : "";
 };
 
-/* There're no platforms to filter out.  */
-#define _DL_HWCAP_PLATFORM 0
-
 #endif /* dl-procinfo.h */
diff --git a/sysdeps/unix/sysv/linux/arm/dl-procinfo.h b/sysdeps/unix/sysv/linux/arm/dl-procinfo.h
index 2a1c5985ee..85422b8edd 100644
--- a/sysdeps/unix/sysv/linux/arm/dl-procinfo.h
+++ b/sysdeps/unix/sysv/linux/arm/dl-procinfo.h
@@ -30,9 +30,6 @@
 /* Low 7 bits are allocated in HWCAP2.  */
 #define _DL_HWCAP2_LAST		6
 
-/* The kernel provides platform data but it is not interesting.  */
-#define _DL_HWCAP_PLATFORM	0
-
 
 static inline const char *
 __attribute__ ((unused))
diff --git a/sysdeps/x86/dl-procinfo.h b/sysdeps/x86/dl-procinfo.h
index b2184b8f5d..1aa6bad67a 100644
--- a/sysdeps/x86/dl-procinfo.h
+++ b/sysdeps/x86/dl-procinfo.h
@@ -26,8 +26,5 @@
 
 /* Start at 48 to reserve spaces for hardware capabilities.  */
 #define _DL_FIRST_PLATFORM	48
-/* Mask to filter out platforms.  */
-#define _DL_HWCAP_PLATFORM	(((1ULL << _DL_PLATFORMS_COUNT) - 1) \
-				 << _DL_FIRST_PLATFORM)
 
 #endif /* dl-procinfo.h */
-- 
2.45.0


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [RFC 6/9] elf: Remove _DL_FIRST_PLATFORM
  2024-06-07 11:42 [RFC 0/9] Remove legacy platform bits and cleanups Stefan Liebler
                   ` (4 preceding siblings ...)
  2024-06-07 11:42 ` [RFC 5/9] elf: Remove _DL_HWCAP_PLATFORM Stefan Liebler
@ 2024-06-07 11:42 ` Stefan Liebler
  2024-06-11 19:29   ` Adhemerval Zanella Netto
  2024-06-07 11:42 ` [RFC 7/9] elf: Remove _DL_PLATFORMS_COUNT Stefan Liebler
                   ` (4 subsequent siblings)
  10 siblings, 1 reply; 30+ messages in thread
From: Stefan Liebler @ 2024-06-07 11:42 UTC (permalink / raw)
  To: libc-alpha; +Cc: fweimer, devel, adhemerval.zanella, bergner, Stefan Liebler

Remove the definitions of _DL_FIRST_PLATFORM as those were only used
in the _DL_HWCAP_PLATFORM definitions and in _dl_string_platform().
Both were removed.

Note: Removed on every architecture despite of powerpc, where
_dl_string_platform() is still used.
---
 sysdeps/s390/dl-procinfo.h | 3 ---
 sysdeps/x86/dl-procinfo.h  | 3 ---
 2 files changed, 6 deletions(-)

diff --git a/sysdeps/s390/dl-procinfo.h b/sysdeps/s390/dl-procinfo.h
index bb5f9c7863..ef2a084ce7 100644
--- a/sysdeps/s390/dl-procinfo.h
+++ b/sysdeps/s390/dl-procinfo.h
@@ -25,9 +25,6 @@ extern const char _dl_s390_cap_flags[_DL_HWCAP_COUNT][9] attribute_hidden;
 
 #define _DL_PLATFORMS_COUNT	11
 
-/* The kernel provides up to 32 capability bits with elf_hwcap.  */
-#define _DL_FIRST_PLATFORM	32
-
 /* Hardware capability bit numbers are derived directly from the
    facility indications as stored by the "store facility list" (STFL)
    instruction.
diff --git a/sysdeps/x86/dl-procinfo.h b/sysdeps/x86/dl-procinfo.h
index 1aa6bad67a..a8d7d4ed32 100644
--- a/sysdeps/x86/dl-procinfo.h
+++ b/sysdeps/x86/dl-procinfo.h
@@ -24,7 +24,4 @@
 #define _DL_HWCAP_COUNT		HWCAP_COUNT
 #define _DL_PLATFORMS_COUNT	HWCAP_PLATFORMS_COUNT
 
-/* Start at 48 to reserve spaces for hardware capabilities.  */
-#define _DL_FIRST_PLATFORM	48
-
 #endif /* dl-procinfo.h */
-- 
2.45.0


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [RFC 7/9] elf: Remove _DL_PLATFORMS_COUNT
  2024-06-07 11:42 [RFC 0/9] Remove legacy platform bits and cleanups Stefan Liebler
                   ` (5 preceding siblings ...)
  2024-06-07 11:42 ` [RFC 6/9] elf: Remove _DL_FIRST_PLATFORM Stefan Liebler
@ 2024-06-07 11:42 ` Stefan Liebler
  2024-06-11 19:48   ` Adhemerval Zanella Netto
  2024-06-07 11:42 ` [RFC 8/9] elf: Remove LD_HWCAP_MASK / tunable glibc.cpu.hwcap_mask Stefan Liebler
                   ` (3 subsequent siblings)
  10 siblings, 1 reply; 30+ messages in thread
From: Stefan Liebler @ 2024-06-07 11:42 UTC (permalink / raw)
  To: libc-alpha; +Cc: fweimer, devel, adhemerval.zanella, bergner, Stefan Liebler

Remove the definitions of _DL_PLATFORMS_COUNT as those are not used
anymore after removal in elf/dl-cache.c:search_cache().

Note: On x86, we can also get rid of the definitions
HWCAP_PLATFORMS_START and HWCAP_PLATFORMS_COUNT.
---
 sysdeps/alpha/dl-procinfo.h     |  3 ---
 sysdeps/csky/dl-procinfo.h      |  3 ---
 sysdeps/mips/dl-procinfo.h      |  3 ---
 sysdeps/powerpc/dl-procinfo.h   |  2 --
 sysdeps/s390/dl-procinfo.h      |  2 --
 sysdeps/x86/dl-hwcap.h          | 10 ++--------
 sysdeps/x86/dl-procinfo.c       |  5 ++---
 sysdeps/x86/dl-procinfo.h       |  1 -
 sysdeps/x86_64/dl-procruntime.c |  5 ++---
 9 files changed, 6 insertions(+), 28 deletions(-)

diff --git a/sysdeps/alpha/dl-procinfo.h b/sysdeps/alpha/dl-procinfo.h
index 90f83ec24e..a5264f9f2c 100644
--- a/sysdeps/alpha/dl-procinfo.h
+++ b/sysdeps/alpha/dl-procinfo.h
@@ -21,9 +21,6 @@
 
 #include <ldsodefs.h>
 
-
-#define _DL_PLATFORMS_COUNT   5
-
 /* We cannot provide a general printing function.  */
 #define _dl_procinfo(type, word) -1
 
diff --git a/sysdeps/csky/dl-procinfo.h b/sysdeps/csky/dl-procinfo.h
index 803441f52c..3e7c63ee67 100644
--- a/sysdeps/csky/dl-procinfo.h
+++ b/sysdeps/csky/dl-procinfo.h
@@ -22,9 +22,6 @@
 
 #include <ldsodefs.h>
 
-
-#define _DL_PLATFORMS_COUNT   4
-
 /* We cannot provide a general printing function.  */
 #define _dl_procinfo(word, val) -1
 
diff --git a/sysdeps/mips/dl-procinfo.h b/sysdeps/mips/dl-procinfo.h
index 7185542eac..79c2acc388 100644
--- a/sysdeps/mips/dl-procinfo.h
+++ b/sysdeps/mips/dl-procinfo.h
@@ -21,9 +21,6 @@
 
 #include <ldsodefs.h>
 
-
-#define _DL_PLATFORMS_COUNT   4
-
 /* We cannot provide a general printing function.  */
 #define _dl_procinfo(type, word) -1
 
diff --git a/sysdeps/powerpc/dl-procinfo.h b/sysdeps/powerpc/dl-procinfo.h
index 5b628a27ca..81eb9fba87 100644
--- a/sysdeps/powerpc/dl-procinfo.h
+++ b/sysdeps/powerpc/dl-procinfo.h
@@ -38,8 +38,6 @@
 #define HWCAP_IMPORTANT		(PPC_FEATURE_HAS_ALTIVEC \
 				+ PPC_FEATURE_HAS_DFP)
 
-#define _DL_PLATFORMS_COUNT	17
-
 #define _DL_FIRST_PLATFORM	32
 
 /* Platform bits (relative to _DL_FIRST_PLATFORM).  */
diff --git a/sysdeps/s390/dl-procinfo.h b/sysdeps/s390/dl-procinfo.h
index ef2a084ce7..7092ed1e2d 100644
--- a/sysdeps/s390/dl-procinfo.h
+++ b/sysdeps/s390/dl-procinfo.h
@@ -23,8 +23,6 @@
 #define _DL_HWCAP_COUNT 23
 extern const char _dl_s390_cap_flags[_DL_HWCAP_COUNT][9] attribute_hidden;
 
-#define _DL_PLATFORMS_COUNT	11
-
 /* Hardware capability bit numbers are derived directly from the
    facility indications as stored by the "store facility list" (STFL)
    instruction.
diff --git a/sysdeps/x86/dl-hwcap.h b/sysdeps/x86/dl-hwcap.h
index e14e755bd7..246fdcd831 100644
--- a/sysdeps/x86/dl-hwcap.h
+++ b/sysdeps/x86/dl-hwcap.h
@@ -20,20 +20,14 @@
 
 #if IS_IN (ldconfig)
 /* Since ldconfig processes both i386 and x86-64 libraries, it needs
-   to cover all platforms and hardware capabilities.  */
-# define HWCAP_PLATFORMS_START	0
-# define HWCAP_PLATFORMS_COUNT	4
+   to cover all hardware capabilities.  */
 # define HWCAP_IMPORTANT \
   (HWCAP_X86_SSE2 | HWCAP_X86_64 | HWCAP_X86_AVX512_1)
 #elif defined __x86_64__
-/* For 64 bit, only cover x86-64 platforms and capabilities.  */
-# define HWCAP_PLATFORMS_START	2
-# define HWCAP_PLATFORMS_COUNT	4
+/* For 64 bit, only cover x86-64 capabilities.  */
 # define HWCAP_IMPORTANT	(HWCAP_X86_64 | HWCAP_X86_AVX512_1)
 #else
 /* For 32 bit, only cover i586, i686 and SSE2.  */
-# define HWCAP_PLATFORMS_START	0
-# define HWCAP_PLATFORMS_COUNT	2
 # define HWCAP_IMPORTANT	(HWCAP_X86_SSE2)
 #endif
 
diff --git a/sysdeps/x86/dl-procinfo.c b/sysdeps/x86/dl-procinfo.c
index 165ffd89a9..b791fd3e92 100644
--- a/sysdeps/x86/dl-procinfo.c
+++ b/sysdeps/x86/dl-procinfo.c
@@ -16,9 +16,8 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-/* This information must be kept in sync with the _DL_HWCAP_COUNT,
-   HWCAP_PLATFORMS_START and HWCAP_PLATFORMS_COUNT definitions in
-   dl-hwcap.h.
+/* This information must be kept in sync with the _DL_HWCAP_COUNT
+   definition in dl-hwcap.h.
 
    If anything should be added here check whether the size of each string
    is still ok with the given array size.
diff --git a/sysdeps/x86/dl-procinfo.h b/sysdeps/x86/dl-procinfo.h
index a8d7d4ed32..ea0f33bbad 100644
--- a/sysdeps/x86/dl-procinfo.h
+++ b/sysdeps/x86/dl-procinfo.h
@@ -22,6 +22,5 @@
 #include <dl-hwcap.h>
 
 #define _DL_HWCAP_COUNT		HWCAP_COUNT
-#define _DL_PLATFORMS_COUNT	HWCAP_PLATFORMS_COUNT
 
 #endif /* dl-procinfo.h */
diff --git a/sysdeps/x86_64/dl-procruntime.c b/sysdeps/x86_64/dl-procruntime.c
index 7078581778..0859438ed0 100644
--- a/sysdeps/x86_64/dl-procruntime.c
+++ b/sysdeps/x86_64/dl-procruntime.c
@@ -16,9 +16,8 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-/* This information must be kept in sync with the _DL_HWCAP_COUNT,
-   HWCAP_PLATFORMS_START and HWCAP_PLATFORMS_COUNT definitions in
-   dl-hwcap.h.
+/* This information must be kept in sync with the _DL_HWCAP_COUNT
+   definition in dl-hwcap.h.
 
    If anything should be added here check whether the size of each string
    is still ok with the given array size.
-- 
2.45.0


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [RFC 8/9] elf: Remove LD_HWCAP_MASK / tunable glibc.cpu.hwcap_mask
  2024-06-07 11:42 [RFC 0/9] Remove legacy platform bits and cleanups Stefan Liebler
                   ` (6 preceding siblings ...)
  2024-06-07 11:42 ` [RFC 7/9] elf: Remove _DL_PLATFORMS_COUNT Stefan Liebler
@ 2024-06-07 11:42 ` Stefan Liebler
  2024-06-11 20:04   ` Adhemerval Zanella Netto
  2024-06-07 11:42 ` [RFC 9/9] elf: Remove HWCAP_IMPORTANT Stefan Liebler
                   ` (2 subsequent siblings)
  10 siblings, 1 reply; 30+ messages in thread
From: Stefan Liebler @ 2024-06-07 11:42 UTC (permalink / raw)
  To: libc-alpha; +Cc: fweimer, devel, adhemerval.zanella, bergner, Stefan Liebler

Remove the environment variable LD_HWCAP_MASK and the tunable
glibc.cpu.hwcap_mask as those are not used anymore in common-code
after removal in elf/dl-cache.c:search_cache().

The only remaining user is sparc32 where it is used in
elf_machine_matches_host().  If sparc32 does not need it anymore,
we can get rid of it at all.  Otherwise we could also move
LD_HWCAP_MASK / tunable glibc.cpu.hwcap_mask to be sparc32 specific.
---
 elf/dl-tunables.list               |  7 -------
 elf/tst-env-setuid.c               |  1 -
 manual/README.tunables             | 12 ++++++------
 manual/tunables.texi               | 11 -----------
 sysdeps/generic/unsecvars.h        |  1 -
 sysdeps/sparc/sparc32/dl-machine.h |  6 ------
 6 files changed, 6 insertions(+), 32 deletions(-)

diff --git a/elf/dl-tunables.list b/elf/dl-tunables.list
index 1186272c81..40ac5b3776 100644
--- a/elf/dl-tunables.list
+++ b/elf/dl-tunables.list
@@ -83,13 +83,6 @@ glibc {
       minval: 0
     }
   }
-  cpu {
-    hwcap_mask {
-      type: UINT_64
-      env_alias: LD_HWCAP_MASK
-      default: HWCAP_IMPORTANT
-    }
-  }
 
   elision {
     enable {
diff --git a/elf/tst-env-setuid.c b/elf/tst-env-setuid.c
index 43047c48f3..59f2ffeb88 100644
--- a/elf/tst-env-setuid.c
+++ b/elf/tst-env-setuid.c
@@ -52,7 +52,6 @@ static const struct envvar_t filtered_envvars[] =
 {
   { "GLIBC_TUNABLES",          FILTERED_VALUE },
   { "LD_AUDIT",                FILTERED_VALUE },
-  { "LD_HWCAP_MASK",           FILTERED_VALUE },
   { "LD_LIBRARY_PATH",         FILTERED_VALUE },
   { "LD_PRELOAD",              FILTERED_VALUE },
   { "LD_PROFILE",              PROFILE_LIB },
diff --git a/manual/README.tunables b/manual/README.tunables
index 72ae00dc02..594879397b 100644
--- a/manual/README.tunables
+++ b/manual/README.tunables
@@ -96,11 +96,11 @@ where 'check' is the tunable name and 'val' is a value of same type.
 To get and set tunables in a different namespace from that module, use the full
 form of the macros as follows:
 
-  val = TUNABLE_GET_FULL (glibc, cpu, hwcap_mask, uint64_t, NULL)
+  val = TUNABLE_GET_FULL (glibc, malloc, mmap_max, int32_t, NULL)
 
-  TUNABLE_SET_FULL (glibc, cpu, hwcap_mask, val)
+  TUNABLE_SET_FULL (glibc, malloc, mmap_max, val)
 
-where 'glibc' is the top namespace, 'cpu' is the tunable namespace and the
+where 'glibc' is the top namespace, 'malloc' is the tunable namespace and the
 remaining arguments are the same as the short form macros.
 
 The minimum and maximum values can updated together with the tunable value
@@ -114,11 +114,11 @@ where 'check' is the tunable name, 'val' is a value of same type, 'min' and
 To set the minimum and maximum values of tunables in a different namespace
 from that module, use the full form of the macros as follows:
 
-  val = TUNABLE_GET_FULL (glibc, cpu, hwcap_mask, uint64_t, NULL)
+  val = TUNABLE_GET_FULL (glibc, malloc, mmap_max, int32_t, NULL)
 
-  TUNABLE_SET_WITH_BOUNDS_FULL (glibc, cpu, hwcap_mask, val, min, max)
+  TUNABLE_SET_WITH_BOUNDS_FULL (glibc, malloc, mmap_max, val, min, max)
 
-where 'glibc' is the top namespace, 'cpu' is the tunable namespace and the
+where 'glibc' is the top namespace, 'malloc' is the tunable namespace and the
 remaining arguments are the same as the short form macros.
 
 When TUNABLE_NAMESPACE is not defined in a module, TUNABLE_GET is equivalent to
diff --git a/manual/tunables.texi b/manual/tunables.texi
index 8dd02d8149..0b1b2898c0 100644
--- a/manual/tunables.texi
+++ b/manual/tunables.texi
@@ -55,7 +55,6 @@ glibc.cpu.x86_non_temporal_threshold: 0xc0000 (min: 0x4040, max: 0xfffffffffffff
 glibc.cpu.x86_memset_non_temporal_threshold: 0xc0000 (min: 0x4040, max: 0xfffffffffffffff)
 glibc.cpu.x86_shstk:
 glibc.pthread.stack_cache_size: 0x2800000 (min: 0x0, max: 0xffffffffffffffff)
-glibc.cpu.hwcap_mask: 0x6 (min: 0x0, max: 0xffffffffffffffff)
 glibc.malloc.mmap_max: 0 (min: 0, max: 2147483647)
 glibc.elision.skip_trylock_internal_abort: 3 (min: 0, max: 2147483647)
 glibc.cpu.plt_rewrite: 0 (min: 0, max: 2)
@@ -504,16 +503,6 @@ Behavior of @theglibc{} can be tuned to assume specific hardware capabilities
 by setting the following tunables in the @code{cpu} namespace:
 @end deftp
 
-@deftp Tunable glibc.cpu.hwcap_mask
-This tunable supersedes the @env{LD_HWCAP_MASK} environment variable and is
-identical in features.
-
-The @code{AT_HWCAP} key in the Auxiliary Vector specifies instruction set
-extensions available in the processor at runtime for some architectures.  The
-@code{glibc.cpu.hwcap_mask} tunable allows the user to mask out those
-capabilities at runtime, thus disabling use of those extensions.
-@end deftp
-
 @deftp Tunable glibc.cpu.hwcaps
 The @code{glibc.cpu.hwcaps=-xxx,yyy,-zzz...} tunable allows the user to
 enable CPU/ARCH feature @code{yyy}, disable CPU/ARCH feature @code{xxx}
diff --git a/sysdeps/generic/unsecvars.h b/sysdeps/generic/unsecvars.h
index f1724efe0f..97857a11aa 100644
--- a/sysdeps/generic/unsecvars.h
+++ b/sysdeps/generic/unsecvars.h
@@ -12,7 +12,6 @@
   "LD_DEBUG\0"								      \
   "LD_DEBUG_OUTPUT\0"							      \
   "LD_DYNAMIC_WEAK\0"							      \
-  "LD_HWCAP_MASK\0"							      \
   "LD_LIBRARY_PATH\0"							      \
   "LD_ORIGIN_PATH\0"							      \
   "LD_PRELOAD\0"							      \
diff --git a/sysdeps/sparc/sparc32/dl-machine.h b/sysdeps/sparc/sparc32/dl-machine.h
index d855c66fe3..2c56d8a80e 100644
--- a/sysdeps/sparc/sparc32/dl-machine.h
+++ b/sysdeps/sparc/sparc32/dl-machine.h
@@ -39,13 +39,7 @@ elf_machine_matches_host (const Elf32_Ehdr *ehdr)
     return 1;
   else if (ehdr->e_machine == EM_SPARC32PLUS)
     {
-#if defined SHARED
-      uint64_t hwcap_mask = TUNABLE_GET (glibc, cpu, hwcap_mask, uint64_t,
-					 NULL);
-      return GLRO(dl_hwcap) & hwcap_mask & HWCAP_SPARC_V9;
-#else
       return GLRO(dl_hwcap) & HWCAP_SPARC_V9;
-#endif
     }
   else
     return 0;
-- 
2.45.0


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [RFC 9/9] elf: Remove HWCAP_IMPORTANT
  2024-06-07 11:42 [RFC 0/9] Remove legacy platform bits and cleanups Stefan Liebler
                   ` (7 preceding siblings ...)
  2024-06-07 11:42 ` [RFC 8/9] elf: Remove LD_HWCAP_MASK / tunable glibc.cpu.hwcap_mask Stefan Liebler
@ 2024-06-07 11:42 ` Stefan Liebler
  2024-06-11 20:07   ` Adhemerval Zanella Netto
  2024-06-07 12:18 ` [RFC 0/9] Remove legacy platform bits and cleanups Florian Weimer
  2024-06-08 11:09 ` Florian Weimer
  10 siblings, 1 reply; 30+ messages in thread
From: Stefan Liebler @ 2024-06-07 11:42 UTC (permalink / raw)
  To: libc-alpha; +Cc: fweimer, devel, adhemerval.zanella, bergner, Stefan Liebler

Remove the definitions of HWCAP_IMPORTANT after removal of
LD_HWCAP_MASK / tunable glibc.cpu.hwcap_mask.  There HWCAP_IMPORTANT
was used as default value.
---
 elf/dl-diagnostics.c                          |  1 -
 sysdeps/alpha/dl-procinfo.h                   |  3 ---
 sysdeps/csky/dl-procinfo.h                    |  3 ---
 sysdeps/generic/dl-procinfo.h                 |  3 ---
 sysdeps/mips/dl-procinfo.h                    |  3 ---
 sysdeps/powerpc/dl-procinfo.h                 |  3 ---
 sysdeps/s390/dl-procinfo.h                    |  5 -----
 sysdeps/sparc/dl-procinfo.h                   |  5 -----
 sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h |  3 ---
 sysdeps/unix/sysv/linux/arm/dl-procinfo.h     |  2 --
 sysdeps/x86/dl-hwcap.h                        | 13 -------------
 11 files changed, 44 deletions(-)

diff --git a/elf/dl-diagnostics.c b/elf/dl-diagnostics.c
index e69463b2bd..c83e7770d8 100644
--- a/elf/dl-diagnostics.c
+++ b/elf/dl-diagnostics.c
@@ -233,7 +233,6 @@ _dl_print_diagnostics (char **environ)
 {
   _dl_diagnostics_print_labeled_string ("dl_dst_lib", DL_DST_LIB);
   _dl_diagnostics_print_labeled_value ("dl_hwcap", GLRO (dl_hwcap));
-  _dl_diagnostics_print_labeled_value ("dl_hwcap_important", HWCAP_IMPORTANT);
   _dl_diagnostics_print_labeled_value ("dl_hwcap2", GLRO (dl_hwcap2));
   _dl_diagnostics_print_labeled_value ("dl_hwcap3", GLRO (dl_hwcap3));
   _dl_diagnostics_print_labeled_value ("dl_hwcap4", GLRO (dl_hwcap4));
diff --git a/sysdeps/alpha/dl-procinfo.h b/sysdeps/alpha/dl-procinfo.h
index a5264f9f2c..8d17d42ce2 100644
--- a/sysdeps/alpha/dl-procinfo.h
+++ b/sysdeps/alpha/dl-procinfo.h
@@ -27,9 +27,6 @@
 /* There are no hardware capabilities defined.  */
 #define _dl_hwcap_string(idx) ""
 
-/* By default there is no important hardware capability.  */
-#define HWCAP_IMPORTANT (0)
-
 /* We don't have any hardware capabilities.  */
 #define _DL_HWCAP_COUNT	0
 
diff --git a/sysdeps/csky/dl-procinfo.h b/sysdeps/csky/dl-procinfo.h
index 3e7c63ee67..f5f6343cf6 100644
--- a/sysdeps/csky/dl-procinfo.h
+++ b/sysdeps/csky/dl-procinfo.h
@@ -28,9 +28,6 @@
 /* There are no hardware capabilities defined.  */
 #define _dl_hwcap_string(idx) ""
 
-/* By default there is no important hardware capability.  */
-#define HWCAP_IMPORTANT (0)
-
 /* We don't have any hardware capabilities.  */
 #define _DL_HWCAP_COUNT	0
 
diff --git a/sysdeps/generic/dl-procinfo.h b/sysdeps/generic/dl-procinfo.h
index 1778fd1057..93edfc00cb 100644
--- a/sysdeps/generic/dl-procinfo.h
+++ b/sysdeps/generic/dl-procinfo.h
@@ -25,9 +25,6 @@
 /* There are no hardware capabilities defined.  */
 #define _dl_hwcap_string(idx) ""
 
-/* By default there is no important hardware capability.  */
-#define HWCAP_IMPORTANT (0)
-
 /* We don't have any hardware capabilities.  */
 #define _DL_HWCAP_COUNT 0
 
diff --git a/sysdeps/mips/dl-procinfo.h b/sysdeps/mips/dl-procinfo.h
index 79c2acc388..af2616e1db 100644
--- a/sysdeps/mips/dl-procinfo.h
+++ b/sysdeps/mips/dl-procinfo.h
@@ -27,9 +27,6 @@
 /* There are no hardware capabilities defined.  */
 #define _dl_hwcap_string(idx) ""
 
-/* By default there is no important hardware capability.  */
-#define HWCAP_IMPORTANT (0)
-
 /* We don't have any hardware capabilities.  */
 #define _DL_HWCAP_COUNT	0
 
diff --git a/sysdeps/powerpc/dl-procinfo.h b/sysdeps/powerpc/dl-procinfo.h
index 81eb9fba87..1e746a7ab4 100644
--- a/sysdeps/powerpc/dl-procinfo.h
+++ b/sysdeps/powerpc/dl-procinfo.h
@@ -34,9 +34,6 @@
 /* AT_HWCAP4 feature strings follow the AT_HWCAP3 feature strings.  */
 #define _DL_HWCAP4_OFFSET	(_DL_HWCAP3_OFFSET + _DL_HWCAP_SIZE)
 
-/* These bits influence library search.  */
-#define HWCAP_IMPORTANT		(PPC_FEATURE_HAS_ALTIVEC \
-				+ PPC_FEATURE_HAS_DFP)
 
 #define _DL_FIRST_PLATFORM	32
 
diff --git a/sysdeps/s390/dl-procinfo.h b/sysdeps/s390/dl-procinfo.h
index 7092ed1e2d..45dd11c189 100644
--- a/sysdeps/s390/dl-procinfo.h
+++ b/sysdeps/s390/dl-procinfo.h
@@ -59,11 +59,6 @@ enum
   HWCAP_S390_SIE = 1 << 22,
 };
 
-#define HWCAP_IMPORTANT (HWCAP_S390_ZARCH | HWCAP_S390_LDISP \
-			 | HWCAP_S390_EIMM | HWCAP_S390_DFP  \
-			 | HWCAP_S390_VX | HWCAP_S390_VXE    \
-			 | HWCAP_S390_VXRS_EXT2)
-
 /* We cannot provide a general printing function.  */
 #define _dl_procinfo(type, word) -1
 
diff --git a/sysdeps/sparc/dl-procinfo.h b/sysdeps/sparc/dl-procinfo.h
index bd1cb65596..709178706c 100644
--- a/sysdeps/sparc/dl-procinfo.h
+++ b/sysdeps/sparc/dl-procinfo.h
@@ -52,9 +52,4 @@ _dl_hwcap_string (int idx)
   return GLRO(dl_sparc_cap_flags)[idx];
 };
 
-#include <bits/wordsize.h>
-#define HWCAP_IMPORTANT_V9	(__WORDSIZE == 64 ? 0 : HWCAP_SPARC_V9)
-#define HWCAP_IMPORTANT		(HWCAP_IMPORTANT_V9 | HWCAP_SPARC_ULTRA3 \
-				 | HWCAP_SPARC_BLKINIT | HWCAP_SPARC_N2)
-
 #endif /* dl-procinfo.h */
diff --git a/sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h b/sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h
index 17893a5225..b85d4ad8a3 100644
--- a/sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h
+++ b/sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h
@@ -27,9 +27,6 @@
 /* We cannot provide a general printing function.  */
 #define _dl_procinfo(type, word) -1
 
-/* No additional library search paths.  */
-#define HWCAP_IMPORTANT HWCAP_ATOMICS
-
 static inline const char *
 __attribute__ ((unused))
 _dl_hwcap_string (int idx)
diff --git a/sysdeps/unix/sysv/linux/arm/dl-procinfo.h b/sysdeps/unix/sysv/linux/arm/dl-procinfo.h
index 85422b8edd..7d26216718 100644
--- a/sysdeps/unix/sysv/linux/arm/dl-procinfo.h
+++ b/sysdeps/unix/sysv/linux/arm/dl-procinfo.h
@@ -70,6 +70,4 @@ _dl_procinfo (unsigned int type, unsigned long int word)
   return 0;
 }
 
-#define HWCAP_IMPORTANT		(HWCAP_ARM_VFP | HWCAP_ARM_NEON)
-
 #endif /* dl-procinfo.h */
diff --git a/sysdeps/x86/dl-hwcap.h b/sysdeps/x86/dl-hwcap.h
index 246fdcd831..325f1c467c 100644
--- a/sysdeps/x86/dl-hwcap.h
+++ b/sysdeps/x86/dl-hwcap.h
@@ -18,19 +18,6 @@
 #ifndef _DL_HWCAP_H
 #define _DL_HWCAP_H
 
-#if IS_IN (ldconfig)
-/* Since ldconfig processes both i386 and x86-64 libraries, it needs
-   to cover all hardware capabilities.  */
-# define HWCAP_IMPORTANT \
-  (HWCAP_X86_SSE2 | HWCAP_X86_64 | HWCAP_X86_AVX512_1)
-#elif defined __x86_64__
-/* For 64 bit, only cover x86-64 capabilities.  */
-# define HWCAP_IMPORTANT	(HWCAP_X86_64 | HWCAP_X86_AVX512_1)
-#else
-/* For 32 bit, only cover i586, i686 and SSE2.  */
-# define HWCAP_IMPORTANT	(HWCAP_X86_SSE2)
-#endif
-
 enum
 {
   HWCAP_X86_SSE2		= 1 << 0,
-- 
2.45.0


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [RFC 0/9] Remove legacy platform bits and cleanups
  2024-06-07 11:42 [RFC 0/9] Remove legacy platform bits and cleanups Stefan Liebler
                   ` (8 preceding siblings ...)
  2024-06-07 11:42 ` [RFC 9/9] elf: Remove HWCAP_IMPORTANT Stefan Liebler
@ 2024-06-07 12:18 ` Florian Weimer
  2024-06-10 13:23   ` Stefan Liebler
  2024-06-08 11:09 ` Florian Weimer
  10 siblings, 1 reply; 30+ messages in thread
From: Florian Weimer @ 2024-06-07 12:18 UTC (permalink / raw)
  To: Stefan Liebler; +Cc: libc-alpha, devel, adhemerval.zanella, bergner

* Stefan Liebler:

> - "elf: Remove LD_HWCAP_MASK / tunable glibc.cpu.hwcap_mask"
> The environment variable LD_HWCAP_MASK / glibc-tunable
> glibc.cpu.hwcap_mask is not used anymore after removal in
> elf/dl-cache.c:search_cache() despite of sparc32 where it is used in
> elf_machine_matches_host().

Are you sure about that?  It is used to update GLRO(dl_hwcap), and that
_rtld_global_ro member is consulted in various places.  Its value is
also returned by getauxval (AT_HWCAP).

Thanks,
Florian


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [RFC 0/9] Remove legacy platform bits and cleanups
  2024-06-07 11:42 [RFC 0/9] Remove legacy platform bits and cleanups Stefan Liebler
                   ` (9 preceding siblings ...)
  2024-06-07 12:18 ` [RFC 0/9] Remove legacy platform bits and cleanups Florian Weimer
@ 2024-06-08 11:09 ` Florian Weimer
  2024-06-10 13:36   ` Stefan Liebler
  10 siblings, 1 reply; 30+ messages in thread
From: Florian Weimer @ 2024-06-08 11:09 UTC (permalink / raw)
  To: Stefan Liebler; +Cc: libc-alpha, devel, adhemerval.zanella, bergner

* Stefan Liebler:

> This patch series is the result of:
> "Question regarding platform-bits in ld.so.cache"
> https://sourceware.org/pipermail/libc-alpha/2024-May/156793.html

This series fails to build on MIPS with:

mips64-glibc-linux-gnu-gcc -mabi=32 ldconfig.c -c -std=gnu11 -fgnu89-inline  -g -O2 -Wall -Wwrite-strings -Wundef -Werror -fmerge-all-constants -frounding-math -fno-stack-protector -fno-common -Wp,-U_FORTIFY_SOURCE -Wstrict-prototypes -Wold-style-definition -fmath-errno -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64   -fPIE    -Wa,-execstack -D'SYSCONFDIR="/etc"' -D'LIBDIR="/usr/lib"' -D'SLIBDIR="/lib"'       -I../include -I/home/bmg/build/glibcs/mips-linux-gnu/glibc/elf  -I/home/bmg/build/glibcs/mips-linux-gnu/glibc  -I../sysdeps/unix/sysv/linux/mips/mips32/fpu  -I../sysdeps/unix/sysv/linux/mips/mips32  -I../sysdeps/unix/sysv/linux/mips  -I../sysdeps/mips/nptl  -I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux  -I../sysdeps/nptl  -I../sysdeps/pthread  -I../sysdeps/gnu  -I../sysdeps/unix/inet  -I../sysdeps/unix/sysv  -I../sysdeps/unix/mips/mips32  -I../sysdeps/unix/mips  -I../sysdeps/unix  -I../sysdeps/posix  -I../sysdeps/mips/mips32/fpu  -I../sysdeps/mips/mips32  -I../sysdeps/mips/ieee754  -I../sysdeps/mips/include -I../sysdeps/mips  -I../sysdeps/ieee754/flt-32  -I../sysdeps/ieee754/dbl-64  -I../sysdeps/wordsize-32  -I../sysdeps/mips/fpu  -I../sysdeps/ieee754  -I../sysdeps/generic  -I.. -I../libio -I.   -D_LIBC_REENTRANT -include /home/bmg/build/glibcs/mips-linux-gnu/glibc/libc-modules.h -DMODULE_NAME=ldconfig -include ../include/libc-symbols.h  -DPIC     -DTOP_NAMESPACE=glibc -o /home/bmg/build/glibcs/mips-linux-gnu/glibc/elf/ldconfig.o -MD -MP -MF /home/bmg/build/glibcs/mips-linux-gnu/glibc/elf/ldconfig.o.dt -MT /home/bmg/build/glibcs/mips-linux-gnu/glibc/elf/ldconfig.o
In file included from ../sysdeps/generic/ldsodefs.h:643,
                 from ../sysdeps/mips/ldsodefs.h:82,
                 from ../sysdeps/gnu/ldsodefs.h:46,
                 from ../sysdeps/unix/sysv/linux/ldsodefs.h:25,
                 from ../sysdeps/unix/sysv/linux/mips/ldsodefs.h:22,
                 from ../sysdeps/mips/dl-procinfo.h:22,
                 from /home/bmg/build/glibcs/mips-linux-gnu/glibc/dl-tunable-list.h:6,
                 from ../elf/dl-tunables.h:48,
                 from ./dl-hwcaps.h:25,
                 from ldconfig.c:44:
../sysdeps/unix/sysv/linux/dl-vdso-setup.c:62:22: error: ‘_dl_vdso_clock_getres’ defined but not used [-Werror=unused-variable]
   62 | PROCINFO_CLASS int (*_dl_vdso_clock_getres) (clockid_t,
      |                      ^~~~~~~~~~~~~~~~~~~~~
../sysdeps/unix/sysv/linux/dl-vdso-setup.c:53:22: error: ‘_dl_vdso_gettimeofday’ defined but not used [-Werror=unused-variable]
   53 | PROCINFO_CLASS int (*_dl_vdso_gettimeofday) (struct timeval *, void *) RELRO;
      |                      ^~~~~~~~~~~~~~~~~~~~~
../sysdeps/unix/sysv/linux/dl-vdso-setup.c:49:22: error: ‘_dl_vdso_clock_gettime64’ defined but not used [-Werror=unused-variable]
   49 | PROCINFO_CLASS int (*_dl_vdso_clock_gettime64) (clockid_t,
      |                      ^~~~~~~~~~~~~~~~~~~~~~~~
../sysdeps/unix/sysv/linux/dl-vdso-setup.c:45:22: error: ‘_dl_vdso_clock_gettime’ defined but not used [-Werror=unused-variable]
   45 | PROCINFO_CLASS int (*_dl_vdso_clock_gettime) (clockid_t,
      |                      ^~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[3]: *** [../o-iterator.mk:9: /home/bmg/build/glibcs/mips-linux-gnu/glibc/elf/ldconfig.o] Error 1
make[3]: Leaving directory '/home/bmg/src/glibc/elf'
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [Makefile:484: elf/others] Error 2
make[1]: *** [Makefile:9: all] Error 2

Florian


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [RFC 0/9] Remove legacy platform bits and cleanups
  2024-06-07 12:18 ` [RFC 0/9] Remove legacy platform bits and cleanups Florian Weimer
@ 2024-06-10 13:23   ` Stefan Liebler
  2024-06-10 14:03     ` Florian Weimer
  0 siblings, 1 reply; 30+ messages in thread
From: Stefan Liebler @ 2024-06-10 13:23 UTC (permalink / raw)
  To: Florian Weimer; +Cc: libc-alpha, devel, adhemerval.zanella, bergner

On 07.06.24 14:18, Florian Weimer wrote:
> * Stefan Liebler:
> 
>> - "elf: Remove LD_HWCAP_MASK / tunable glibc.cpu.hwcap_mask"
>> The environment variable LD_HWCAP_MASK / glibc-tunable
>> glibc.cpu.hwcap_mask is not used anymore after removal in
>> elf/dl-cache.c:search_cache() despite of sparc32 where it is used in
>> elf_machine_matches_host().
> 
> Are you sure about that?  It is used to update GLRO(dl_hwcap), and that
> _rtld_global_ro member is consulted in various places.  Its value is
> also returned by getauxval (AT_HWCAP).
> 
> Thanks,
> Florian
> 
I've had a look, but did not found the place where this update happens.

I've also tried out this:
cat tst-LD_HWCAP_MASK.c
#include <stdio.h>
#include <stdlib.h>
#include <sys/auxv.h>

int
main (int argc, char *argv[])
{
  printf ("LD_HWCAP_MASK=\"%s\" GLIBC_TUNABLES=\"%s\" %s\n"
	  "=> getauxval(AT_HWCAP)= 0x%lx\n",
	  getenv("LD_HWCAP_MASK") ?: "", getenv("GLIBC_TUNABLES") ?: "",
	  argv[0], getauxval (AT_HWCAP));
  return EXIT_SUCCESS;
}


LD_HWCAP_MASK="" GLIBC_TUNABLES="" ./tst-LD_HWCAP_MASK-s390x.old
=> getauxval(AT_HWCAP)= 0x7fffff

LD_HWCAP_MASK="0x0" GLIBC_TUNABLES="" ./tst-LD_HWCAP_MASK-s390x.old
=> getauxval(AT_HWCAP)= 0x7fffff

LD_HWCAP_MASK="0xFFFFFFFF" GLIBC_TUNABLES="" ./tst-LD_HWCAP_MASK-s390x.old
=> getauxval(AT_HWCAP)= 0x7fffff

LD_HWCAP_MASK="" GLIBC_TUNABLES="glibc.cpu.hwcap_mask=0x0"
./tst-LD_HWCAP_MASK-s390x.old
=> getauxval(AT_HWCAP)= 0x7fffff

LD_HWCAP_MASK="" GLIBC_TUNABLES="glibc.cpu.hwcap_mask=0xFFFFFFFF"
./tst-LD_HWCAP_MASK-s390x.old
=> getauxval(AT_HWCAP)= 0x7fffff



There is the e.g. GLIBC_TUNABLES=glibc.cpu.hwcaps= which let you
disable/enable the hwcaps used for glibc internal ifuncs.

Before I've implemented GLIBC_TUNABLES=glibc.cpu.hwcaps= for s390x, I've
asked on libc-alpha and Szabolcs Nagy answered this:
(see full question/answer:
Questions regarding manipulation of IFUNC selection and tunables like
glibc.cpu.hwcap_mask
https://sourceware.org/pipermail/libc-alpha/2022-August/141648.html
)
iirc LD_HWCAP_MASK was purely for the old hwcap based
lib path lookup.
...
i think hwcap_mask was not for completely hiding hwcaps
like that.


Attached to the old question is also a program which dumps the hwcaps
passed to s390x-ifunc-resolver. But it was also not changed by the
environment variables.


Please also have a look, if you find the update of GLRO(dl_hwcap).

Thanks,
Stefan

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [RFC 0/9] Remove legacy platform bits and cleanups
  2024-06-08 11:09 ` Florian Weimer
@ 2024-06-10 13:36   ` Stefan Liebler
  2024-06-11 12:13     ` Stefan Liebler
  0 siblings, 1 reply; 30+ messages in thread
From: Stefan Liebler @ 2024-06-10 13:36 UTC (permalink / raw)
  To: Florian Weimer; +Cc: libc-alpha, devel, adhemerval.zanella, bergner

On 08.06.24 13:09, Florian Weimer wrote:
> * Stefan Liebler:
> 
>> This patch series is the result of:
>> "Question regarding platform-bits in ld.so.cache"
>> https://sourceware.org/pipermail/libc-alpha/2024-May/156793.html
> 
> This series fails to build on MIPS with:
> 
> mips64-glibc-linux-gnu-gcc -mabi=32 ldconfig.c -c -std=gnu11 -fgnu89-inline  -g -O2 -Wall -Wwrite-strings -Wundef -Werror -fmerge-all-constants -frounding-math -fno-stack-protector -fno-common -Wp,-U_FORTIFY_SOURCE -Wstrict-prototypes -Wold-style-definition -fmath-errno -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64   -fPIE    -Wa,-execstack -D'SYSCONFDIR="/etc"' -D'LIBDIR="/usr/lib"' -D'SLIBDIR="/lib"'       -I../include -I/home/bmg/build/glibcs/mips-linux-gnu/glibc/elf  -I/home/bmg/build/glibcs/mips-linux-gnu/glibc  -I../sysdeps/unix/sysv/linux/mips/mips32/fpu  -I../sysdeps/unix/sysv/linux/mips/mips32  -I../sysdeps/unix/sysv/linux/mips  -I../sysdeps/mips/nptl  -I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux  -I../sysdeps/nptl  -I../sysdeps/pthread  -I../sysdeps/gnu  -I../sysdeps/unix/inet  -I../sysdeps/unix/sysv  -I../sysdeps/unix/mips/mips32  -I../sysdeps/unix/mips  -I../sysdeps/unix  -I../sysdeps/posix  -I../sysdeps/mips/mips32/fpu  -I../sysdeps/mips/mips32  -I../sysdeps/mips/ieee754  -I../sysdeps/mips/include -I../sysdeps/mips  -I../sysdeps/ieee754/flt-32  -I../sysdeps/ieee754/dbl-64  -I../sysdeps/wordsize-32  -I../sysdeps/mips/fpu  -I../sysdeps/ieee754  -I../sysdeps/generic  -I.. -I../libio -I.   -D_LIBC_REENTRANT -include /home/bmg/build/glibcs/mips-linux-gnu/glibc/libc-modules.h -DMODULE_NAME=ldconfig -include ../include/libc-symbols.h  -DPIC     -DTOP_NAMESPACE=glibc -o /home/bmg/build/glibcs/mips-linux-gnu/glibc/elf/ldconfig.o -MD -MP -MF /home/bmg/build/glibcs/mips-linux-gnu/glibc/elf/ldconfig.o.dt -MT /home/bmg/build/glibcs/mips-linux-gnu/glibc/elf/ldconfig.o
> In file included from ../sysdeps/generic/ldsodefs.h:643,
>                  from ../sysdeps/mips/ldsodefs.h:82,
>                  from ../sysdeps/gnu/ldsodefs.h:46,
>                  from ../sysdeps/unix/sysv/linux/ldsodefs.h:25,
>                  from ../sysdeps/unix/sysv/linux/mips/ldsodefs.h:22,
>                  from ../sysdeps/mips/dl-procinfo.h:22,
>                  from /home/bmg/build/glibcs/mips-linux-gnu/glibc/dl-tunable-list.h:6,
>                  from ../elf/dl-tunables.h:48,
>                  from ./dl-hwcaps.h:25,
>                  from ldconfig.c:44:
> ../sysdeps/unix/sysv/linux/dl-vdso-setup.c:62:22: error: ‘_dl_vdso_clock_getres’ defined but not used [-Werror=unused-variable]
>    62 | PROCINFO_CLASS int (*_dl_vdso_clock_getres) (clockid_t,
>       |                      ^~~~~~~~~~~~~~~~~~~~~
> ../sysdeps/unix/sysv/linux/dl-vdso-setup.c:53:22: error: ‘_dl_vdso_gettimeofday’ defined but not used [-Werror=unused-variable]
>    53 | PROCINFO_CLASS int (*_dl_vdso_gettimeofday) (struct timeval *, void *) RELRO;
>       |                      ^~~~~~~~~~~~~~~~~~~~~
> ../sysdeps/unix/sysv/linux/dl-vdso-setup.c:49:22: error: ‘_dl_vdso_clock_gettime64’ defined but not used [-Werror=unused-variable]
>    49 | PROCINFO_CLASS int (*_dl_vdso_clock_gettime64) (clockid_t,
>       |                      ^~~~~~~~~~~~~~~~~~~~~~~~
> ../sysdeps/unix/sysv/linux/dl-vdso-setup.c:45:22: error: ‘_dl_vdso_clock_gettime’ defined but not used [-Werror=unused-variable]
>    45 | PROCINFO_CLASS int (*_dl_vdso_clock_gettime) (clockid_t,
>       |                      ^~~~~~~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
> make[3]: *** [../o-iterator.mk:9: /home/bmg/build/glibcs/mips-linux-gnu/glibc/elf/ldconfig.o] Error 1
> make[3]: Leaving directory '/home/bmg/src/glibc/elf'
> make[3]: *** Waiting for unfinished jobs....
> make[2]: *** [Makefile:484: elf/others] Error 2
> make[1]: *** [Makefile:9: all] Error 2
> 
> Florian
> 
Hi Florian,

thanks for the info. I've take a look. Seems to be related to the
removed sysdeps/mips/dl-procinfo.c with those undefs at the end:
#undef PROCINFO_DECL
#undef PROCINFO_CLASS

Bye,
Stefan

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [RFC 0/9] Remove legacy platform bits and cleanups
  2024-06-10 13:23   ` Stefan Liebler
@ 2024-06-10 14:03     ` Florian Weimer
  2024-06-11 12:24       ` Stefan Liebler
  0 siblings, 1 reply; 30+ messages in thread
From: Florian Weimer @ 2024-06-10 14:03 UTC (permalink / raw)
  To: Stefan Liebler; +Cc: libc-alpha, devel, adhemerval.zanella, bergner

* Stefan Liebler:

> Please also have a look, if you find the update of GLRO(dl_hwcap).

I tright once more, even went back in Git history, and used hardware
watchpoints, but the code I imagined is just not there.  So I think it's
okay to proceed with this (fix the MIPS issue 8-).

Thanks,
Florian


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [RFC 0/9] Remove legacy platform bits and cleanups
  2024-06-10 13:36   ` Stefan Liebler
@ 2024-06-11 12:13     ` Stefan Liebler
  2024-06-12  7:50       ` Stefan Liebler
  0 siblings, 1 reply; 30+ messages in thread
From: Stefan Liebler @ 2024-06-11 12:13 UTC (permalink / raw)
  To: Florian Weimer; +Cc: libc-alpha, Javier Pello, Adhemerval Zanella, bergner

On 10.06.24 15:36, Stefan Liebler wrote:
> On 08.06.24 13:09, Florian Weimer wrote:
>> * Stefan Liebler:
>>
>>> This patch series is the result of:
>>> "Question regarding platform-bits in ld.so.cache"
>>> https://sourceware.org/pipermail/libc-alpha/2024-May/156793.html
>>
>> This series fails to build on MIPS with:
>>
>> mips64-glibc-linux-gnu-gcc -mabi=32 ldconfig.c -c -std=gnu11 -fgnu89-inline  -g -O2 -Wall -Wwrite-strings -Wundef -Werror -fmerge-all-constants -frounding-math -fno-stack-protector -fno-common -Wp,-U_FORTIFY_SOURCE -Wstrict-prototypes -Wold-style-definition -fmath-errno -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64   -fPIE    -Wa,-execstack -D'SYSCONFDIR="/etc"' -D'LIBDIR="/usr/lib"' -D'SLIBDIR="/lib"'       -I../include -I/home/bmg/build/glibcs/mips-linux-gnu/glibc/elf  -I/home/bmg/build/glibcs/mips-linux-gnu/glibc  -I../sysdeps/unix/sysv/linux/mips/mips32/fpu  -I../sysdeps/unix/sysv/linux/mips/mips32  -I../sysdeps/unix/sysv/linux/mips  -I../sysdeps/mips/nptl  -I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux  -I../sysdeps/nptl  -I../sysdeps/pthread  -I../sysdeps/gnu  -I../sysdeps/unix/inet  -I../sysdeps/unix/sysv  -I../sysdeps/unix/mips/mips32  -I../sysdeps/unix/mips  -I../sysdeps/unix  -I../sysdeps/posix  -I../sysdeps/mips/mips32/fpu  -I../sysdeps/mips/mips32  -I../sysdeps/mips/ieee754  -I../sysdeps/mips/include -I../sysdeps/mips  -I../sysdeps/ieee754/flt-32  -I../sysdeps/ieee754/dbl-64  -I../sysdeps/wordsize-32  -I../sysdeps/mips/fpu  -I../sysdeps/ieee754  -I../sysdeps/generic  -I.. -I../libio -I.   -D_LIBC_REENTRANT -include /home/bmg/build/glibcs/mips-linux-gnu/glibc/libc-modules.h -DMODULE_NAME=ldconfig -include ../include/libc-symbols.h  -DPIC     -DTOP_NAMESPACE=glibc -o /home/bmg/build/glibcs/mips-linux-gnu/glibc/elf/ldconfig.o -MD -MP -MF /home/bmg/build/glibcs/mips-linux-gnu/glibc/elf/ldconfig.o.dt -MT /home/bmg/build/glibcs/mips-linux-gnu/glibc/elf/ldconfig.o
>> In file included from ../sysdeps/generic/ldsodefs.h:643,
>>                  from ../sysdeps/mips/ldsodefs.h:82,
>>                  from ../sysdeps/gnu/ldsodefs.h:46,
>>                  from ../sysdeps/unix/sysv/linux/ldsodefs.h:25,
>>                  from ../sysdeps/unix/sysv/linux/mips/ldsodefs.h:22,
>>                  from ../sysdeps/mips/dl-procinfo.h:22,
>>                  from /home/bmg/build/glibcs/mips-linux-gnu/glibc/dl-tunable-list.h:6,
>>                  from ../elf/dl-tunables.h:48,
>>                  from ./dl-hwcaps.h:25,
>>                  from ldconfig.c:44:
>> ../sysdeps/unix/sysv/linux/dl-vdso-setup.c:62:22: error: ‘_dl_vdso_clock_getres’ defined but not used [-Werror=unused-variable]
>>    62 | PROCINFO_CLASS int (*_dl_vdso_clock_getres) (clockid_t,
>>       |                      ^~~~~~~~~~~~~~~~~~~~~
>> ../sysdeps/unix/sysv/linux/dl-vdso-setup.c:53:22: error: ‘_dl_vdso_gettimeofday’ defined but not used [-Werror=unused-variable]
>>    53 | PROCINFO_CLASS int (*_dl_vdso_gettimeofday) (struct timeval *, void *) RELRO;
>>       |                      ^~~~~~~~~~~~~~~~~~~~~
>> ../sysdeps/unix/sysv/linux/dl-vdso-setup.c:49:22: error: ‘_dl_vdso_clock_gettime64’ defined but not used [-Werror=unused-variable]
>>    49 | PROCINFO_CLASS int (*_dl_vdso_clock_gettime64) (clockid_t,
>>       |                      ^~~~~~~~~~~~~~~~~~~~~~~~
>> ../sysdeps/unix/sysv/linux/dl-vdso-setup.c:45:22: error: ‘_dl_vdso_clock_gettime’ defined but not used [-Werror=unused-variable]
>>    45 | PROCINFO_CLASS int (*_dl_vdso_clock_gettime) (clockid_t,
>>       |                      ^~~~~~~~~~~~~~~~~~~~~~
>> cc1: all warnings being treated as errors
>> make[3]: *** [../o-iterator.mk:9: /home/bmg/build/glibcs/mips-linux-gnu/glibc/elf/ldconfig.o] Error 1
>> make[3]: Leaving directory '/home/bmg/src/glibc/elf'
>> make[3]: *** Waiting for unfinished jobs....
>> make[2]: *** [Makefile:484: elf/others] Error 2
>> make[1]: *** [Makefile:9: all] Error 2
>>
>> Florian
>>
> Hi Florian,
> 
> thanks for the info. I've take a look. Seems to be related to the
> removed sysdeps/mips/dl-procinfo.c with those undefs at the end:
> #undef PROCINFO_DECL
> #undef PROCINFO_CLASS
> 
> Bye,
> Stefan

Okay, we have this chain:
- elf/ldconfig.c:
#define PROCINFO_CLASS static
#include <dl-hwcaps.h>
-> elf/dl-hwcaps.h
-> elf/dl-tunables.h
-> <build>/dl-tunable-list.h
-> sysdeps/mips/dl-procinfo.h:
-> sysdeps/unix/sysv/linux/mips/ldsodefs.h
-> sysdeps/unix/sysv/linux/ldsodefs.h:
-> sysdeps/gnu/ldsodefs.h
-> sysdeps/mips/ldsodefs.h
-> sysdeps/generic/ldsodefs.h:
...
#include <dl-procinfo.c>
...
# define PROCINFO_DECL
# ifndef PROCINFO_CLASS
#  define PROCINFO_CLASS EXTERN
# endif
# include <dl-vdso-setup.c>
...

Before my patch, sysdeps/mips/dl-procinfo.c contains those undefs at the
end:
#undef PROCINFO_DECL
#undef PROCINFO_CLASS
With my patch, the empty sysdeps/generic/dl-procinfo.c is used.

Thus we end up in:
static int (*_dl_vdso_...) (...) RELRO;
vs before:
extern int (*_dl_vdso_...) (...) RELRO;

The latter builds fine, while the former produces the "defined but not
used" warnings.


Thus I will adjust my patch to keep sysdeps/mips/dl-procinfo.c with only
something like this:
/* Note:
   When compiling elf/ldconfig.c, PROCINFO_CLASS is defined to static.
   This dl-procinfo.c is included in sysdeps/generic/ldsodefs.h.
   Afterwards, if not yet defined, PROCINFO_CLASS is defined to EXTERN
   just before dl-vdso-setup.c is included.  A "static" _dl_vdso_xyz
   function prototype would lead to gcc warnings/errors: defined but
   not used.  */
#undef PROCINFO_DECL
#undef PROCINFO_CLASS


My patch also removes sysdeps/alpha/dl-procinfo.c and
sysdeps/csky/dl-procinfo.c with those #undef's at the end. But alpha and
csky do not define the vdso HAVE_XYZ_VSYSCALL macros and thus do not end
up with those errors.
(At the end of dl-vdso-setup.c, PROCINFO_DECL and PROCINFO_CLASS are
also undefined)

I run build-many-glibcs.py from scratch which lasts some time.
Afterwards I'll send a V2 series.

Thanks,
Stefan

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [RFC 0/9] Remove legacy platform bits and cleanups
  2024-06-10 14:03     ` Florian Weimer
@ 2024-06-11 12:24       ` Stefan Liebler
  0 siblings, 0 replies; 30+ messages in thread
From: Stefan Liebler @ 2024-06-11 12:24 UTC (permalink / raw)
  To: Florian Weimer; +Cc: libc-alpha, devel, adhemerval.zanella, bergner

On 10.06.24 16:03, Florian Weimer wrote:
> * Stefan Liebler:
> 
>> Please also have a look, if you find the update of GLRO(dl_hwcap).
> 
> I tright once more, even went back in Git history, and used hardware
> watchpoints, but the code I imagined is just not there.  So I think it's
> okay to proceed with this (fix the MIPS issue 8-).
> 
> Thanks,
> Florian
> 
Sounds great. Thanks for digging.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [RFC 1/9] x86: Remove HWCAP_START and HWCAP_COUNT
  2024-06-07 11:42 ` [RFC 1/9] x86: Remove HWCAP_START and HWCAP_COUNT Stefan Liebler
@ 2024-06-11 18:14   ` Adhemerval Zanella Netto
  0 siblings, 0 replies; 30+ messages in thread
From: Adhemerval Zanella Netto @ 2024-06-11 18:14 UTC (permalink / raw)
  To: Stefan Liebler, libc-alpha; +Cc: fweimer, devel, bergner



On 07/06/24 08:42, Stefan Liebler wrote:
> Both defines are not used anymore.  Those were only used for
> _dl_string_hwcap(), which itself was removed with commit
> ab40f20364f4a417a63dd51fdd943742070bfe96
> "elf: Remove _dl_string_hwcap"
> 
> Just clean up.

LGTM, thanks.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/x86/dl-hwcap.h | 6 ------
>  1 file changed, 6 deletions(-)
> 
> diff --git a/sysdeps/x86/dl-hwcap.h b/sysdeps/x86/dl-hwcap.h
> index 21dd24d5d2..e14e755bd7 100644
> --- a/sysdeps/x86/dl-hwcap.h
> +++ b/sysdeps/x86/dl-hwcap.h
> @@ -23,23 +23,17 @@
>     to cover all platforms and hardware capabilities.  */
>  # define HWCAP_PLATFORMS_START	0
>  # define HWCAP_PLATFORMS_COUNT	4
> -# define HWCAP_START		0
> -# define HWCAP_COUNT		3
>  # define HWCAP_IMPORTANT \
>    (HWCAP_X86_SSE2 | HWCAP_X86_64 | HWCAP_X86_AVX512_1)
>  #elif defined __x86_64__
>  /* For 64 bit, only cover x86-64 platforms and capabilities.  */
>  # define HWCAP_PLATFORMS_START	2
>  # define HWCAP_PLATFORMS_COUNT	4
> -# define HWCAP_START		1
> -# define HWCAP_COUNT		3
>  # define HWCAP_IMPORTANT	(HWCAP_X86_64 | HWCAP_X86_AVX512_1)
>  #else
>  /* For 32 bit, only cover i586, i686 and SSE2.  */
>  # define HWCAP_PLATFORMS_START	0
>  # define HWCAP_PLATFORMS_COUNT	2
> -# define HWCAP_START		0
> -# define HWCAP_COUNT		1
>  # define HWCAP_IMPORTANT	(HWCAP_X86_SSE2)
>  #endif
>  

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [RFC 2/9] elf: Remove loading legacy hwcaps/platform entries in dynamic loader
  2024-06-07 11:42 ` [RFC 2/9] elf: Remove loading legacy hwcaps/platform entries in dynamic loader Stefan Liebler
@ 2024-06-11 18:57   ` Adhemerval Zanella Netto
  0 siblings, 0 replies; 30+ messages in thread
From: Adhemerval Zanella Netto @ 2024-06-11 18:57 UTC (permalink / raw)
  To: Stefan Liebler, libc-alpha; +Cc: fweimer, devel, bergner



On 07/06/24 08:42, Stefan Liebler wrote:
> The legacy hwcaps mechanism was removed with glibc 2.37:
> See this commit series:
> - d178c67535f0d159df73843e7c18cbdb39b4d25d
> x86_64: Remove platform directory library loading test
> - 6099908fb84debee4c3bcb05d88769410c2aecd1
> elf: Remove legacy hwcaps support from the dynamic loader
> - b78ff5a25dc8ba9d8c6df10bb0a533254bdd193f
> elf: Remove legacy hwcaps support from ldconfig
> - 4a7094119ce05cadf927f52cc5d723e2195e65f9
> elf: Remove hwcap parameter from add_to_cache signature
> - cfbf883db36727a84ef7929af49ef68c195b5972
> elf: Remove hwcap and bits_hwcap fields from struct cache_entry
> - 78d9a1620b840deb0880686e4159eaf70708866a
> Add NEWS entry for legacy hwcaps removal
> - ab40f20364f4a417a63dd51fdd943742070bfe96
> elf: Remove _dl_string_hwcap
> - e76369ed6371734f77f468eab097ef4e5b5db1c5
> elf: Simplify output of hwcap subdirectories in ld.so help
> 
> According to Florian Weimer, this was an oversight and should also
> have been removed.
> 
> As ldconfig does not generate ld.so.cache entries with hwcap/platform
> bits in the hwcap-field anymore, this patch now skips those entries.
> Thus currently only named-hwcap-entries and the default entries are
> allowed.
> For named-hwcap entries bit 62 is set and also the isa-level bits can
> be set.
> For the default entries the hwcap-field is 0.

LGTM, thanks.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> ---
>  elf/dl-cache.c | 22 +++-------------------
>  1 file changed, 3 insertions(+), 19 deletions(-)
> 
> diff --git a/elf/dl-cache.c b/elf/dl-cache.c
> index 85f3f179ed..7c7dc58745 100644
> --- a/elf/dl-cache.c
> +++ b/elf/dl-cache.c
> @@ -27,10 +27,6 @@
>  #include <dl-hwcaps.h>
>  #include <dl-isa-level.h>
>  
> -#ifndef _DL_PLATFORMS_COUNT
> -# define _DL_PLATFORMS_COUNT 0
> -#endif
> -
>  /* This is the starting address and the size of the mmap()ed file.  */
>  static struct cache_file *cache;
>  static struct cache_file_new *cache_new;
> @@ -201,15 +197,6 @@ search_cache (const char *string_table, uint32_t string_table_size,
>  	      struct file_entry *libs, uint32_t nlibs, uint32_t entry_size,
>  	      const char *name)
>  {
> -  /* Used by the HWCAP check in the struct file_entry_new case.  */
> -  uint64_t platform = _dl_string_platform (GLRO (dl_platform));
> -  if (platform != (uint64_t) -1)
> -    platform = 1ULL << platform;
> -  uint64_t hwcap_mask = TUNABLE_GET (glibc, cpu, hwcap_mask, uint64_t, NULL);
> -#define _DL_HWCAP_TLS_MASK (1LL << 63)
> -  uint64_t hwcap_exclude = ~((GLRO (dl_hwcap) & hwcap_mask)
> -			     | _DL_HWCAP_PLATFORM | _DL_HWCAP_TLS_MASK);
> -
>    int left = 0;
>    int right = nlibs - 1;
>    const char *best = NULL;
> @@ -295,12 +282,9 @@ search_cache (const char *string_table, uint32_t string_table_size,
>  		      if (!named_hwcap && best != NULL)
>  			break;
>  
> -		      if ((libnew->hwcap & hwcap_exclude) && !named_hwcap)
> -			continue;
> -		      if (_DL_PLATFORMS_COUNT
> -			  && (libnew->hwcap & _DL_HWCAP_PLATFORM) != 0
> -			  && ((libnew->hwcap & _DL_HWCAP_PLATFORM)
> -			      != platform))
> +		      /* Skip entries with the legacy hwcap/platform mechanism
> +			 which was removed with glibc 2.37.  */
> +		      if (!named_hwcap && libnew->hwcap != 0)
>  			continue;
>  
>  #ifdef SHARED

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [RFC 3/9] elf: Remove _dl_string_platform
  2024-06-07 11:42 ` [RFC 3/9] elf: Remove _dl_string_platform Stefan Liebler
@ 2024-06-11 19:09   ` Adhemerval Zanella Netto
  0 siblings, 0 replies; 30+ messages in thread
From: Adhemerval Zanella Netto @ 2024-06-11 19:09 UTC (permalink / raw)
  To: Stefan Liebler, libc-alpha; +Cc: fweimer, devel, bergner



On 07/06/24 08:42, Stefan Liebler wrote:
> Despite of powerpc where the returned integer is stored in tcb,
> and the diagnostics output, there is no user anymore.
> 
> Thus this patch removes the diagnostics output and
> _dl_string_platform for all other platforms.

LGTM, thanks

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> ---
>  elf/dl-diagnostics.c                          |  2 --
>  sysdeps/alpha/dl-procinfo.h                   | 15 ---------------
>  sysdeps/csky/dl-procinfo.h                    | 15 ---------------
>  sysdeps/generic/dl-procinfo.h                 |  2 --
>  sysdeps/mips/dl-procinfo.h                    | 15 ---------------
>  sysdeps/s390/dl-procinfo.h                    | 15 ---------------
>  sysdeps/sparc/dl-procinfo.h                   |  2 --
>  sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h |  2 --
>  sysdeps/unix/sysv/linux/arm/dl-procinfo.h     |  2 --
>  sysdeps/x86/dl-procinfo.h                     | 15 ---------------
>  10 files changed, 85 deletions(-)
> 
> diff --git a/elf/dl-diagnostics.c b/elf/dl-diagnostics.c
> index aaf67b87e8..e69463b2bd 100644
> --- a/elf/dl-diagnostics.c
> +++ b/elf/dl-diagnostics.c
> @@ -245,8 +245,6 @@ _dl_print_diagnostics (char **environ)
>    _dl_diagnostics_print_labeled_string ("dl_platform", GLRO (dl_platform));
>    _dl_diagnostics_print_labeled_string
>      ("dl_profile_output", GLRO (dl_profile_output));
> -  _dl_diagnostics_print_labeled_value
> -    ("dl_string_platform", _dl_string_platform ( GLRO (dl_platform)));
>  
>    _dl_diagnostics_print_labeled_string ("dso.ld", LD_SO);
>    _dl_diagnostics_print_labeled_string ("dso.libc", LIBC_SO);
> diff --git a/sysdeps/alpha/dl-procinfo.h b/sysdeps/alpha/dl-procinfo.h
> index f1e2e98e08..bc4db868a9 100644
> --- a/sysdeps/alpha/dl-procinfo.h
> +++ b/sysdeps/alpha/dl-procinfo.h
> @@ -27,21 +27,6 @@
>  
>  #define _DL_PLATFORMS_COUNT   5
>  
> -static inline int
> -__attribute__ ((unused, always_inline))
> -_dl_string_platform (const char *str)
> -{
> -  int i;
> -
> -  if (str != NULL)
> -    for (i = 0; i < _DL_PLATFORMS_COUNT; ++i)
> -      {
> -        if (strcmp (str, GLRO(dl_alpha_platforms)[i]) == 0)
> -          return i;
> -      }
> -  return -1;
> -};
> -
>  /* We cannot provide a general printing function.  */
>  #define _dl_procinfo(type, word) -1
>  
> diff --git a/sysdeps/csky/dl-procinfo.h b/sysdeps/csky/dl-procinfo.h
> index 77621e4b20..a54e8de446 100644
> --- a/sysdeps/csky/dl-procinfo.h
> +++ b/sysdeps/csky/dl-procinfo.h
> @@ -27,21 +27,6 @@
>  
>  #define _DL_PLATFORMS_COUNT   4
>  
> -static inline int
> -__attribute__ ((unused, always_inline))
> -_dl_string_platform (const char *str)
> -{
> -  int i;
> -
> -  if (str != NULL)
> -    for (i = 0; i < _DL_PLATFORMS_COUNT; ++i)
> -      {
> -        if (strcmp (str, GLRO(dl_csky_platforms)[i]) == 0)
> -          return i;
> -      }
> -  return -1;
> -};
> -
>  /* We cannot provide a general printing function.  */
>  #define _dl_procinfo(word, val) -1
>  
> diff --git a/sysdeps/generic/dl-procinfo.h b/sysdeps/generic/dl-procinfo.h
> index c4818497c8..00e1ae7b2f 100644
> --- a/sysdeps/generic/dl-procinfo.h
> +++ b/sysdeps/generic/dl-procinfo.h
> @@ -34,6 +34,4 @@
>  /* We don't have any hardware capabilities.  */
>  #define _DL_HWCAP_COUNT 0
>  
> -#define _dl_string_platform(str) (-1)
> -
>  #endif /* dl-procinfo.h */
> diff --git a/sysdeps/mips/dl-procinfo.h b/sysdeps/mips/dl-procinfo.h
> index 6655e68f54..3199434390 100644
> --- a/sysdeps/mips/dl-procinfo.h
> +++ b/sysdeps/mips/dl-procinfo.h
> @@ -27,21 +27,6 @@
>  
>  #define _DL_PLATFORMS_COUNT   4
>  
> -static inline int
> -__attribute__ ((unused, always_inline))
> -_dl_string_platform (const char *str)
> -{
> -  int i;
> -
> -  if (str != NULL)
> -    for (i = 0; i < _DL_PLATFORMS_COUNT; ++i)
> -      {
> -        if (strcmp (str, GLRO(dl_mips_platforms)[i]) == 0)
> -          return i;
> -      }
> -  return -1;
> -};
> -
>  /* We cannot provide a general printing function.  */
>  #define _dl_procinfo(type, word) -1
>  
> diff --git a/sysdeps/s390/dl-procinfo.h b/sysdeps/s390/dl-procinfo.h
> index 38e77f7ad9..ffeb655ad0 100644
> --- a/sysdeps/s390/dl-procinfo.h
> +++ b/sysdeps/s390/dl-procinfo.h
> @@ -83,19 +83,4 @@ _dl_hwcap_string (int idx)
>    return _dl_s390_cap_flags[idx];
>  };
>  
> -static inline int
> -__attribute__ ((unused, always_inline))
> -_dl_string_platform (const char *str)
> -{
> -  int i;
> -
> -  if (str != NULL)
> -    for (i = 0; i < _DL_PLATFORMS_COUNT; ++i)
> -      {
> -	if (strcmp (str, _dl_s390_platforms[i]) == 0)
> -	  return _DL_FIRST_PLATFORM + i;
> -      }
> -  return -1;
> -};
> -
>  #endif /* dl-procinfo.h */
> diff --git a/sysdeps/sparc/dl-procinfo.h b/sysdeps/sparc/dl-procinfo.h
> index 61cd296de0..dbb1a4d324 100644
> --- a/sysdeps/sparc/dl-procinfo.h
> +++ b/sysdeps/sparc/dl-procinfo.h
> @@ -60,6 +60,4 @@ _dl_hwcap_string (int idx)
>  /* There're no platforms to filter out.  */
>  #define _DL_HWCAP_PLATFORM 0
>  
> -#define _dl_string_platform(str) (-1)
> -
>  #endif /* dl-procinfo.h */
> diff --git a/sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h b/sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h
> index 6a3fb78c47..0ed89c5e41 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h
> +++ b/sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h
> @@ -40,6 +40,4 @@ _dl_hwcap_string (int idx)
>  /* There're no platforms to filter out.  */
>  #define _DL_HWCAP_PLATFORM 0
>  
> -#define _dl_string_platform(str) (-1)
> -
>  #endif /* dl-procinfo.h */
> diff --git a/sysdeps/unix/sysv/linux/arm/dl-procinfo.h b/sysdeps/unix/sysv/linux/arm/dl-procinfo.h
> index 49cf0008b2..2a1c5985ee 100644
> --- a/sysdeps/unix/sysv/linux/arm/dl-procinfo.h
> +++ b/sysdeps/unix/sysv/linux/arm/dl-procinfo.h
> @@ -75,6 +75,4 @@ _dl_procinfo (unsigned int type, unsigned long int word)
>  
>  #define HWCAP_IMPORTANT		(HWCAP_ARM_VFP | HWCAP_ARM_NEON)
>  
> -#define _dl_string_platform(str) (-1)
> -
>  #endif /* dl-procinfo.h */
> diff --git a/sysdeps/x86/dl-procinfo.h b/sysdeps/x86/dl-procinfo.h
> index 3902925be4..b2184b8f5d 100644
> --- a/sysdeps/x86/dl-procinfo.h
> +++ b/sysdeps/x86/dl-procinfo.h
> @@ -30,19 +30,4 @@
>  #define _DL_HWCAP_PLATFORM	(((1ULL << _DL_PLATFORMS_COUNT) - 1) \
>  				 << _DL_FIRST_PLATFORM)
>  
> -static inline int
> -__attribute__ ((unused, always_inline))
> -_dl_string_platform (const char *str)
> -{
> -  int i;
> -
> -  if (str != NULL)
> -    for (i = HWCAP_PLATFORMS_START; i < HWCAP_PLATFORMS_COUNT; ++i)
> -      {
> -	if (strcmp (str, GLRO(dl_x86_platforms)[i]) == 0)
> -	  return _DL_FIRST_PLATFORM + i;
> -      }
> -  return -1;
> -};
> -
>  #endif /* dl-procinfo.h */

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [RFC 4/9] elf: Remove platform strings in dl-procinfo.c
  2024-06-07 11:42 ` [RFC 4/9] elf: Remove platform strings in dl-procinfo.c Stefan Liebler
@ 2024-06-11 19:20   ` Adhemerval Zanella Netto
  2024-06-12  7:32     ` [V2] " Stefan Liebler
  0 siblings, 1 reply; 30+ messages in thread
From: Adhemerval Zanella Netto @ 2024-06-11 19:20 UTC (permalink / raw)
  To: Stefan Liebler, libc-alpha; +Cc: fweimer, devel, bergner



On 07/06/24 08:42, Stefan Liebler wrote:
> Remove the platform strings in dl-procinfo.c where also
> the implementation of _dl_string_platform() was removed.

Aside the mips build failure, the rest of patch look good.

> ---
>  sysdeps/alpha/dl-procinfo.c     | 62 ---------------------------------
>  sysdeps/csky/dl-procinfo.c      | 62 ---------------------------------
>  sysdeps/mips/dl-procinfo.c      | 62 ---------------------------------
>  sysdeps/s390/dl-procinfo-s390.c |  6 ----
>  sysdeps/s390/dl-procinfo.h      |  1 -
>  sysdeps/x86/dl-procinfo.c       | 16 ---------
>  6 files changed, 209 deletions(-)
>  delete mode 100644 sysdeps/alpha/dl-procinfo.c
>  delete mode 100644 sysdeps/csky/dl-procinfo.c
>  delete mode 100644 sysdeps/mips/dl-procinfo.c
> 
> diff --git a/sysdeps/alpha/dl-procinfo.c b/sysdeps/alpha/dl-procinfo.c
> deleted file mode 100644
> index 633dcbf974..0000000000
> --- a/sysdeps/alpha/dl-procinfo.c
> +++ /dev/null
> @@ -1,62 +0,0 @@
> -/* Data for Alpha version of processor capability information.
> -   Copyright (C) 2008-2024 Free Software Foundation, Inc.
> -   This file is part of the GNU C Library.
> -
> -   The GNU C Library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 of the License, or (at your option) any later version.
> -
> -   The GNU C Library is distributed in the hope that it will be useful,
> -   but WITHOUT ANY WARRANTY; without even the implied warranty of
> -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with the GNU C Library.  If not, see
> -   <https://www.gnu.org/licenses/>.  */
> -
> -/* This information must be kept in sync with the _DL_PLATFORM_COUNT
> -   definitions in procinfo.h.
> -
> -   If anything should be added here check whether the size of each string
> -   is still ok with the given array size.
> -
> -   All the #ifdefs in the definitions are quite irritating but
> -   necessary if we want to avoid duplicating the information.  There
> -   are three different modes:
> -
> -   - PROCINFO_DECL is defined.  This means we are only interested in
> -     declarations.
> -
> -   - PROCINFO_DECL is not defined:
> -
> -     + if SHARED is defined the file is included in an array
> -       initializer.  The .element = { ... } syntax is needed.
> -
> -     + if SHARED is not defined a normal array initialization is
> -       needed.
> -  */
> -
> -#ifndef PROCINFO_CLASS
> -#define PROCINFO_CLASS
> -#endif
> -
> -#if !defined PROCINFO_DECL && defined SHARED
> -  ._dl_alpha_platforms
> -#else
> -PROCINFO_CLASS const char _dl_alpha_platforms[5][5]
> -#endif
> -#ifndef PROCINFO_DECL
> -= {
> -    "ev4", "ev5", "ev56", "ev6", "ev67"
> -  }
> -#endif
> -#if !defined SHARED || defined PROCINFO_DECL
> -;
> -#else
> -,
> -#endif
> -
> -#undef PROCINFO_DECL
> -#undef PROCINFO_CLASS
> diff --git a/sysdeps/csky/dl-procinfo.c b/sysdeps/csky/dl-procinfo.c
> deleted file mode 100644
> index 0c81518cff..0000000000
> --- a/sysdeps/csky/dl-procinfo.c
> +++ /dev/null
> @@ -1,62 +0,0 @@
> -/* Data for C-SKY version of processor capability information.
> -   Copyright (C) 2018-2024 Free Software Foundation, Inc.
> -   This file is part of the GNU C Library.
> -
> -   The GNU C Library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 of the License, or (at your option) any later version.
> -
> -   The GNU C Library is distributed in the hope that it will be useful,
> -   but WITHOUT ANY WARRANTY; without even the implied warranty of
> -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with the GNU C Library.  If not, see
> -   <https://www.gnu.org/licenses/>.  */
> -
> -/* This information must be kept in sync with the _DL_PLATFORM_COUNT
> -   definitions in procinfo.h.
> -
> -   If anything should be added here check whether the size of each string
> -   is still ok with the given array size.
> -
> -   All the #ifdefs in the definitions are quite irritating but
> -   necessary if we want to avoid duplicating the information.  There
> -   are three different modes:
> -
> -   - PROCINFO_DECL is defined.  This means we are only interested in
> -     declarations.
> -
> -   - PROCINFO_DECL is not defined:
> -
> -     + if SHARED is defined the file is included in an array
> -       initializer.  The .element = { ... } syntax is needed.
> -
> -     + if SHARED is not defined a normal array initialization is
> -       needed.
> -  */
> -
> -#ifndef PROCINFO_CLASS
> -# define PROCINFO_CLASS
> -#endif
> -
> -#if !defined PROCINFO_DECL && defined SHARED
> -  ._dl_csky_platforms
> -#else
> -PROCINFO_CLASS const char _dl_csky_platforms[4][6]
> -#endif
> -#ifndef PROCINFO_DECL
> -= {
> -    "ck610", "ck807", "ck810", "ck860"
> -  }
> -#endif
> -#if !defined SHARED || defined PROCINFO_DECL
> -;
> -#else
> -,
> -#endif
> -
> -#undef PROCINFO_DECL
> -#undef PROCINFO_CLASS
> diff --git a/sysdeps/mips/dl-procinfo.c b/sysdeps/mips/dl-procinfo.c
> deleted file mode 100644
> index 0b1dfeea2d..0000000000
> --- a/sysdeps/mips/dl-procinfo.c
> +++ /dev/null
> @@ -1,62 +0,0 @@
> -/* Data for Mips version of processor capability information.
> -   Copyright (C) 2007-2024 Free Software Foundation, Inc.
> -   This file is part of the GNU C Library.
> -
> -   The GNU C Library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 of the License, or (at your option) any later version.
> -
> -   The GNU C Library is distributed in the hope that it will be useful,
> -   but WITHOUT ANY WARRANTY; without even the implied warranty of
> -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with the GNU C Library.  If not, see
> -   <https://www.gnu.org/licenses/>.  */
> -
> -/* This information must be kept in sync with the _DL_PLATFORM_COUNT
> -   definitions in procinfo.h.
> -
> -   If anything should be added here check whether the size of each string
> -   is still ok with the given array size.
> -
> -   All the #ifdefs in the definitions are quite irritating but
> -   necessary if we want to avoid duplicating the information.  There
> -   are three different modes:
> -
> -   - PROCINFO_DECL is defined.  This means we are only interested in
> -     declarations.
> -
> -   - PROCINFO_DECL is not defined:
> -
> -     + if SHARED is defined the file is included in an array
> -       initializer.  The .element = { ... } syntax is needed.
> -
> -     + if SHARED is not defined a normal array initialization is
> -       needed.
> -  */
> -
> -#ifndef PROCINFO_CLASS
> -#define PROCINFO_CLASS
> -#endif
> -
> -#if !defined PROCINFO_DECL && defined SHARED
> -  ._dl_mips_platforms
> -#else
> -PROCINFO_CLASS const char _dl_mips_platforms[4][11]
> -#endif
> -#ifndef PROCINFO_DECL
> -= {
> -    "loongson2e", "loongson2f", "octeon", "octeon2"
> -  }
> -#endif
> -#if !defined SHARED || defined PROCINFO_DECL
> -;
> -#else
> -,
> -#endif
> -
> -#undef PROCINFO_DECL
> -#undef PROCINFO_CLASS
> diff --git a/sysdeps/s390/dl-procinfo-s390.c b/sysdeps/s390/dl-procinfo-s390.c
> index 2821e40cb1..652f6067a3 100644
> --- a/sysdeps/s390/dl-procinfo-s390.c
> +++ b/sysdeps/s390/dl-procinfo-s390.c
> @@ -24,9 +24,3 @@ const char _dl_s390_cap_flags[_DL_HWCAP_COUNT][9] =
>      "highgprs", "te", "vx", "vxd", "vxe", "gs", "vxe2", "vxp", "sort", "dflt",
>      "vxp2", "nnpa", "pcimio", "sie"
>    };
> -
> -const char _dl_s390_platforms[_DL_PLATFORMS_COUNT][7] =
> -  {
> -    "g5", "z900", "z990", "z9-109", "z10", "z196", "zEC12", "z13", "z14", "z15",
> -    "z16"
> -  };
> diff --git a/sysdeps/s390/dl-procinfo.h b/sysdeps/s390/dl-procinfo.h
> index ffeb655ad0..63c9889f94 100644
> --- a/sysdeps/s390/dl-procinfo.h
> +++ b/sysdeps/s390/dl-procinfo.h
> @@ -24,7 +24,6 @@
>  extern const char _dl_s390_cap_flags[_DL_HWCAP_COUNT][9] attribute_hidden;
>  
>  #define _DL_PLATFORMS_COUNT	11
> -extern const char _dl_s390_platforms[_DL_PLATFORMS_COUNT][7] attribute_hidden;
>  
>  /* The kernel provides up to 32 capability bits with elf_hwcap.  */
>  #define _DL_FIRST_PLATFORM	32
> diff --git a/sysdeps/x86/dl-procinfo.c b/sysdeps/x86/dl-procinfo.c
> index 5920d4b320..165ffd89a9 100644
> --- a/sysdeps/x86/dl-procinfo.c
> +++ b/sysdeps/x86/dl-procinfo.c
> @@ -71,22 +71,6 @@ PROCINFO_CLASS const char _dl_x86_hwcap_flags[3][9]
>  ,
>  #endif
>  
> -#if !defined PROCINFO_DECL && defined SHARED
> -  ._dl_x86_platforms
> -#else
> -PROCINFO_CLASS const char _dl_x86_platforms[4][9]
> -#endif
> -#ifndef PROCINFO_DECL
> -= {
> -    "i586", "i686", "haswell", "xeon_phi"
> -  }
> -#endif
> -#if !defined SHARED || defined PROCINFO_DECL
> -;
> -#else
> -,
> -#endif
> -
>  #if defined SHARED && !IS_IN (ldconfig)
>  # if !defined PROCINFO_DECL
>    ._dl_x86_tlsdesc_dynamic

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [RFC 5/9] elf: Remove _DL_HWCAP_PLATFORM
  2024-06-07 11:42 ` [RFC 5/9] elf: Remove _DL_HWCAP_PLATFORM Stefan Liebler
@ 2024-06-11 19:28   ` Adhemerval Zanella Netto
  0 siblings, 0 replies; 30+ messages in thread
From: Adhemerval Zanella Netto @ 2024-06-11 19:28 UTC (permalink / raw)
  To: Stefan Liebler, libc-alpha; +Cc: fweimer, devel, bergner



On 07/06/24 08:42, Stefan Liebler wrote:
> Remove the definitions of _DL_HWCAP_PLATFORM as those are not used
> anymore after removal in elf/dl-cache.c:search_cache().

LGTM, thanks

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/alpha/dl-procinfo.h                   | 3 ---
>  sysdeps/csky/dl-procinfo.h                    | 2 --
>  sysdeps/generic/dl-procinfo.h                 | 3 ---
>  sysdeps/mips/dl-procinfo.h                    | 3 ---
>  sysdeps/powerpc/dl-procinfo.h                 | 3 ---
>  sysdeps/s390/dl-procinfo.h                    | 3 ---
>  sysdeps/sparc/dl-procinfo.h                   | 3 ---
>  sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h | 3 ---
>  sysdeps/unix/sysv/linux/arm/dl-procinfo.h     | 3 ---
>  sysdeps/x86/dl-procinfo.h                     | 3 ---
>  10 files changed, 29 deletions(-)
> 
> diff --git a/sysdeps/alpha/dl-procinfo.h b/sysdeps/alpha/dl-procinfo.h
> index bc4db868a9..90f83ec24e 100644
> --- a/sysdeps/alpha/dl-procinfo.h
> +++ b/sysdeps/alpha/dl-procinfo.h
> @@ -22,9 +22,6 @@
>  #include <ldsodefs.h>
>  
>  
> -/* Mask to filter out platforms.  */
> -#define _DL_HWCAP_PLATFORM    (-1ULL)
> -
>  #define _DL_PLATFORMS_COUNT   5
>  
>  /* We cannot provide a general printing function.  */
> diff --git a/sysdeps/csky/dl-procinfo.h b/sysdeps/csky/dl-procinfo.h
> index a54e8de446..803441f52c 100644
> --- a/sysdeps/csky/dl-procinfo.h
> +++ b/sysdeps/csky/dl-procinfo.h
> @@ -22,8 +22,6 @@
>  
>  #include <ldsodefs.h>
>  
> -/* Mask to filter out platforms.  */
> -#define _DL_HWCAP_PLATFORM    (-1ULL)
>  
>  #define _DL_PLATFORMS_COUNT   4
>  
> diff --git a/sysdeps/generic/dl-procinfo.h b/sysdeps/generic/dl-procinfo.h
> index 00e1ae7b2f..1778fd1057 100644
> --- a/sysdeps/generic/dl-procinfo.h
> +++ b/sysdeps/generic/dl-procinfo.h
> @@ -28,9 +28,6 @@
>  /* By default there is no important hardware capability.  */
>  #define HWCAP_IMPORTANT (0)
>  
> -/* There're no platforms to filter out.  */
> -#define _DL_HWCAP_PLATFORM 0
> -
>  /* We don't have any hardware capabilities.  */
>  #define _DL_HWCAP_COUNT 0
>  
> diff --git a/sysdeps/mips/dl-procinfo.h b/sysdeps/mips/dl-procinfo.h
> index 3199434390..7185542eac 100644
> --- a/sysdeps/mips/dl-procinfo.h
> +++ b/sysdeps/mips/dl-procinfo.h
> @@ -22,9 +22,6 @@
>  #include <ldsodefs.h>
>  
>  
> -/* Mask to filter out platforms.  */
> -#define _DL_HWCAP_PLATFORM    (-1ULL)
> -
>  #define _DL_PLATFORMS_COUNT   4
>  
>  /* We cannot provide a general printing function.  */
> diff --git a/sysdeps/powerpc/dl-procinfo.h b/sysdeps/powerpc/dl-procinfo.h
> index b36697ba44..5b628a27ca 100644
> --- a/sysdeps/powerpc/dl-procinfo.h
> +++ b/sysdeps/powerpc/dl-procinfo.h
> @@ -41,9 +41,6 @@
>  #define _DL_PLATFORMS_COUNT	17
>  
>  #define _DL_FIRST_PLATFORM	32
> -/* Mask to filter out platforms.  */
> -#define _DL_HWCAP_PLATFORM	(((1ULL << _DL_PLATFORMS_COUNT) - 1) \
> -				<< _DL_FIRST_PLATFORM)
>  
>  /* Platform bits (relative to _DL_FIRST_PLATFORM).  */
>  #define PPC_PLATFORM_POWER4		0
> diff --git a/sysdeps/s390/dl-procinfo.h b/sysdeps/s390/dl-procinfo.h
> index 63c9889f94..bb5f9c7863 100644
> --- a/sysdeps/s390/dl-procinfo.h
> +++ b/sysdeps/s390/dl-procinfo.h
> @@ -27,9 +27,6 @@ extern const char _dl_s390_cap_flags[_DL_HWCAP_COUNT][9] attribute_hidden;
>  
>  /* The kernel provides up to 32 capability bits with elf_hwcap.  */
>  #define _DL_FIRST_PLATFORM	32
> -/* Mask to filter out platforms.  */
> -#define _DL_HWCAP_PLATFORM	(((1ULL << _DL_PLATFORMS_COUNT) - 1) \
> -				 << _DL_FIRST_PLATFORM)
>  
>  /* Hardware capability bit numbers are derived directly from the
>     facility indications as stored by the "store facility list" (STFL)
> diff --git a/sysdeps/sparc/dl-procinfo.h b/sysdeps/sparc/dl-procinfo.h
> index dbb1a4d324..bd1cb65596 100644
> --- a/sysdeps/sparc/dl-procinfo.h
> +++ b/sysdeps/sparc/dl-procinfo.h
> @@ -57,7 +57,4 @@ _dl_hwcap_string (int idx)
>  #define HWCAP_IMPORTANT		(HWCAP_IMPORTANT_V9 | HWCAP_SPARC_ULTRA3 \
>  				 | HWCAP_SPARC_BLKINIT | HWCAP_SPARC_N2)
>  
> -/* There're no platforms to filter out.  */
> -#define _DL_HWCAP_PLATFORM 0
> -
>  #endif /* dl-procinfo.h */
> diff --git a/sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h b/sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h
> index 0ed89c5e41..17893a5225 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h
> +++ b/sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h
> @@ -37,7 +37,4 @@ _dl_hwcap_string (int idx)
>    return (unsigned)idx < _DL_HWCAP_COUNT ? GLRO(dl_aarch64_cap_flags)[idx] : "";
>  };
>  
> -/* There're no platforms to filter out.  */
> -#define _DL_HWCAP_PLATFORM 0
> -
>  #endif /* dl-procinfo.h */
> diff --git a/sysdeps/unix/sysv/linux/arm/dl-procinfo.h b/sysdeps/unix/sysv/linux/arm/dl-procinfo.h
> index 2a1c5985ee..85422b8edd 100644
> --- a/sysdeps/unix/sysv/linux/arm/dl-procinfo.h
> +++ b/sysdeps/unix/sysv/linux/arm/dl-procinfo.h
> @@ -30,9 +30,6 @@
>  /* Low 7 bits are allocated in HWCAP2.  */
>  #define _DL_HWCAP2_LAST		6
>  
> -/* The kernel provides platform data but it is not interesting.  */
> -#define _DL_HWCAP_PLATFORM	0
> -
>  
>  static inline const char *
>  __attribute__ ((unused))
> diff --git a/sysdeps/x86/dl-procinfo.h b/sysdeps/x86/dl-procinfo.h
> index b2184b8f5d..1aa6bad67a 100644
> --- a/sysdeps/x86/dl-procinfo.h
> +++ b/sysdeps/x86/dl-procinfo.h
> @@ -26,8 +26,5 @@
>  
>  /* Start at 48 to reserve spaces for hardware capabilities.  */
>  #define _DL_FIRST_PLATFORM	48
> -/* Mask to filter out platforms.  */
> -#define _DL_HWCAP_PLATFORM	(((1ULL << _DL_PLATFORMS_COUNT) - 1) \
> -				 << _DL_FIRST_PLATFORM)
>  
>  #endif /* dl-procinfo.h */

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [RFC 6/9] elf: Remove _DL_FIRST_PLATFORM
  2024-06-07 11:42 ` [RFC 6/9] elf: Remove _DL_FIRST_PLATFORM Stefan Liebler
@ 2024-06-11 19:29   ` Adhemerval Zanella Netto
  0 siblings, 0 replies; 30+ messages in thread
From: Adhemerval Zanella Netto @ 2024-06-11 19:29 UTC (permalink / raw)
  To: Stefan Liebler, libc-alpha; +Cc: fweimer, devel, bergner



On 07/06/24 08:42, Stefan Liebler wrote:
> Remove the definitions of _DL_FIRST_PLATFORM as those were only used
> in the _DL_HWCAP_PLATFORM definitions and in _dl_string_platform().
> Both were removed.
> 
> Note: Removed on every architecture despite of powerpc, where
> _dl_string_platform() is still used.

LGTM, thanks

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/s390/dl-procinfo.h | 3 ---
>  sysdeps/x86/dl-procinfo.h  | 3 ---
>  2 files changed, 6 deletions(-)
> 
> diff --git a/sysdeps/s390/dl-procinfo.h b/sysdeps/s390/dl-procinfo.h
> index bb5f9c7863..ef2a084ce7 100644
> --- a/sysdeps/s390/dl-procinfo.h
> +++ b/sysdeps/s390/dl-procinfo.h
> @@ -25,9 +25,6 @@ extern const char _dl_s390_cap_flags[_DL_HWCAP_COUNT][9] attribute_hidden;
>  
>  #define _DL_PLATFORMS_COUNT	11
>  
> -/* The kernel provides up to 32 capability bits with elf_hwcap.  */
> -#define _DL_FIRST_PLATFORM	32
> -
>  /* Hardware capability bit numbers are derived directly from the
>     facility indications as stored by the "store facility list" (STFL)
>     instruction.
> diff --git a/sysdeps/x86/dl-procinfo.h b/sysdeps/x86/dl-procinfo.h
> index 1aa6bad67a..a8d7d4ed32 100644
> --- a/sysdeps/x86/dl-procinfo.h
> +++ b/sysdeps/x86/dl-procinfo.h
> @@ -24,7 +24,4 @@
>  #define _DL_HWCAP_COUNT		HWCAP_COUNT
>  #define _DL_PLATFORMS_COUNT	HWCAP_PLATFORMS_COUNT
>  
> -/* Start at 48 to reserve spaces for hardware capabilities.  */
> -#define _DL_FIRST_PLATFORM	48
> -
>  #endif /* dl-procinfo.h */

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [RFC 7/9] elf: Remove _DL_PLATFORMS_COUNT
  2024-06-07 11:42 ` [RFC 7/9] elf: Remove _DL_PLATFORMS_COUNT Stefan Liebler
@ 2024-06-11 19:48   ` Adhemerval Zanella Netto
  0 siblings, 0 replies; 30+ messages in thread
From: Adhemerval Zanella Netto @ 2024-06-11 19:48 UTC (permalink / raw)
  To: Stefan Liebler, libc-alpha; +Cc: fweimer, devel, bergner



On 07/06/24 08:42, Stefan Liebler wrote:
> Remove the definitions of _DL_PLATFORMS_COUNT as those are not used
> anymore after removal in elf/dl-cache.c:search_cache().
> 
> Note: On x86, we can also get rid of the definitions
> HWCAP_PLATFORMS_START and HWCAP_PLATFORMS_COUNT.

LGTM, thanks.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/alpha/dl-procinfo.h     |  3 ---
>  sysdeps/csky/dl-procinfo.h      |  3 ---
>  sysdeps/mips/dl-procinfo.h      |  3 ---
>  sysdeps/powerpc/dl-procinfo.h   |  2 --
>  sysdeps/s390/dl-procinfo.h      |  2 --
>  sysdeps/x86/dl-hwcap.h          | 10 ++--------
>  sysdeps/x86/dl-procinfo.c       |  5 ++---
>  sysdeps/x86/dl-procinfo.h       |  1 -
>  sysdeps/x86_64/dl-procruntime.c |  5 ++---
>  9 files changed, 6 insertions(+), 28 deletions(-)
> 
> diff --git a/sysdeps/alpha/dl-procinfo.h b/sysdeps/alpha/dl-procinfo.h
> index 90f83ec24e..a5264f9f2c 100644
> --- a/sysdeps/alpha/dl-procinfo.h
> +++ b/sysdeps/alpha/dl-procinfo.h
> @@ -21,9 +21,6 @@
>  
>  #include <ldsodefs.h>
>  
> -
> -#define _DL_PLATFORMS_COUNT   5
> -
>  /* We cannot provide a general printing function.  */
>  #define _dl_procinfo(type, word) -1
>  
> diff --git a/sysdeps/csky/dl-procinfo.h b/sysdeps/csky/dl-procinfo.h
> index 803441f52c..3e7c63ee67 100644
> --- a/sysdeps/csky/dl-procinfo.h
> +++ b/sysdeps/csky/dl-procinfo.h
> @@ -22,9 +22,6 @@
>  
>  #include <ldsodefs.h>
>  
> -
> -#define _DL_PLATFORMS_COUNT   4
> -
>  /* We cannot provide a general printing function.  */
>  #define _dl_procinfo(word, val) -1
>  
> diff --git a/sysdeps/mips/dl-procinfo.h b/sysdeps/mips/dl-procinfo.h
> index 7185542eac..79c2acc388 100644
> --- a/sysdeps/mips/dl-procinfo.h
> +++ b/sysdeps/mips/dl-procinfo.h
> @@ -21,9 +21,6 @@
>  
>  #include <ldsodefs.h>
>  
> -
> -#define _DL_PLATFORMS_COUNT   4
> -
>  /* We cannot provide a general printing function.  */
>  #define _dl_procinfo(type, word) -1
>  
> diff --git a/sysdeps/powerpc/dl-procinfo.h b/sysdeps/powerpc/dl-procinfo.h
> index 5b628a27ca..81eb9fba87 100644
> --- a/sysdeps/powerpc/dl-procinfo.h
> +++ b/sysdeps/powerpc/dl-procinfo.h
> @@ -38,8 +38,6 @@
>  #define HWCAP_IMPORTANT		(PPC_FEATURE_HAS_ALTIVEC \
>  				+ PPC_FEATURE_HAS_DFP)
>  
> -#define _DL_PLATFORMS_COUNT	17
> -
>  #define _DL_FIRST_PLATFORM	32
>  
>  /* Platform bits (relative to _DL_FIRST_PLATFORM).  */
> diff --git a/sysdeps/s390/dl-procinfo.h b/sysdeps/s390/dl-procinfo.h
> index ef2a084ce7..7092ed1e2d 100644
> --- a/sysdeps/s390/dl-procinfo.h
> +++ b/sysdeps/s390/dl-procinfo.h
> @@ -23,8 +23,6 @@
>  #define _DL_HWCAP_COUNT 23
>  extern const char _dl_s390_cap_flags[_DL_HWCAP_COUNT][9] attribute_hidden;
>  
> -#define _DL_PLATFORMS_COUNT	11
> -
>  /* Hardware capability bit numbers are derived directly from the
>     facility indications as stored by the "store facility list" (STFL)
>     instruction.
> diff --git a/sysdeps/x86/dl-hwcap.h b/sysdeps/x86/dl-hwcap.h
> index e14e755bd7..246fdcd831 100644
> --- a/sysdeps/x86/dl-hwcap.h
> +++ b/sysdeps/x86/dl-hwcap.h
> @@ -20,20 +20,14 @@
>  
>  #if IS_IN (ldconfig)
>  /* Since ldconfig processes both i386 and x86-64 libraries, it needs
> -   to cover all platforms and hardware capabilities.  */
> -# define HWCAP_PLATFORMS_START	0
> -# define HWCAP_PLATFORMS_COUNT	4
> +   to cover all hardware capabilities.  */
>  # define HWCAP_IMPORTANT \
>    (HWCAP_X86_SSE2 | HWCAP_X86_64 | HWCAP_X86_AVX512_1)
>  #elif defined __x86_64__
> -/* For 64 bit, only cover x86-64 platforms and capabilities.  */
> -# define HWCAP_PLATFORMS_START	2
> -# define HWCAP_PLATFORMS_COUNT	4
> +/* For 64 bit, only cover x86-64 capabilities.  */
>  # define HWCAP_IMPORTANT	(HWCAP_X86_64 | HWCAP_X86_AVX512_1)
>  #else
>  /* For 32 bit, only cover i586, i686 and SSE2.  */
> -# define HWCAP_PLATFORMS_START	0
> -# define HWCAP_PLATFORMS_COUNT	2
>  # define HWCAP_IMPORTANT	(HWCAP_X86_SSE2)
>  #endif
>  
> diff --git a/sysdeps/x86/dl-procinfo.c b/sysdeps/x86/dl-procinfo.c
> index 165ffd89a9..b791fd3e92 100644
> --- a/sysdeps/x86/dl-procinfo.c
> +++ b/sysdeps/x86/dl-procinfo.c
> @@ -16,9 +16,8 @@
>     License along with the GNU C Library; if not, see
>     <https://www.gnu.org/licenses/>.  */
>  
> -/* This information must be kept in sync with the _DL_HWCAP_COUNT,
> -   HWCAP_PLATFORMS_START and HWCAP_PLATFORMS_COUNT definitions in
> -   dl-hwcap.h.
> +/* This information must be kept in sync with the _DL_HWCAP_COUNT
> +   definition in dl-hwcap.h.
>  
>     If anything should be added here check whether the size of each string
>     is still ok with the given array size.
> diff --git a/sysdeps/x86/dl-procinfo.h b/sysdeps/x86/dl-procinfo.h
> index a8d7d4ed32..ea0f33bbad 100644
> --- a/sysdeps/x86/dl-procinfo.h
> +++ b/sysdeps/x86/dl-procinfo.h
> @@ -22,6 +22,5 @@
>  #include <dl-hwcap.h>
>  
>  #define _DL_HWCAP_COUNT		HWCAP_COUNT
> -#define _DL_PLATFORMS_COUNT	HWCAP_PLATFORMS_COUNT
>  
>  #endif /* dl-procinfo.h */
> diff --git a/sysdeps/x86_64/dl-procruntime.c b/sysdeps/x86_64/dl-procruntime.c
> index 7078581778..0859438ed0 100644
> --- a/sysdeps/x86_64/dl-procruntime.c
> +++ b/sysdeps/x86_64/dl-procruntime.c
> @@ -16,9 +16,8 @@
>     License along with the GNU C Library; if not, see
>     <https://www.gnu.org/licenses/>.  */
>  
> -/* This information must be kept in sync with the _DL_HWCAP_COUNT,
> -   HWCAP_PLATFORMS_START and HWCAP_PLATFORMS_COUNT definitions in
> -   dl-hwcap.h.
> +/* This information must be kept in sync with the _DL_HWCAP_COUNT
> +   definition in dl-hwcap.h.
>  
>     If anything should be added here check whether the size of each string
>     is still ok with the given array size.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [RFC 8/9] elf: Remove LD_HWCAP_MASK / tunable glibc.cpu.hwcap_mask
  2024-06-07 11:42 ` [RFC 8/9] elf: Remove LD_HWCAP_MASK / tunable glibc.cpu.hwcap_mask Stefan Liebler
@ 2024-06-11 20:04   ` Adhemerval Zanella Netto
  0 siblings, 0 replies; 30+ messages in thread
From: Adhemerval Zanella Netto @ 2024-06-11 20:04 UTC (permalink / raw)
  To: Stefan Liebler, libc-alpha; +Cc: fweimer, devel, bergner



On 07/06/24 08:42, Stefan Liebler wrote:
> Remove the environment variable LD_HWCAP_MASK and the tunable
> glibc.cpu.hwcap_mask as those are not used anymore in common-code
> after removal in elf/dl-cache.c:search_cache().
> 
> The only remaining user is sparc32 where it is used in
> elf_machine_matches_host().  If sparc32 does not need it anymore,
> we can get rid of it at all.  Otherwise we could also move
> LD_HWCAP_MASK / tunable glibc.cpu.hwcap_mask to be sparc32 specific.

I don't think sparc32 would miss this. 

LGTM, thanks.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> ---
>  elf/dl-tunables.list               |  7 -------
>  elf/tst-env-setuid.c               |  1 -
>  manual/README.tunables             | 12 ++++++------
>  manual/tunables.texi               | 11 -----------
>  sysdeps/generic/unsecvars.h        |  1 -
>  sysdeps/sparc/sparc32/dl-machine.h |  6 ------
>  6 files changed, 6 insertions(+), 32 deletions(-)
> 
> diff --git a/elf/dl-tunables.list b/elf/dl-tunables.list
> index 1186272c81..40ac5b3776 100644
> --- a/elf/dl-tunables.list
> +++ b/elf/dl-tunables.list
> @@ -83,13 +83,6 @@ glibc {
>        minval: 0
>      }
>    }
> -  cpu {
> -    hwcap_mask {
> -      type: UINT_64
> -      env_alias: LD_HWCAP_MASK
> -      default: HWCAP_IMPORTANT
> -    }
> -  }
>  
>    elision {
>      enable {
> diff --git a/elf/tst-env-setuid.c b/elf/tst-env-setuid.c
> index 43047c48f3..59f2ffeb88 100644
> --- a/elf/tst-env-setuid.c
> +++ b/elf/tst-env-setuid.c
> @@ -52,7 +52,6 @@ static const struct envvar_t filtered_envvars[] =
>  {
>    { "GLIBC_TUNABLES",          FILTERED_VALUE },
>    { "LD_AUDIT",                FILTERED_VALUE },
> -  { "LD_HWCAP_MASK",           FILTERED_VALUE },
>    { "LD_LIBRARY_PATH",         FILTERED_VALUE },
>    { "LD_PRELOAD",              FILTERED_VALUE },
>    { "LD_PROFILE",              PROFILE_LIB },
> diff --git a/manual/README.tunables b/manual/README.tunables
> index 72ae00dc02..594879397b 100644
> --- a/manual/README.tunables
> +++ b/manual/README.tunables
> @@ -96,11 +96,11 @@ where 'check' is the tunable name and 'val' is a value of same type.
>  To get and set tunables in a different namespace from that module, use the full
>  form of the macros as follows:
>  
> -  val = TUNABLE_GET_FULL (glibc, cpu, hwcap_mask, uint64_t, NULL)
> +  val = TUNABLE_GET_FULL (glibc, malloc, mmap_max, int32_t, NULL)
>  
> -  TUNABLE_SET_FULL (glibc, cpu, hwcap_mask, val)
> +  TUNABLE_SET_FULL (glibc, malloc, mmap_max, val)
>  
> -where 'glibc' is the top namespace, 'cpu' is the tunable namespace and the
> +where 'glibc' is the top namespace, 'malloc' is the tunable namespace and the
>  remaining arguments are the same as the short form macros.
>  
>  The minimum and maximum values can updated together with the tunable value
> @@ -114,11 +114,11 @@ where 'check' is the tunable name, 'val' is a value of same type, 'min' and
>  To set the minimum and maximum values of tunables in a different namespace
>  from that module, use the full form of the macros as follows:
>  
> -  val = TUNABLE_GET_FULL (glibc, cpu, hwcap_mask, uint64_t, NULL)
> +  val = TUNABLE_GET_FULL (glibc, malloc, mmap_max, int32_t, NULL)
>  
> -  TUNABLE_SET_WITH_BOUNDS_FULL (glibc, cpu, hwcap_mask, val, min, max)
> +  TUNABLE_SET_WITH_BOUNDS_FULL (glibc, malloc, mmap_max, val, min, max)
>  
> -where 'glibc' is the top namespace, 'cpu' is the tunable namespace and the
> +where 'glibc' is the top namespace, 'malloc' is the tunable namespace and the
>  remaining arguments are the same as the short form macros.
>  
>  When TUNABLE_NAMESPACE is not defined in a module, TUNABLE_GET is equivalent to
> diff --git a/manual/tunables.texi b/manual/tunables.texi
> index 8dd02d8149..0b1b2898c0 100644
> --- a/manual/tunables.texi
> +++ b/manual/tunables.texi
> @@ -55,7 +55,6 @@ glibc.cpu.x86_non_temporal_threshold: 0xc0000 (min: 0x4040, max: 0xfffffffffffff
>  glibc.cpu.x86_memset_non_temporal_threshold: 0xc0000 (min: 0x4040, max: 0xfffffffffffffff)
>  glibc.cpu.x86_shstk:
>  glibc.pthread.stack_cache_size: 0x2800000 (min: 0x0, max: 0xffffffffffffffff)
> -glibc.cpu.hwcap_mask: 0x6 (min: 0x0, max: 0xffffffffffffffff)
>  glibc.malloc.mmap_max: 0 (min: 0, max: 2147483647)
>  glibc.elision.skip_trylock_internal_abort: 3 (min: 0, max: 2147483647)
>  glibc.cpu.plt_rewrite: 0 (min: 0, max: 2)
> @@ -504,16 +503,6 @@ Behavior of @theglibc{} can be tuned to assume specific hardware capabilities
>  by setting the following tunables in the @code{cpu} namespace:
>  @end deftp
>  
> -@deftp Tunable glibc.cpu.hwcap_mask
> -This tunable supersedes the @env{LD_HWCAP_MASK} environment variable and is
> -identical in features.
> -
> -The @code{AT_HWCAP} key in the Auxiliary Vector specifies instruction set
> -extensions available in the processor at runtime for some architectures.  The
> -@code{glibc.cpu.hwcap_mask} tunable allows the user to mask out those
> -capabilities at runtime, thus disabling use of those extensions.
> -@end deftp
> -
>  @deftp Tunable glibc.cpu.hwcaps
>  The @code{glibc.cpu.hwcaps=-xxx,yyy,-zzz...} tunable allows the user to
>  enable CPU/ARCH feature @code{yyy}, disable CPU/ARCH feature @code{xxx}
> diff --git a/sysdeps/generic/unsecvars.h b/sysdeps/generic/unsecvars.h
> index f1724efe0f..97857a11aa 100644
> --- a/sysdeps/generic/unsecvars.h
> +++ b/sysdeps/generic/unsecvars.h
> @@ -12,7 +12,6 @@
>    "LD_DEBUG\0"								      \
>    "LD_DEBUG_OUTPUT\0"							      \
>    "LD_DYNAMIC_WEAK\0"							      \
> -  "LD_HWCAP_MASK\0"							      \
>    "LD_LIBRARY_PATH\0"							      \
>    "LD_ORIGIN_PATH\0"							      \
>    "LD_PRELOAD\0"							      \
> diff --git a/sysdeps/sparc/sparc32/dl-machine.h b/sysdeps/sparc/sparc32/dl-machine.h
> index d855c66fe3..2c56d8a80e 100644
> --- a/sysdeps/sparc/sparc32/dl-machine.h
> +++ b/sysdeps/sparc/sparc32/dl-machine.h
> @@ -39,13 +39,7 @@ elf_machine_matches_host (const Elf32_Ehdr *ehdr)
>      return 1;
>    else if (ehdr->e_machine == EM_SPARC32PLUS)
>      {
> -#if defined SHARED
> -      uint64_t hwcap_mask = TUNABLE_GET (glibc, cpu, hwcap_mask, uint64_t,
> -					 NULL);
> -      return GLRO(dl_hwcap) & hwcap_mask & HWCAP_SPARC_V9;
> -#else
>        return GLRO(dl_hwcap) & HWCAP_SPARC_V9;
> -#endif
>      }
>    else
>      return 0;

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [RFC 9/9] elf: Remove HWCAP_IMPORTANT
  2024-06-07 11:42 ` [RFC 9/9] elf: Remove HWCAP_IMPORTANT Stefan Liebler
@ 2024-06-11 20:07   ` Adhemerval Zanella Netto
  0 siblings, 0 replies; 30+ messages in thread
From: Adhemerval Zanella Netto @ 2024-06-11 20:07 UTC (permalink / raw)
  To: Stefan Liebler, libc-alpha; +Cc: fweimer, devel, bergner



On 07/06/24 08:42, Stefan Liebler wrote:
> Remove the definitions of HWCAP_IMPORTANT after removal of
> LD_HWCAP_MASK / tunable glibc.cpu.hwcap_mask.  There HWCAP_IMPORTANT
> was used as default value.

LGTM, thanks.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> ---
>  elf/dl-diagnostics.c                          |  1 -
>  sysdeps/alpha/dl-procinfo.h                   |  3 ---
>  sysdeps/csky/dl-procinfo.h                    |  3 ---
>  sysdeps/generic/dl-procinfo.h                 |  3 ---
>  sysdeps/mips/dl-procinfo.h                    |  3 ---
>  sysdeps/powerpc/dl-procinfo.h                 |  3 ---
>  sysdeps/s390/dl-procinfo.h                    |  5 -----
>  sysdeps/sparc/dl-procinfo.h                   |  5 -----
>  sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h |  3 ---
>  sysdeps/unix/sysv/linux/arm/dl-procinfo.h     |  2 --
>  sysdeps/x86/dl-hwcap.h                        | 13 -------------
>  11 files changed, 44 deletions(-)
> 
> diff --git a/elf/dl-diagnostics.c b/elf/dl-diagnostics.c
> index e69463b2bd..c83e7770d8 100644
> --- a/elf/dl-diagnostics.c
> +++ b/elf/dl-diagnostics.c
> @@ -233,7 +233,6 @@ _dl_print_diagnostics (char **environ)
>  {
>    _dl_diagnostics_print_labeled_string ("dl_dst_lib", DL_DST_LIB);
>    _dl_diagnostics_print_labeled_value ("dl_hwcap", GLRO (dl_hwcap));
> -  _dl_diagnostics_print_labeled_value ("dl_hwcap_important", HWCAP_IMPORTANT);
>    _dl_diagnostics_print_labeled_value ("dl_hwcap2", GLRO (dl_hwcap2));
>    _dl_diagnostics_print_labeled_value ("dl_hwcap3", GLRO (dl_hwcap3));
>    _dl_diagnostics_print_labeled_value ("dl_hwcap4", GLRO (dl_hwcap4));
> diff --git a/sysdeps/alpha/dl-procinfo.h b/sysdeps/alpha/dl-procinfo.h
> index a5264f9f2c..8d17d42ce2 100644
> --- a/sysdeps/alpha/dl-procinfo.h
> +++ b/sysdeps/alpha/dl-procinfo.h
> @@ -27,9 +27,6 @@
>  /* There are no hardware capabilities defined.  */
>  #define _dl_hwcap_string(idx) ""
>  
> -/* By default there is no important hardware capability.  */
> -#define HWCAP_IMPORTANT (0)
> -
>  /* We don't have any hardware capabilities.  */
>  #define _DL_HWCAP_COUNT	0
>  
> diff --git a/sysdeps/csky/dl-procinfo.h b/sysdeps/csky/dl-procinfo.h
> index 3e7c63ee67..f5f6343cf6 100644
> --- a/sysdeps/csky/dl-procinfo.h
> +++ b/sysdeps/csky/dl-procinfo.h
> @@ -28,9 +28,6 @@
>  /* There are no hardware capabilities defined.  */
>  #define _dl_hwcap_string(idx) ""
>  
> -/* By default there is no important hardware capability.  */
> -#define HWCAP_IMPORTANT (0)
> -
>  /* We don't have any hardware capabilities.  */
>  #define _DL_HWCAP_COUNT	0
>  
> diff --git a/sysdeps/generic/dl-procinfo.h b/sysdeps/generic/dl-procinfo.h
> index 1778fd1057..93edfc00cb 100644
> --- a/sysdeps/generic/dl-procinfo.h
> +++ b/sysdeps/generic/dl-procinfo.h
> @@ -25,9 +25,6 @@
>  /* There are no hardware capabilities defined.  */
>  #define _dl_hwcap_string(idx) ""
>  
> -/* By default there is no important hardware capability.  */
> -#define HWCAP_IMPORTANT (0)
> -
>  /* We don't have any hardware capabilities.  */
>  #define _DL_HWCAP_COUNT 0
>  
> diff --git a/sysdeps/mips/dl-procinfo.h b/sysdeps/mips/dl-procinfo.h
> index 79c2acc388..af2616e1db 100644
> --- a/sysdeps/mips/dl-procinfo.h
> +++ b/sysdeps/mips/dl-procinfo.h
> @@ -27,9 +27,6 @@
>  /* There are no hardware capabilities defined.  */
>  #define _dl_hwcap_string(idx) ""
>  
> -/* By default there is no important hardware capability.  */
> -#define HWCAP_IMPORTANT (0)
> -
>  /* We don't have any hardware capabilities.  */
>  #define _DL_HWCAP_COUNT	0
>  
> diff --git a/sysdeps/powerpc/dl-procinfo.h b/sysdeps/powerpc/dl-procinfo.h
> index 81eb9fba87..1e746a7ab4 100644
> --- a/sysdeps/powerpc/dl-procinfo.h
> +++ b/sysdeps/powerpc/dl-procinfo.h
> @@ -34,9 +34,6 @@
>  /* AT_HWCAP4 feature strings follow the AT_HWCAP3 feature strings.  */
>  #define _DL_HWCAP4_OFFSET	(_DL_HWCAP3_OFFSET + _DL_HWCAP_SIZE)
>  
> -/* These bits influence library search.  */
> -#define HWCAP_IMPORTANT		(PPC_FEATURE_HAS_ALTIVEC \
> -				+ PPC_FEATURE_HAS_DFP)
>  
>  #define _DL_FIRST_PLATFORM	32
>  
> diff --git a/sysdeps/s390/dl-procinfo.h b/sysdeps/s390/dl-procinfo.h
> index 7092ed1e2d..45dd11c189 100644
> --- a/sysdeps/s390/dl-procinfo.h
> +++ b/sysdeps/s390/dl-procinfo.h
> @@ -59,11 +59,6 @@ enum
>    HWCAP_S390_SIE = 1 << 22,
>  };
>  
> -#define HWCAP_IMPORTANT (HWCAP_S390_ZARCH | HWCAP_S390_LDISP \
> -			 | HWCAP_S390_EIMM | HWCAP_S390_DFP  \
> -			 | HWCAP_S390_VX | HWCAP_S390_VXE    \
> -			 | HWCAP_S390_VXRS_EXT2)
> -
>  /* We cannot provide a general printing function.  */
>  #define _dl_procinfo(type, word) -1
>  
> diff --git a/sysdeps/sparc/dl-procinfo.h b/sysdeps/sparc/dl-procinfo.h
> index bd1cb65596..709178706c 100644
> --- a/sysdeps/sparc/dl-procinfo.h
> +++ b/sysdeps/sparc/dl-procinfo.h
> @@ -52,9 +52,4 @@ _dl_hwcap_string (int idx)
>    return GLRO(dl_sparc_cap_flags)[idx];
>  };
>  
> -#include <bits/wordsize.h>
> -#define HWCAP_IMPORTANT_V9	(__WORDSIZE == 64 ? 0 : HWCAP_SPARC_V9)
> -#define HWCAP_IMPORTANT		(HWCAP_IMPORTANT_V9 | HWCAP_SPARC_ULTRA3 \
> -				 | HWCAP_SPARC_BLKINIT | HWCAP_SPARC_N2)
> -
>  #endif /* dl-procinfo.h */
> diff --git a/sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h b/sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h
> index 17893a5225..b85d4ad8a3 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h
> +++ b/sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h
> @@ -27,9 +27,6 @@
>  /* We cannot provide a general printing function.  */
>  #define _dl_procinfo(type, word) -1
>  
> -/* No additional library search paths.  */
> -#define HWCAP_IMPORTANT HWCAP_ATOMICS
> -
>  static inline const char *
>  __attribute__ ((unused))
>  _dl_hwcap_string (int idx)
> diff --git a/sysdeps/unix/sysv/linux/arm/dl-procinfo.h b/sysdeps/unix/sysv/linux/arm/dl-procinfo.h
> index 85422b8edd..7d26216718 100644
> --- a/sysdeps/unix/sysv/linux/arm/dl-procinfo.h
> +++ b/sysdeps/unix/sysv/linux/arm/dl-procinfo.h
> @@ -70,6 +70,4 @@ _dl_procinfo (unsigned int type, unsigned long int word)
>    return 0;
>  }
>  
> -#define HWCAP_IMPORTANT		(HWCAP_ARM_VFP | HWCAP_ARM_NEON)
> -
>  #endif /* dl-procinfo.h */
> diff --git a/sysdeps/x86/dl-hwcap.h b/sysdeps/x86/dl-hwcap.h
> index 246fdcd831..325f1c467c 100644
> --- a/sysdeps/x86/dl-hwcap.h
> +++ b/sysdeps/x86/dl-hwcap.h
> @@ -18,19 +18,6 @@
>  #ifndef _DL_HWCAP_H
>  #define _DL_HWCAP_H
>  
> -#if IS_IN (ldconfig)
> -/* Since ldconfig processes both i386 and x86-64 libraries, it needs
> -   to cover all hardware capabilities.  */
> -# define HWCAP_IMPORTANT \
> -  (HWCAP_X86_SSE2 | HWCAP_X86_64 | HWCAP_X86_AVX512_1)
> -#elif defined __x86_64__
> -/* For 64 bit, only cover x86-64 capabilities.  */
> -# define HWCAP_IMPORTANT	(HWCAP_X86_64 | HWCAP_X86_AVX512_1)
> -#else
> -/* For 32 bit, only cover i586, i686 and SSE2.  */
> -# define HWCAP_IMPORTANT	(HWCAP_X86_SSE2)
> -#endif
> -
>  enum
>  {
>    HWCAP_X86_SSE2		= 1 << 0,

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [V2] elf: Remove platform strings in dl-procinfo.c
  2024-06-11 19:20   ` Adhemerval Zanella Netto
@ 2024-06-12  7:32     ` Stefan Liebler
  2024-06-14 12:58       ` Adhemerval Zanella Netto
  0 siblings, 1 reply; 30+ messages in thread
From: Stefan Liebler @ 2024-06-12  7:32 UTC (permalink / raw)
  To: libc-alpha; +Cc: fweimer, devel, adhemerval.zanella, bergner, Stefan Liebler

Remove the platform strings in dl-procinfo.c where also
the implementation of _dl_string_platform() was removed.
---
 sysdeps/alpha/dl-procinfo.c     | 62 ---------------------------------
 sysdeps/csky/dl-procinfo.c      | 62 ---------------------------------
 sysdeps/mips/dl-procinfo.c      | 49 ++++----------------------
 sysdeps/s390/dl-procinfo-s390.c |  6 ----
 sysdeps/s390/dl-procinfo.h      |  1 -
 sysdeps/x86/dl-procinfo.c       | 16 ---------
 6 files changed, 7 insertions(+), 189 deletions(-)
 delete mode 100644 sysdeps/alpha/dl-procinfo.c
 delete mode 100644 sysdeps/csky/dl-procinfo.c

diff --git a/sysdeps/alpha/dl-procinfo.c b/sysdeps/alpha/dl-procinfo.c
deleted file mode 100644
index 633dcbf974..0000000000
--- a/sysdeps/alpha/dl-procinfo.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Data for Alpha version of processor capability information.
-   Copyright (C) 2008-2024 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library.  If not, see
-   <https://www.gnu.org/licenses/>.  */
-
-/* This information must be kept in sync with the _DL_PLATFORM_COUNT
-   definitions in procinfo.h.
-
-   If anything should be added here check whether the size of each string
-   is still ok with the given array size.
-
-   All the #ifdefs in the definitions are quite irritating but
-   necessary if we want to avoid duplicating the information.  There
-   are three different modes:
-
-   - PROCINFO_DECL is defined.  This means we are only interested in
-     declarations.
-
-   - PROCINFO_DECL is not defined:
-
-     + if SHARED is defined the file is included in an array
-       initializer.  The .element = { ... } syntax is needed.
-
-     + if SHARED is not defined a normal array initialization is
-       needed.
-  */
-
-#ifndef PROCINFO_CLASS
-#define PROCINFO_CLASS
-#endif
-
-#if !defined PROCINFO_DECL && defined SHARED
-  ._dl_alpha_platforms
-#else
-PROCINFO_CLASS const char _dl_alpha_platforms[5][5]
-#endif
-#ifndef PROCINFO_DECL
-= {
-    "ev4", "ev5", "ev56", "ev6", "ev67"
-  }
-#endif
-#if !defined SHARED || defined PROCINFO_DECL
-;
-#else
-,
-#endif
-
-#undef PROCINFO_DECL
-#undef PROCINFO_CLASS
diff --git a/sysdeps/csky/dl-procinfo.c b/sysdeps/csky/dl-procinfo.c
deleted file mode 100644
index 0c81518cff..0000000000
--- a/sysdeps/csky/dl-procinfo.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Data for C-SKY version of processor capability information.
-   Copyright (C) 2018-2024 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library.  If not, see
-   <https://www.gnu.org/licenses/>.  */
-
-/* This information must be kept in sync with the _DL_PLATFORM_COUNT
-   definitions in procinfo.h.
-
-   If anything should be added here check whether the size of each string
-   is still ok with the given array size.
-
-   All the #ifdefs in the definitions are quite irritating but
-   necessary if we want to avoid duplicating the information.  There
-   are three different modes:
-
-   - PROCINFO_DECL is defined.  This means we are only interested in
-     declarations.
-
-   - PROCINFO_DECL is not defined:
-
-     + if SHARED is defined the file is included in an array
-       initializer.  The .element = { ... } syntax is needed.
-
-     + if SHARED is not defined a normal array initialization is
-       needed.
-  */
-
-#ifndef PROCINFO_CLASS
-# define PROCINFO_CLASS
-#endif
-
-#if !defined PROCINFO_DECL && defined SHARED
-  ._dl_csky_platforms
-#else
-PROCINFO_CLASS const char _dl_csky_platforms[4][6]
-#endif
-#ifndef PROCINFO_DECL
-= {
-    "ck610", "ck807", "ck810", "ck860"
-  }
-#endif
-#if !defined SHARED || defined PROCINFO_DECL
-;
-#else
-,
-#endif
-
-#undef PROCINFO_DECL
-#undef PROCINFO_CLASS
diff --git a/sysdeps/mips/dl-procinfo.c b/sysdeps/mips/dl-procinfo.c
index 0b1dfeea2d..6a1aaefef2 100644
--- a/sysdeps/mips/dl-procinfo.c
+++ b/sysdeps/mips/dl-procinfo.c
@@ -16,47 +16,12 @@
    License along with the GNU C Library.  If not, see
    <https://www.gnu.org/licenses/>.  */
 
-/* This information must be kept in sync with the _DL_PLATFORM_COUNT
-   definitions in procinfo.h.
-
-   If anything should be added here check whether the size of each string
-   is still ok with the given array size.
-
-   All the #ifdefs in the definitions are quite irritating but
-   necessary if we want to avoid duplicating the information.  There
-   are three different modes:
-
-   - PROCINFO_DECL is defined.  This means we are only interested in
-     declarations.
-
-   - PROCINFO_DECL is not defined:
-
-     + if SHARED is defined the file is included in an array
-       initializer.  The .element = { ... } syntax is needed.
-
-     + if SHARED is not defined a normal array initialization is
-       needed.
-  */
-
-#ifndef PROCINFO_CLASS
-#define PROCINFO_CLASS
-#endif
-
-#if !defined PROCINFO_DECL && defined SHARED
-  ._dl_mips_platforms
-#else
-PROCINFO_CLASS const char _dl_mips_platforms[4][11]
-#endif
-#ifndef PROCINFO_DECL
-= {
-    "loongson2e", "loongson2f", "octeon", "octeon2"
-  }
-#endif
-#if !defined SHARED || defined PROCINFO_DECL
-;
-#else
-,
-#endif
-
+/* Note:
+   When compiling elf/ldconfig.c, PROCINFO_CLASS is defined to static.
+   This dl-procinfo.c is included in sysdeps/generic/ldsodefs.h.
+   Afterwards, if not yet defined, PROCINFO_CLASS is defined to EXTERN
+   just before dl-vdso-setup.c is included.  A "static" _dl_vdso_xyz
+   function prototype would lead to gcc warnings/errors: defined but
+   not used.  */
 #undef PROCINFO_DECL
 #undef PROCINFO_CLASS
diff --git a/sysdeps/s390/dl-procinfo-s390.c b/sysdeps/s390/dl-procinfo-s390.c
index 2821e40cb1..652f6067a3 100644
--- a/sysdeps/s390/dl-procinfo-s390.c
+++ b/sysdeps/s390/dl-procinfo-s390.c
@@ -24,9 +24,3 @@ const char _dl_s390_cap_flags[_DL_HWCAP_COUNT][9] =
     "highgprs", "te", "vx", "vxd", "vxe", "gs", "vxe2", "vxp", "sort", "dflt",
     "vxp2", "nnpa", "pcimio", "sie"
   };
-
-const char _dl_s390_platforms[_DL_PLATFORMS_COUNT][7] =
-  {
-    "g5", "z900", "z990", "z9-109", "z10", "z196", "zEC12", "z13", "z14", "z15",
-    "z16"
-  };
diff --git a/sysdeps/s390/dl-procinfo.h b/sysdeps/s390/dl-procinfo.h
index ffeb655ad0..63c9889f94 100644
--- a/sysdeps/s390/dl-procinfo.h
+++ b/sysdeps/s390/dl-procinfo.h
@@ -24,7 +24,6 @@
 extern const char _dl_s390_cap_flags[_DL_HWCAP_COUNT][9] attribute_hidden;
 
 #define _DL_PLATFORMS_COUNT	11
-extern const char _dl_s390_platforms[_DL_PLATFORMS_COUNT][7] attribute_hidden;
 
 /* The kernel provides up to 32 capability bits with elf_hwcap.  */
 #define _DL_FIRST_PLATFORM	32
diff --git a/sysdeps/x86/dl-procinfo.c b/sysdeps/x86/dl-procinfo.c
index 5920d4b320..165ffd89a9 100644
--- a/sysdeps/x86/dl-procinfo.c
+++ b/sysdeps/x86/dl-procinfo.c
@@ -71,22 +71,6 @@ PROCINFO_CLASS const char _dl_x86_hwcap_flags[3][9]
 ,
 #endif
 
-#if !defined PROCINFO_DECL && defined SHARED
-  ._dl_x86_platforms
-#else
-PROCINFO_CLASS const char _dl_x86_platforms[4][9]
-#endif
-#ifndef PROCINFO_DECL
-= {
-    "i586", "i686", "haswell", "xeon_phi"
-  }
-#endif
-#if !defined SHARED || defined PROCINFO_DECL
-;
-#else
-,
-#endif
-
 #if defined SHARED && !IS_IN (ldconfig)
 # if !defined PROCINFO_DECL
   ._dl_x86_tlsdesc_dynamic
-- 
2.45.1


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [RFC 0/9] Remove legacy platform bits and cleanups
  2024-06-11 12:13     ` Stefan Liebler
@ 2024-06-12  7:50       ` Stefan Liebler
  2024-06-18  8:55         ` Stefan Liebler
  0 siblings, 1 reply; 30+ messages in thread
From: Stefan Liebler @ 2024-06-12  7:50 UTC (permalink / raw)
  To: libc-alpha; +Cc: Florian Weimer, Javier Pello, Adhemerval Zanella, bergner

On 11.06.24 14:13, Stefan Liebler wrote:
> On 10.06.24 15:36, Stefan Liebler wrote:
>> On 08.06.24 13:09, Florian Weimer wrote:
>>> * Stefan Liebler:
>>>
>>>> This patch series is the result of:
>>>> "Question regarding platform-bits in ld.so.cache"
>>>> https://sourceware.org/pipermail/libc-alpha/2024-May/156793.html
>>>
>>> This series fails to build on MIPS with:
>>>
>>> mips64-glibc-linux-gnu-gcc -mabi=32 ldconfig.c -c -std=gnu11 -fgnu89-inline  -g -O2 -Wall -Wwrite-strings -Wundef -Werror -fmerge-all-constants -frounding-math -fno-stack-protector -fno-common -Wp,-U_FORTIFY_SOURCE -Wstrict-prototypes -Wold-style-definition -fmath-errno -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64   -fPIE    -Wa,-execstack -D'SYSCONFDIR="/etc"' -D'LIBDIR="/usr/lib"' -D'SLIBDIR="/lib"'       -I../include -I/home/bmg/build/glibcs/mips-linux-gnu/glibc/elf  -I/home/bmg/build/glibcs/mips-linux-gnu/glibc  -I../sysdeps/unix/sysv/linux/mips/mips32/fpu  -I../sysdeps/unix/sysv/linux/mips/mips32  -I../sysdeps/unix/sysv/linux/mips  -I../sysdeps/mips/nptl  -I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux  -I../sysdeps/nptl  -I../sysdeps/pthread  -I../sysdeps/gnu  -I../sysdeps/unix/inet  -I../sysdeps/unix/sysv  -I../sysdeps/unix/mips/mips32  -I../sysdeps/unix/mips  -I../sysdeps/unix  -I../sysdeps/posix  -I../sysdeps/mips/mips32/fpu  -I../sysdeps/mips/mips32  -I../sysdeps/mips/ieee754  -I../sysdeps/mips/include -I../sysdeps/mips  -I../sysdeps/ieee754/flt-32  -I../sysdeps/ieee754/dbl-64  -I../sysdeps/wordsize-32  -I../sysdeps/mips/fpu  -I../sysdeps/ieee754  -I../sysdeps/generic  -I.. -I../libio -I.   -D_LIBC_REENTRANT -include /home/bmg/build/glibcs/mips-linux-gnu/glibc/libc-modules.h -DMODULE_NAME=ldconfig -include ../include/libc-symbols.h  -DPIC     -DTOP_NAMESPACE=glibc -o /home/bmg/build/glibcs/mips-linux-gnu/glibc/elf/ldconfig.o -MD -MP -MF /home/bmg/build/glibcs/mips-linux-gnu/glibc/elf/ldconfig.o.dt -MT /home/bmg/build/glibcs/mips-linux-gnu/glibc/elf/ldconfig.o
>>> In file included from ../sysdeps/generic/ldsodefs.h:643,
>>>                  from ../sysdeps/mips/ldsodefs.h:82,
>>>                  from ../sysdeps/gnu/ldsodefs.h:46,
>>>                  from ../sysdeps/unix/sysv/linux/ldsodefs.h:25,
>>>                  from ../sysdeps/unix/sysv/linux/mips/ldsodefs.h:22,
>>>                  from ../sysdeps/mips/dl-procinfo.h:22,
>>>                  from /home/bmg/build/glibcs/mips-linux-gnu/glibc/dl-tunable-list.h:6,
>>>                  from ../elf/dl-tunables.h:48,
>>>                  from ./dl-hwcaps.h:25,
>>>                  from ldconfig.c:44:
>>> ../sysdeps/unix/sysv/linux/dl-vdso-setup.c:62:22: error: ‘_dl_vdso_clock_getres’ defined but not used [-Werror=unused-variable]
>>>    62 | PROCINFO_CLASS int (*_dl_vdso_clock_getres) (clockid_t,
>>>       |                      ^~~~~~~~~~~~~~~~~~~~~
>>> ../sysdeps/unix/sysv/linux/dl-vdso-setup.c:53:22: error: ‘_dl_vdso_gettimeofday’ defined but not used [-Werror=unused-variable]
>>>    53 | PROCINFO_CLASS int (*_dl_vdso_gettimeofday) (struct timeval *, void *) RELRO;
>>>       |                      ^~~~~~~~~~~~~~~~~~~~~
>>> ../sysdeps/unix/sysv/linux/dl-vdso-setup.c:49:22: error: ‘_dl_vdso_clock_gettime64’ defined but not used [-Werror=unused-variable]
>>>    49 | PROCINFO_CLASS int (*_dl_vdso_clock_gettime64) (clockid_t,
>>>       |                      ^~~~~~~~~~~~~~~~~~~~~~~~
>>> ../sysdeps/unix/sysv/linux/dl-vdso-setup.c:45:22: error: ‘_dl_vdso_clock_gettime’ defined but not used [-Werror=unused-variable]
>>>    45 | PROCINFO_CLASS int (*_dl_vdso_clock_gettime) (clockid_t,
>>>       |                      ^~~~~~~~~~~~~~~~~~~~~~
>>> cc1: all warnings being treated as errors
>>> make[3]: *** [../o-iterator.mk:9: /home/bmg/build/glibcs/mips-linux-gnu/glibc/elf/ldconfig.o] Error 1
>>> make[3]: Leaving directory '/home/bmg/src/glibc/elf'
>>> make[3]: *** Waiting for unfinished jobs....
>>> make[2]: *** [Makefile:484: elf/others] Error 2
>>> make[1]: *** [Makefile:9: all] Error 2
>>>
>>> Florian
>>>
>> Hi Florian,
>>
>> thanks for the info. I've take a look. Seems to be related to the
>> removed sysdeps/mips/dl-procinfo.c with those undefs at the end:
>> #undef PROCINFO_DECL
>> #undef PROCINFO_CLASS
>>
>> Bye,
>> Stefan
> 
> Okay, we have this chain:
> - elf/ldconfig.c:
> #define PROCINFO_CLASS static
> #include <dl-hwcaps.h>
> -> elf/dl-hwcaps.h
> -> elf/dl-tunables.h
> -> <build>/dl-tunable-list.h
> -> sysdeps/mips/dl-procinfo.h:
> -> sysdeps/unix/sysv/linux/mips/ldsodefs.h
> -> sysdeps/unix/sysv/linux/ldsodefs.h:
> -> sysdeps/gnu/ldsodefs.h
> -> sysdeps/mips/ldsodefs.h
> -> sysdeps/generic/ldsodefs.h:
> ...
> #include <dl-procinfo.c>
> ...
> # define PROCINFO_DECL
> # ifndef PROCINFO_CLASS
> #  define PROCINFO_CLASS EXTERN
> # endif
> # include <dl-vdso-setup.c>
> ...
> 
> Before my patch, sysdeps/mips/dl-procinfo.c contains those undefs at the
> end:
> #undef PROCINFO_DECL
> #undef PROCINFO_CLASS
> With my patch, the empty sysdeps/generic/dl-procinfo.c is used.
> 
> Thus we end up in:
> static int (*_dl_vdso_...) (...) RELRO;
> vs before:
> extern int (*_dl_vdso_...) (...) RELRO;
> 
> The latter builds fine, while the former produces the "defined but not
> used" warnings.
> 
> 
> Thus I will adjust my patch to keep sysdeps/mips/dl-procinfo.c with only
> something like this:
> /* Note:
>    When compiling elf/ldconfig.c, PROCINFO_CLASS is defined to static.
>    This dl-procinfo.c is included in sysdeps/generic/ldsodefs.h.
>    Afterwards, if not yet defined, PROCINFO_CLASS is defined to EXTERN
>    just before dl-vdso-setup.c is included.  A "static" _dl_vdso_xyz
>    function prototype would lead to gcc warnings/errors: defined but
>    not used.  */
> #undef PROCINFO_DECL
> #undef PROCINFO_CLASS
> 
> 
> My patch also removes sysdeps/alpha/dl-procinfo.c and
> sysdeps/csky/dl-procinfo.c with those #undef's at the end. But alpha and
> csky do not define the vdso HAVE_XYZ_VSYSCALL macros and thus do not end
> up with those errors.
> (At the end of dl-vdso-setup.c, PROCINFO_DECL and PROCINFO_CLASS are
> also undefined)
> 
> I run build-many-glibcs.py from scratch which lasts some time.
> Afterwards I'll send a V2 series.
> 
> Thanks,
> Stefan

I've successfully run build-many-glibcs.py from scratch - all PASSed -
and I send a V2 with the MIPS-fix:
[V2] elf: Remove platform strings in dl-procinfo.c
https://sourceware.org/pipermail/libc-alpha/2024-June/157391.html

Adhemerval has already reviewed the remaining patches. As soon as this
V2 is also reviewed, I can push the series.

Thanks,
Stefan

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [V2] elf: Remove platform strings in dl-procinfo.c
  2024-06-12  7:32     ` [V2] " Stefan Liebler
@ 2024-06-14 12:58       ` Adhemerval Zanella Netto
  0 siblings, 0 replies; 30+ messages in thread
From: Adhemerval Zanella Netto @ 2024-06-14 12:58 UTC (permalink / raw)
  To: Stefan Liebler, libc-alpha; +Cc: fweimer, devel, bergner



On 12/06/24 04:32, Stefan Liebler wrote:
> Remove the platform strings in dl-procinfo.c where also
> the implementation of _dl_string_platform() was removed.

LGTM, thanks.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/alpha/dl-procinfo.c     | 62 ---------------------------------
>  sysdeps/csky/dl-procinfo.c      | 62 ---------------------------------
>  sysdeps/mips/dl-procinfo.c      | 49 ++++----------------------
>  sysdeps/s390/dl-procinfo-s390.c |  6 ----
>  sysdeps/s390/dl-procinfo.h      |  1 -
>  sysdeps/x86/dl-procinfo.c       | 16 ---------
>  6 files changed, 7 insertions(+), 189 deletions(-)
>  delete mode 100644 sysdeps/alpha/dl-procinfo.c
>  delete mode 100644 sysdeps/csky/dl-procinfo.c
> 
> diff --git a/sysdeps/alpha/dl-procinfo.c b/sysdeps/alpha/dl-procinfo.c
> deleted file mode 100644
> index 633dcbf974..0000000000
> --- a/sysdeps/alpha/dl-procinfo.c
> +++ /dev/null
> @@ -1,62 +0,0 @@
> -/* Data for Alpha version of processor capability information.
> -   Copyright (C) 2008-2024 Free Software Foundation, Inc.
> -   This file is part of the GNU C Library.
> -
> -   The GNU C Library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 of the License, or (at your option) any later version.
> -
> -   The GNU C Library is distributed in the hope that it will be useful,
> -   but WITHOUT ANY WARRANTY; without even the implied warranty of
> -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with the GNU C Library.  If not, see
> -   <https://www.gnu.org/licenses/>.  */
> -
> -/* This information must be kept in sync with the _DL_PLATFORM_COUNT
> -   definitions in procinfo.h.
> -
> -   If anything should be added here check whether the size of each string
> -   is still ok with the given array size.
> -
> -   All the #ifdefs in the definitions are quite irritating but
> -   necessary if we want to avoid duplicating the information.  There
> -   are three different modes:
> -
> -   - PROCINFO_DECL is defined.  This means we are only interested in
> -     declarations.
> -
> -   - PROCINFO_DECL is not defined:
> -
> -     + if SHARED is defined the file is included in an array
> -       initializer.  The .element = { ... } syntax is needed.
> -
> -     + if SHARED is not defined a normal array initialization is
> -       needed.
> -  */
> -
> -#ifndef PROCINFO_CLASS
> -#define PROCINFO_CLASS
> -#endif
> -
> -#if !defined PROCINFO_DECL && defined SHARED
> -  ._dl_alpha_platforms
> -#else
> -PROCINFO_CLASS const char _dl_alpha_platforms[5][5]
> -#endif
> -#ifndef PROCINFO_DECL
> -= {
> -    "ev4", "ev5", "ev56", "ev6", "ev67"
> -  }
> -#endif
> -#if !defined SHARED || defined PROCINFO_DECL
> -;
> -#else
> -,
> -#endif
> -
> -#undef PROCINFO_DECL
> -#undef PROCINFO_CLASS
> diff --git a/sysdeps/csky/dl-procinfo.c b/sysdeps/csky/dl-procinfo.c
> deleted file mode 100644
> index 0c81518cff..0000000000
> --- a/sysdeps/csky/dl-procinfo.c
> +++ /dev/null
> @@ -1,62 +0,0 @@
> -/* Data for C-SKY version of processor capability information.
> -   Copyright (C) 2018-2024 Free Software Foundation, Inc.
> -   This file is part of the GNU C Library.
> -
> -   The GNU C Library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 of the License, or (at your option) any later version.
> -
> -   The GNU C Library is distributed in the hope that it will be useful,
> -   but WITHOUT ANY WARRANTY; without even the implied warranty of
> -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with the GNU C Library.  If not, see
> -   <https://www.gnu.org/licenses/>.  */
> -
> -/* This information must be kept in sync with the _DL_PLATFORM_COUNT
> -   definitions in procinfo.h.
> -
> -   If anything should be added here check whether the size of each string
> -   is still ok with the given array size.
> -
> -   All the #ifdefs in the definitions are quite irritating but
> -   necessary if we want to avoid duplicating the information.  There
> -   are three different modes:
> -
> -   - PROCINFO_DECL is defined.  This means we are only interested in
> -     declarations.
> -
> -   - PROCINFO_DECL is not defined:
> -
> -     + if SHARED is defined the file is included in an array
> -       initializer.  The .element = { ... } syntax is needed.
> -
> -     + if SHARED is not defined a normal array initialization is
> -       needed.
> -  */
> -
> -#ifndef PROCINFO_CLASS
> -# define PROCINFO_CLASS
> -#endif
> -
> -#if !defined PROCINFO_DECL && defined SHARED
> -  ._dl_csky_platforms
> -#else
> -PROCINFO_CLASS const char _dl_csky_platforms[4][6]
> -#endif
> -#ifndef PROCINFO_DECL
> -= {
> -    "ck610", "ck807", "ck810", "ck860"
> -  }
> -#endif
> -#if !defined SHARED || defined PROCINFO_DECL
> -;
> -#else
> -,
> -#endif
> -
> -#undef PROCINFO_DECL
> -#undef PROCINFO_CLASS
> diff --git a/sysdeps/mips/dl-procinfo.c b/sysdeps/mips/dl-procinfo.c
> index 0b1dfeea2d..6a1aaefef2 100644
> --- a/sysdeps/mips/dl-procinfo.c
> +++ b/sysdeps/mips/dl-procinfo.c
> @@ -16,47 +16,12 @@
>     License along with the GNU C Library.  If not, see
>     <https://www.gnu.org/licenses/>.  */
>  
> -/* This information must be kept in sync with the _DL_PLATFORM_COUNT
> -   definitions in procinfo.h.
> -
> -   If anything should be added here check whether the size of each string
> -   is still ok with the given array size.
> -
> -   All the #ifdefs in the definitions are quite irritating but
> -   necessary if we want to avoid duplicating the information.  There
> -   are three different modes:
> -
> -   - PROCINFO_DECL is defined.  This means we are only interested in
> -     declarations.
> -
> -   - PROCINFO_DECL is not defined:
> -
> -     + if SHARED is defined the file is included in an array
> -       initializer.  The .element = { ... } syntax is needed.
> -
> -     + if SHARED is not defined a normal array initialization is
> -       needed.
> -  */
> -
> -#ifndef PROCINFO_CLASS
> -#define PROCINFO_CLASS
> -#endif
> -
> -#if !defined PROCINFO_DECL && defined SHARED
> -  ._dl_mips_platforms
> -#else
> -PROCINFO_CLASS const char _dl_mips_platforms[4][11]
> -#endif
> -#ifndef PROCINFO_DECL
> -= {
> -    "loongson2e", "loongson2f", "octeon", "octeon2"
> -  }
> -#endif
> -#if !defined SHARED || defined PROCINFO_DECL
> -;
> -#else
> -,
> -#endif
> -
> +/* Note:
> +   When compiling elf/ldconfig.c, PROCINFO_CLASS is defined to static.
> +   This dl-procinfo.c is included in sysdeps/generic/ldsodefs.h.
> +   Afterwards, if not yet defined, PROCINFO_CLASS is defined to EXTERN
> +   just before dl-vdso-setup.c is included.  A "static" _dl_vdso_xyz
> +   function prototype would lead to gcc warnings/errors: defined but
> +   not used.  */
>  #undef PROCINFO_DECL
>  #undef PROCINFO_CLASS
> diff --git a/sysdeps/s390/dl-procinfo-s390.c b/sysdeps/s390/dl-procinfo-s390.c
> index 2821e40cb1..652f6067a3 100644
> --- a/sysdeps/s390/dl-procinfo-s390.c
> +++ b/sysdeps/s390/dl-procinfo-s390.c
> @@ -24,9 +24,3 @@ const char _dl_s390_cap_flags[_DL_HWCAP_COUNT][9] =
>      "highgprs", "te", "vx", "vxd", "vxe", "gs", "vxe2", "vxp", "sort", "dflt",
>      "vxp2", "nnpa", "pcimio", "sie"
>    };
> -
> -const char _dl_s390_platforms[_DL_PLATFORMS_COUNT][7] =
> -  {
> -    "g5", "z900", "z990", "z9-109", "z10", "z196", "zEC12", "z13", "z14", "z15",
> -    "z16"
> -  };
> diff --git a/sysdeps/s390/dl-procinfo.h b/sysdeps/s390/dl-procinfo.h
> index ffeb655ad0..63c9889f94 100644
> --- a/sysdeps/s390/dl-procinfo.h
> +++ b/sysdeps/s390/dl-procinfo.h
> @@ -24,7 +24,6 @@
>  extern const char _dl_s390_cap_flags[_DL_HWCAP_COUNT][9] attribute_hidden;
>  
>  #define _DL_PLATFORMS_COUNT	11
> -extern const char _dl_s390_platforms[_DL_PLATFORMS_COUNT][7] attribute_hidden;
>  
>  /* The kernel provides up to 32 capability bits with elf_hwcap.  */
>  #define _DL_FIRST_PLATFORM	32
> diff --git a/sysdeps/x86/dl-procinfo.c b/sysdeps/x86/dl-procinfo.c
> index 5920d4b320..165ffd89a9 100644
> --- a/sysdeps/x86/dl-procinfo.c
> +++ b/sysdeps/x86/dl-procinfo.c
> @@ -71,22 +71,6 @@ PROCINFO_CLASS const char _dl_x86_hwcap_flags[3][9]
>  ,
>  #endif
>  
> -#if !defined PROCINFO_DECL && defined SHARED
> -  ._dl_x86_platforms
> -#else
> -PROCINFO_CLASS const char _dl_x86_platforms[4][9]
> -#endif
> -#ifndef PROCINFO_DECL
> -= {
> -    "i586", "i686", "haswell", "xeon_phi"
> -  }
> -#endif
> -#if !defined SHARED || defined PROCINFO_DECL
> -;
> -#else
> -,
> -#endif
> -
>  #if defined SHARED && !IS_IN (ldconfig)
>  # if !defined PROCINFO_DECL
>    ._dl_x86_tlsdesc_dynamic

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [RFC 0/9] Remove legacy platform bits and cleanups
  2024-06-12  7:50       ` Stefan Liebler
@ 2024-06-18  8:55         ` Stefan Liebler
  0 siblings, 0 replies; 30+ messages in thread
From: Stefan Liebler @ 2024-06-18  8:55 UTC (permalink / raw)
  To: libc-alpha

On 12.06.24 09:50, Stefan Liebler wrote:
> On 11.06.24 14:13, Stefan Liebler wrote:
>> On 10.06.24 15:36, Stefan Liebler wrote:
>>> On 08.06.24 13:09, Florian Weimer wrote:
>>>> * Stefan Liebler:
>>>>
>>>>> This patch series is the result of:
>>>>> "Question regarding platform-bits in ld.so.cache"
>>>>> https://sourceware.org/pipermail/libc-alpha/2024-May/156793.html
>>>>
>>>> This series fails to build on MIPS with:
>>>>
>>>> mips64-glibc-linux-gnu-gcc -mabi=32 ldconfig.c -c -std=gnu11 -fgnu89-inline  -g -O2 -Wall -Wwrite-strings -Wundef -Werror -fmerge-all-constants -frounding-math -fno-stack-protector -fno-common -Wp,-U_FORTIFY_SOURCE -Wstrict-prototypes -Wold-style-definition -fmath-errno -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64   -fPIE    -Wa,-execstack -D'SYSCONFDIR="/etc"' -D'LIBDIR="/usr/lib"' -D'SLIBDIR="/lib"'       -I../include -I/home/bmg/build/glibcs/mips-linux-gnu/glibc/elf  -I/home/bmg/build/glibcs/mips-linux-gnu/glibc  -I../sysdeps/unix/sysv/linux/mips/mips32/fpu  -I../sysdeps/unix/sysv/linux/mips/mips32  -I../sysdeps/unix/sysv/linux/mips  -I../sysdeps/mips/nptl  -I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux  -I../sysdeps/nptl  -I../sysdeps/pthread  -I../sysdeps/gnu  -I../sysdeps/unix/inet  -I../sysdeps/unix/sysv  -I../sysdeps/unix/mips/mips32  -I../sysdeps/unix/mips  -I../sysdeps/unix  -I../sysdeps/posix  -I../sysdeps/mips/mips32/fpu  -I../sysdeps/mips/mips32  -I../sysdeps/mips/ieee754  -I../sysdeps/mips/include -I../sysdeps/mips  -I../sysdeps/ieee754/flt-32  -I../sysdeps/ieee754/dbl-64  -I../sysdeps/wordsize-32  -I../sysdeps/mips/fpu  -I../sysdeps/ieee754  -I../sysdeps/generic  -I.. -I../libio -I.   -D_LIBC_REENTRANT -include /home/bmg/build/glibcs/mips-linux-gnu/glibc/libc-modules.h -DMODULE_NAME=ldconfig -include ../include/libc-symbols.h  -DPIC     -DTOP_NAMESPACE=glibc -o /home/bmg/build/glibcs/mips-linux-gnu/glibc/elf/ldconfig.o -MD -MP -MF /home/bmg/build/glibcs/mips-linux-gnu/glibc/elf/ldconfig.o.dt -MT /home/bmg/build/glibcs/mips-linux-gnu/glibc/elf/ldconfig.o
>>>> In file included from ../sysdeps/generic/ldsodefs.h:643,
>>>>                  from ../sysdeps/mips/ldsodefs.h:82,
>>>>                  from ../sysdeps/gnu/ldsodefs.h:46,
>>>>                  from ../sysdeps/unix/sysv/linux/ldsodefs.h:25,
>>>>                  from ../sysdeps/unix/sysv/linux/mips/ldsodefs.h:22,
>>>>                  from ../sysdeps/mips/dl-procinfo.h:22,
>>>>                  from /home/bmg/build/glibcs/mips-linux-gnu/glibc/dl-tunable-list.h:6,
>>>>                  from ../elf/dl-tunables.h:48,
>>>>                  from ./dl-hwcaps.h:25,
>>>>                  from ldconfig.c:44:
>>>> ../sysdeps/unix/sysv/linux/dl-vdso-setup.c:62:22: error: ‘_dl_vdso_clock_getres’ defined but not used [-Werror=unused-variable]
>>>>    62 | PROCINFO_CLASS int (*_dl_vdso_clock_getres) (clockid_t,
>>>>       |                      ^~~~~~~~~~~~~~~~~~~~~
>>>> ../sysdeps/unix/sysv/linux/dl-vdso-setup.c:53:22: error: ‘_dl_vdso_gettimeofday’ defined but not used [-Werror=unused-variable]
>>>>    53 | PROCINFO_CLASS int (*_dl_vdso_gettimeofday) (struct timeval *, void *) RELRO;
>>>>       |                      ^~~~~~~~~~~~~~~~~~~~~
>>>> ../sysdeps/unix/sysv/linux/dl-vdso-setup.c:49:22: error: ‘_dl_vdso_clock_gettime64’ defined but not used [-Werror=unused-variable]
>>>>    49 | PROCINFO_CLASS int (*_dl_vdso_clock_gettime64) (clockid_t,
>>>>       |                      ^~~~~~~~~~~~~~~~~~~~~~~~
>>>> ../sysdeps/unix/sysv/linux/dl-vdso-setup.c:45:22: error: ‘_dl_vdso_clock_gettime’ defined but not used [-Werror=unused-variable]
>>>>    45 | PROCINFO_CLASS int (*_dl_vdso_clock_gettime) (clockid_t,
>>>>       |                      ^~~~~~~~~~~~~~~~~~~~~~
>>>> cc1: all warnings being treated as errors
>>>> make[3]: *** [../o-iterator.mk:9: /home/bmg/build/glibcs/mips-linux-gnu/glibc/elf/ldconfig.o] Error 1
>>>> make[3]: Leaving directory '/home/bmg/src/glibc/elf'
>>>> make[3]: *** Waiting for unfinished jobs....
>>>> make[2]: *** [Makefile:484: elf/others] Error 2
>>>> make[1]: *** [Makefile:9: all] Error 2
>>>>
>>>> Florian
>>>>
>>> Hi Florian,
>>>
>>> thanks for the info. I've take a look. Seems to be related to the
>>> removed sysdeps/mips/dl-procinfo.c with those undefs at the end:
>>> #undef PROCINFO_DECL
>>> #undef PROCINFO_CLASS
>>>
>>> Bye,
>>> Stefan
>>
>> Okay, we have this chain:
>> - elf/ldconfig.c:
>> #define PROCINFO_CLASS static
>> #include <dl-hwcaps.h>
>> -> elf/dl-hwcaps.h
>> -> elf/dl-tunables.h
>> -> <build>/dl-tunable-list.h
>> -> sysdeps/mips/dl-procinfo.h:
>> -> sysdeps/unix/sysv/linux/mips/ldsodefs.h
>> -> sysdeps/unix/sysv/linux/ldsodefs.h:
>> -> sysdeps/gnu/ldsodefs.h
>> -> sysdeps/mips/ldsodefs.h
>> -> sysdeps/generic/ldsodefs.h:
>> ...
>> #include <dl-procinfo.c>
>> ...
>> # define PROCINFO_DECL
>> # ifndef PROCINFO_CLASS
>> #  define PROCINFO_CLASS EXTERN
>> # endif
>> # include <dl-vdso-setup.c>
>> ...
>>
>> Before my patch, sysdeps/mips/dl-procinfo.c contains those undefs at the
>> end:
>> #undef PROCINFO_DECL
>> #undef PROCINFO_CLASS
>> With my patch, the empty sysdeps/generic/dl-procinfo.c is used.
>>
>> Thus we end up in:
>> static int (*_dl_vdso_...) (...) RELRO;
>> vs before:
>> extern int (*_dl_vdso_...) (...) RELRO;
>>
>> The latter builds fine, while the former produces the "defined but not
>> used" warnings.
>>
>>
>> Thus I will adjust my patch to keep sysdeps/mips/dl-procinfo.c with only
>> something like this:
>> /* Note:
>>    When compiling elf/ldconfig.c, PROCINFO_CLASS is defined to static.
>>    This dl-procinfo.c is included in sysdeps/generic/ldsodefs.h.
>>    Afterwards, if not yet defined, PROCINFO_CLASS is defined to EXTERN
>>    just before dl-vdso-setup.c is included.  A "static" _dl_vdso_xyz
>>    function prototype would lead to gcc warnings/errors: defined but
>>    not used.  */
>> #undef PROCINFO_DECL
>> #undef PROCINFO_CLASS
>>
>>
>> My patch also removes sysdeps/alpha/dl-procinfo.c and
>> sysdeps/csky/dl-procinfo.c with those #undef's at the end. But alpha and
>> csky do not define the vdso HAVE_XYZ_VSYSCALL macros and thus do not end
>> up with those errors.
>> (At the end of dl-vdso-setup.c, PROCINFO_DECL and PROCINFO_CLASS are
>> also undefined)
>>
>> I run build-many-glibcs.py from scratch which lasts some time.
>> Afterwards I'll send a V2 series.
>>
>> Thanks,
>> Stefan
> 
> I've successfully run build-many-glibcs.py from scratch - all PASSed -
> and I send a V2 with the MIPS-fix:
> [V2] elf: Remove platform strings in dl-procinfo.c
> https://sourceware.org/pipermail/libc-alpha/2024-June/157391.html
> 
> Adhemerval has already reviewed the remaining patches. As soon as this
> V2 is also reviewed, I can push the series.
> 
> Thanks,
> Stefan

Adhemerval has also reviewed
[V2] elf: Remove platform strings in dl-procinfo.c

Thus I've committed the series.

Thanks,
Stefan

^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2024-06-18  8:56 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-07 11:42 [RFC 0/9] Remove legacy platform bits and cleanups Stefan Liebler
2024-06-07 11:42 ` [RFC 1/9] x86: Remove HWCAP_START and HWCAP_COUNT Stefan Liebler
2024-06-11 18:14   ` Adhemerval Zanella Netto
2024-06-07 11:42 ` [RFC 2/9] elf: Remove loading legacy hwcaps/platform entries in dynamic loader Stefan Liebler
2024-06-11 18:57   ` Adhemerval Zanella Netto
2024-06-07 11:42 ` [RFC 3/9] elf: Remove _dl_string_platform Stefan Liebler
2024-06-11 19:09   ` Adhemerval Zanella Netto
2024-06-07 11:42 ` [RFC 4/9] elf: Remove platform strings in dl-procinfo.c Stefan Liebler
2024-06-11 19:20   ` Adhemerval Zanella Netto
2024-06-12  7:32     ` [V2] " Stefan Liebler
2024-06-14 12:58       ` Adhemerval Zanella Netto
2024-06-07 11:42 ` [RFC 5/9] elf: Remove _DL_HWCAP_PLATFORM Stefan Liebler
2024-06-11 19:28   ` Adhemerval Zanella Netto
2024-06-07 11:42 ` [RFC 6/9] elf: Remove _DL_FIRST_PLATFORM Stefan Liebler
2024-06-11 19:29   ` Adhemerval Zanella Netto
2024-06-07 11:42 ` [RFC 7/9] elf: Remove _DL_PLATFORMS_COUNT Stefan Liebler
2024-06-11 19:48   ` Adhemerval Zanella Netto
2024-06-07 11:42 ` [RFC 8/9] elf: Remove LD_HWCAP_MASK / tunable glibc.cpu.hwcap_mask Stefan Liebler
2024-06-11 20:04   ` Adhemerval Zanella Netto
2024-06-07 11:42 ` [RFC 9/9] elf: Remove HWCAP_IMPORTANT Stefan Liebler
2024-06-11 20:07   ` Adhemerval Zanella Netto
2024-06-07 12:18 ` [RFC 0/9] Remove legacy platform bits and cleanups Florian Weimer
2024-06-10 13:23   ` Stefan Liebler
2024-06-10 14:03     ` Florian Weimer
2024-06-11 12:24       ` Stefan Liebler
2024-06-08 11:09 ` Florian Weimer
2024-06-10 13:36   ` Stefan Liebler
2024-06-11 12:13     ` Stefan Liebler
2024-06-12  7:50       ` Stefan Liebler
2024-06-18  8:55         ` Stefan Liebler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).