[v2] Remove special flags of libc.5.so and libc.4.so

Message ID 20220513211108.wjoddnozbvzefsnu@workbox
State Superseded
Delegated to: Adhemerval Zanella Netto
Headers
Series [v2] Remove special flags of libc.5.so and libc.4.so |

Checks

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

Commit Message

Raoni Fassina Firmino May 13, 2022, 9:11 p.m. UTC
  From: Lucas A. M. Magalhaes via Libc-alpha <libc-alpha@sourceware.org>

Changes since v1[1]:
  - Applied review suggestions:
    + Removed unneeded comment.
    + Fixed error message casing.
    + Removed last references to FLAG_ELF_LIBC5 and FLAG_LIBC4.
  - Removed last references to FLAG_ELF and FLAG_ANY

After reviewing Adhemerval's suggestions[2] It was clear that with
Lucas refactoring removing libc4 and libc5 references, the last uses
of FLAG_ELF and FLAG_ANY were also not necessary anymore either, so I
removed both, and coincidentally in the same code part/neighborhood of the last references to
FLAG_LIBC4 and FLAG_ELF_LIBC5 that Adhemerval pointed out.

Tested on top of master (8162147872491bb5b48e91543b19c49a29ae6b6d)
with no regression on the following platforms:
  - powerpc64le-linux-gnu
  - powerpc64-linux-gnu
  - powerpc-linux-gnu
  - x86_64-linux-gnu (also built in 32bits/i686)
  - build-many-glibcs.py

[1] https://sourceware.org/pipermail/libc-alpha/2022-March/137079.html
[2] https://sourceware.org/pipermail/libc-alpha/2022-March/137176.html

-- 8< --

The older libcs version are obsolete for over twenty years now. This
commit removes special flags of libc.5.so and libc.4.so. It assume that
all libraries cached are libc.6.so compatible and wrote FLAG_ELF_LIBC6.
---
 elf/cache.c                                   |  6 +-
 elf/ldconfig.c                                | 63 ++-----------------
 elf/readelflib.c                              | 46 ++------------
 elf/readlib.c                                 | 25 +-------
 sysdeps/unix/sysv/linux/aarch64/ldconfig.h    | 11 ----
 sysdeps/unix/sysv/linux/arc/ldconfig.h        |  8 ---
 sysdeps/unix/sysv/linux/arm/ldconfig.h        |  7 ---
 sysdeps/unix/sysv/linux/csky/ldconfig.h       |  6 --
 sysdeps/unix/sysv/linux/i386/ldconfig.h       |  6 --
 sysdeps/unix/sysv/linux/ia64/ldconfig.h       |  6 --
 .../unix/sysv/linux/mips/mips64/ldconfig.h    |  7 ---
 sysdeps/unix/sysv/linux/powerpc/ldconfig.h    |  8 ---
 sysdeps/unix/sysv/linux/riscv/ldconfig.h      | 17 -----
 sysdeps/unix/sysv/linux/s390/ldconfig.h       |  7 ---
 sysdeps/unix/sysv/linux/x86_64/ldconfig.h     |  8 ---
 15 files changed, 14 insertions(+), 217 deletions(-)
  

Comments

Adhemerval Zanella May 16, 2022, 7:24 p.m. UTC | #1
On 13/05/2022 18:11, Raoni Fassina Firmino wrote:
> From: Lucas A. M. Magalhaes via Libc-alpha <libc-alpha@sourceware.org>
> 
> Changes since v1[1]:
>   - Applied review suggestions:
>     + Removed unneeded comment.
>     + Fixed error message casing.
>     + Removed last references to FLAG_ELF_LIBC5 and FLAG_LIBC4.
>   - Removed last references to FLAG_ELF and FLAG_ANY
> 
> After reviewing Adhemerval's suggestions[2] It was clear that with
> Lucas refactoring removing libc4 and libc5 references, the last uses
> of FLAG_ELF and FLAG_ANY were also not necessary anymore either, so I
> removed both, and coincidentally in the same code part/neighborhood of the last references to
> FLAG_LIBC4 and FLAG_ELF_LIBC5 that Adhemerval pointed out.
> 
> Tested on top of master (8162147872491bb5b48e91543b19c49a29ae6b6d)
> with no regression on the following platforms:
>   - powerpc64le-linux-gnu
>   - powerpc64-linux-gnu
>   - powerpc-linux-gnu
>   - x86_64-linux-gnu (also built in 32bits/i686)
>   - build-many-glibcs.py
> 
> [1] https://sourceware.org/pipermail/libc-alpha/2022-March/137079.html
> [2] https://sourceware.org/pipermail/libc-alpha/2022-March/137176.html
> 
> -- 8< --
> 
> The older libcs version are obsolete for over twenty years now. This
> commit removes special flags of libc.5.so and libc.4.so. It assume that
> all libraries cached are libc.6.so compatible and wrote FLAG_ELF_LIBC6.

Could you resend a new version since this intersec with the linux version
check removal (and git am does not apply cleanly)?

Just some nits below regarding comments, patch looks correct.

> ---
>  elf/cache.c                                   |  6 +-
>  elf/ldconfig.c                                | 63 ++-----------------
>  elf/readelflib.c                              | 46 ++------------
>  elf/readlib.c                                 | 25 +-------
>  sysdeps/unix/sysv/linux/aarch64/ldconfig.h    | 11 ----
>  sysdeps/unix/sysv/linux/arc/ldconfig.h        |  8 ---
>  sysdeps/unix/sysv/linux/arm/ldconfig.h        |  7 ---
>  sysdeps/unix/sysv/linux/csky/ldconfig.h       |  6 --
>  sysdeps/unix/sysv/linux/i386/ldconfig.h       |  6 --
>  sysdeps/unix/sysv/linux/ia64/ldconfig.h       |  6 --
>  .../unix/sysv/linux/mips/mips64/ldconfig.h    |  7 ---
>  sysdeps/unix/sysv/linux/powerpc/ldconfig.h    |  8 ---
>  sysdeps/unix/sysv/linux/riscv/ldconfig.h      | 17 -----
>  sysdeps/unix/sysv/linux/s390/ldconfig.h       |  7 ---
>  sysdeps/unix/sysv/linux/x86_64/ldconfig.h     |  8 ---
>  15 files changed, 14 insertions(+), 217 deletions(-)
> 
> diff --git a/elf/cache.c b/elf/cache.c
> index dbf4c83a7a61..3023647d595c 100644
> --- a/elf/cache.c
> +++ b/elf/cache.c
> @@ -158,6 +158,7 @@ struct cache_entry
>  /* List of all cache entries.  */
>  static struct cache_entry *entries;
>  
> +/* libc4, ELF and libc5 are unsupported */

Missing period and double space before '*/'.

>  static const char *flag_descr[] =
>  { "libc4", "ELF", "libc5", "libc6"};
>  
> @@ -169,14 +170,11 @@ print_entry (const char *lib, int flag, unsigned int osversion,
>    printf ("\t%s (", lib);
>    switch (flag & FLAG_TYPE_MASK)
>      {
> -    case FLAG_LIBC4:
> -    case FLAG_ELF:
> -    case FLAG_ELF_LIBC5:
>      case FLAG_ELF_LIBC6:
>        fputs (flag_descr[flag & FLAG_TYPE_MASK], stdout);
>        break;
>      default:
> -      fputs (_("unknown"), stdout);
> +      fputs (_("unknown or unsupported flag"), stdout);
>        break;
>      }
>    switch (flag & FLAG_REQUIRED_MASK)
> diff --git a/elf/ldconfig.c b/elf/ldconfig.c
> index 57bb95ebc334..ac2aeeb27d06 100644
> --- a/elf/ldconfig.c
> +++ b/elf/ldconfig.c
> @@ -65,19 +65,6 @@
>  
>  #define PACKAGE _libc_intl_domainname
>  
> -static const struct
> -{
> -  const char *name;
> -  int flag;
> -} lib_types[] =
> -{
> -  {"libc4", FLAG_LIBC4},
> -  {"libc5", FLAG_ELF_LIBC5},
> -  {"libc6", FLAG_ELF_LIBC6},
> -  {"glibc2", FLAG_ELF_LIBC6}
> -};
> -
> -
>  /* List of directories to handle.  */
>  struct dir_entry
>  {
> @@ -469,27 +456,8 @@ add_dir_1 (const char *line, const char *from_file, int from_line)
>    entry->from_file = strdup (from_file);
>    entry->from_line = from_line;
>  
> -  /* Search for an '=' sign.  */
>    entry->path = xstrdup (line);
> -  char *equal_sign = strchr (entry->path, '=');
> -  if (equal_sign)
> -    {
> -      *equal_sign = '\0';
> -      ++equal_sign;
> -      entry->flag = FLAG_ANY;
> -      for (i = 0; i < sizeof (lib_types) / sizeof (lib_types[0]); ++i)
> -	if (strcmp (equal_sign, lib_types[i].name) == 0)
> -	  {
> -	    entry->flag = lib_types[i].flag;
> -	    break;
> -	  }
> -      if (entry->flag == FLAG_ANY)
> -	error (0, 0, _("%s is not a known library type"), equal_sign);
> -    }
> -  else
> -    {
> -      entry->flag = FLAG_ANY;
> -    }
> +  entry->flag = FLAG_ELF_LIBC6;
>  
>    /* Canonify path: for now only remove leading and trailing
>       whitespace and the trailing slashes.  */
> @@ -1060,23 +1028,11 @@ search_dir (const struct dir_entry *entry)
>  	  soname = xstrdup (direntry->d_name);
>  	}
>  
> -      if (flag == FLAG_ELF
> -	  && (entry->flag == FLAG_ELF_LIBC5
> -	      || entry->flag == FLAG_ELF_LIBC6))
> -	flag = entry->flag;
> -
>        /* Some sanity checks to print warnings.  */
>        if (opt_verbose)
>  	{
> -	  if (flag == FLAG_ELF_LIBC5 && entry->flag != FLAG_ELF_LIBC5
> -	      && entry->flag != FLAG_ANY)
> -	    error (0, 0, _("libc5 library %s in wrong directory"), file_name);
> -	  if (flag == FLAG_ELF_LIBC6 && entry->flag != FLAG_ELF_LIBC6
> -	      && entry->flag != FLAG_ANY)
> +	  if (flag == FLAG_ELF_LIBC6 && entry->flag != FLAG_ELF_LIBC6)
>  	    error (0, 0, _("libc6 library %s in wrong directory"), file_name);
> -	  if (flag == FLAG_LIBC4 && entry->flag != FLAG_LIBC4
> -	      && entry->flag != FLAG_ANY)
> -	    error (0, 0, _("libc4 library %s in wrong directory"), file_name);
>  	}
>  
>        /* Add library to list.  */
> @@ -1095,19 +1051,8 @@ search_dir (const struct dir_entry *entry)
>  		  /* It's newer - add it.  */
>  		  /* Flag should be the same - sanity check.  */
>  		  if (dlib_ptr->flag != flag)
> -		    {
> -		      if (dlib_ptr->flag == FLAG_ELF
> -			  && (flag == FLAG_ELF_LIBC5 || flag == FLAG_ELF_LIBC6))
> -			dlib_ptr->flag = flag;
> -		      else if ((dlib_ptr->flag == FLAG_ELF_LIBC5
> -				|| dlib_ptr->flag == FLAG_ELF_LIBC6)
> -			       && flag == FLAG_ELF)
> -			dlib_ptr->flag = flag;
> -		      else
> -			error (0, 0, _("libraries %s and %s in directory %s have same soname but different type."),
> -			       dlib_ptr->name, direntry->d_name,
> -			       entry->path);
> -		    }
> +		    error (0, 0, _("libraries %s and %s in directory %s have same soname but different type."),
> +			   dlib_ptr->name, direntry->d_name, entry->path);
>  		  free (dlib_ptr->name);
>  		  dlib_ptr->name = xstrdup (direntry->d_name);
>  		  dlib_ptr->is_link = is_link;
> diff --git a/elf/readelflib.c b/elf/readelflib.c
> index e147416363c2..51e90fb56ad9 100644
> --- a/elf/readelflib.c
> +++ b/elf/readelflib.c
> @@ -44,7 +44,6 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
>  		  char **soname, void *file_contents, size_t file_length)
>  {
>    int i;
> -  unsigned int j;
>    unsigned int dynamic_addr;
>    size_t dynamic_size;
>    char *program_interpreter;
> @@ -82,9 +81,8 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
>    elf_pheader = (ElfW(Phdr) *) (elf_header->e_phoff + file_contents);
>    check_ptr (elf_pheader);
>  
> -  /* The library is an elf library, now search for soname and
> -     libc5/libc6.  */
> -  *flag = FLAG_ELF;
> +  /* The library is an elf library   */

Missing period.

> +  *flag = FLAG_ELF_LIBC6;
>  
>    /* The default ISA level is 0.  */
>    *isa_level = 0;
> @@ -111,16 +109,6 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
>  	  program_interpreter = (char *) (file_contents + segment->p_offset);
>  	  check_ptr (program_interpreter);
>  
> -	  /* Check if this is enough to classify the binary.  */
> -	  for (j = 0; j < sizeof (interpreters) / sizeof (interpreters [0]);
> -	       ++j)
> -	    if (strcmp (program_interpreter, interpreters[j].soname) == 0)
> -	      {
> -		*flag = interpreters[j].flag;
> -		break;
> -	      }
> -	  break;
> -
>  	case PT_NOTE:
>  	  if (!*osversion && segment->p_filesz >= 32 && segment->p_align >= 4)
>  	    {
> @@ -291,38 +279,16 @@ done:
>    if (dynamic_strings == NULL)
>      return 1;
>  
> -  /* Now read the DT_NEEDED and DT_SONAME entries.  */
> +  /* Now read the DT_SONAME entries.  */
>    for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL;
>         ++dyn_entry)
>      {
> -      if (dyn_entry->d_tag == DT_NEEDED || dyn_entry->d_tag == DT_SONAME)
> +      if (dyn_entry->d_tag == DT_SONAME)
>  	{
>  	  char *name = dynamic_strings + dyn_entry->d_un.d_val;
>  	  check_ptr (name);
> -
> -	  if (dyn_entry->d_tag == DT_NEEDED)
> -	    {
> -
> -	      if (*flag == FLAG_ELF)
> -		{
> -		  /* Check if this is enough to classify the binary.  */
> -		  for (j = 0;
> -		       j < sizeof (known_libs) / sizeof (known_libs [0]);
> -		       ++j)
> -		    if (strcmp (name, known_libs [j].soname) == 0)
> -		      {
> -			*flag = known_libs [j].flag;
> -			break;
> -		      }
> -		}
> -	    }
> -
> -	  else if (dyn_entry->d_tag == DT_SONAME)
> -	    *soname = xstrdup (name);
> -
> -	  /* Do we have everything we need?  */
> -	  if (*soname && *flag != FLAG_ELF)
> -	    return 0;
> +          *soname = xstrdup (name);
> +          return 0;
>  	}
>      }
>  
> diff --git a/elf/readlib.c b/elf/readlib.c
> index 3651dcdd8e3d..1807aa16f20f 100644
> --- a/elf/readlib.c
> +++ b/elf/readlib.c
> @@ -43,24 +43,6 @@ struct known_names
>    int flag;
>  };
>  
> -static struct known_names interpreters[] =
> -{
> -  { "/lib/" LD_SO, FLAG_ELF_LIBC6 },
> -#ifdef SYSDEP_KNOWN_INTERPRETER_NAMES
> -  SYSDEP_KNOWN_INTERPRETER_NAMES
> -#endif
> -};
> -
> -static struct known_names known_libs[] =
> -{
> -  { LIBC_SO, FLAG_ELF_LIBC6 },
> -  { LIBM_SO, FLAG_ELF_LIBC6 },
> -#ifdef SYSDEP_KNOWN_LIBRARY_NAMES
> -  SYSDEP_KNOWN_LIBRARY_NAMES
> -#endif
> -};
> -
> -
>  /* Check if string corresponds to a GDB Python file.  */
>  static bool
>  is_gdb_python_file (const char *name)
> @@ -84,7 +66,8 @@ process_file (const char *real_file_name, const char *file_name,
>    struct exec *aout_header;
>  
>    ret = 0;
> -  *flag = FLAG_ANY;
> +  /* Just set FLAG_ELF_LIBC6 as old formats are not supported anymore.  */
> +  *flag = FLAG_ELF_LIBC6;
>    *soname = NULL;
>  
>    file = fopen (real_file_name, "rb");
> @@ -151,7 +134,6 @@ process_file (const char *real_file_name, const char *file_name,
>  	    *dot = '\0';
>  	}
>        *soname = copy;
> -      *flag = FLAG_LIBC4;
>        goto done;
>      }
>  
> @@ -192,9 +174,6 @@ implicit_soname (const char *lib, int flag)
>  {
>    char *soname = xstrdup (lib);
>  
> -  if ((flag & FLAG_TYPE_MASK) != FLAG_LIBC4)
> -    return soname;
> -
>    /* Aout files don't have a soname, just return the name
>       including the major number.  */
>    char *major = strstr (soname, ".so.");
> diff --git a/sysdeps/unix/sysv/linux/aarch64/ldconfig.h b/sysdeps/unix/sysv/linux/aarch64/ldconfig.h
> index 5cbfb327141d..69871151ed8c 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/ldconfig.h
> +++ b/sysdeps/unix/sysv/linux/aarch64/ldconfig.h
> @@ -17,14 +17,3 @@
>     <https://www.gnu.org/licenses/>.  */
>  
>  #include <sysdeps/generic/ldconfig.h>
> -
> -#define SYSDEP_KNOWN_INTERPRETER_NAMES \
> -  { "/lib/ld-linux-aarch64.so.1", FLAG_ELF_LIBC6 }, \
> -  { "/lib/ld-linux-aarch64_be.so.1", FLAG_ELF_LIBC6 }, \
> -  { "/lib/ld-linux-aarch64_ilp32.so.1", FLAG_ELF_LIBC6 }, \
> -  { "/lib/ld-linux-aarch64_be_ilp32.so.1", FLAG_ELF_LIBC6 }, \
> -  { "/lib/ld-linux.so.3", FLAG_ELF_LIBC6 }, \
> -  { "/lib/ld-linux-armhf.so.3", FLAG_ELF_LIBC6 },
> -#define SYSDEP_KNOWN_LIBRARY_NAMES \
> -  { "libc.so.6", FLAG_ELF_LIBC6 },	\
> -  { "libm.so.6", FLAG_ELF_LIBC6 },
> diff --git a/sysdeps/unix/sysv/linux/arc/ldconfig.h b/sysdeps/unix/sysv/linux/arc/ldconfig.h
> index f673170e59a2..ed019a8cdb61 100644
> --- a/sysdeps/unix/sysv/linux/arc/ldconfig.h
> +++ b/sysdeps/unix/sysv/linux/arc/ldconfig.h
> @@ -17,11 +17,3 @@
>     <https://www.gnu.org/licenses/>.  */
>  
>  #include <sysdeps/generic/ldconfig.h>
> -
> -#define SYSDEP_KNOWN_INTERPRETER_NAMES 		\
> -  { "/lib/ld-linux-arc.so.2", FLAG_ELF_LIBC6 },	\
> -  { "/lib/ld-linux-arceb.so.2", FLAG_ELF_LIBC6 },
> -
> -#define SYSDEP_KNOWN_LIBRARY_NAMES 	\
> -  { "libc.so.6", FLAG_ELF_LIBC6 },	\
> -  { "libm.so.6", FLAG_ELF_LIBC6 },
> diff --git a/sysdeps/unix/sysv/linux/arm/ldconfig.h b/sysdeps/unix/sysv/linux/arm/ldconfig.h
> index d1253993eaa1..9afda09cca63 100644
> --- a/sysdeps/unix/sysv/linux/arm/ldconfig.h
> +++ b/sysdeps/unix/sysv/linux/arm/ldconfig.h
> @@ -16,10 +16,3 @@
>     <https://www.gnu.org/licenses/>.  */
>  
>  #include <sysdeps/generic/ldconfig.h>
> -
> -#define SYSDEP_KNOWN_INTERPRETER_NAMES \
> -  { "/lib/ld-linux.so.3", FLAG_ELF_LIBC6 }, \
> -  { "/lib/ld-linux-armhf.so.3", FLAG_ELF_LIBC6 },
> -#define SYSDEP_KNOWN_LIBRARY_NAMES \
> -  { "libc.so.6", FLAG_ELF_LIBC6 },	\
> -  { "libm.so.6", FLAG_ELF_LIBC6 },
> diff --git a/sysdeps/unix/sysv/linux/csky/ldconfig.h b/sysdeps/unix/sysv/linux/csky/ldconfig.h
> index fbe17e3dc81f..d4bea7b9e465 100644
> --- a/sysdeps/unix/sysv/linux/csky/ldconfig.h
> +++ b/sysdeps/unix/sysv/linux/csky/ldconfig.h
> @@ -26,9 +26,3 @@
>  #else
>  # define LD_SO_ABI "cskyv2"
>  #endif
> -
> -#define SYSDEP_KNOWN_INTERPRETER_NAMES	\
> -  { LD_SO_PREFIX LD_SO_ABI LD_SO_SUFFIX, FLAG_ELF_LIBC6 },
> -#define SYSDEP_KNOWN_LIBRARY_NAMES	\
> -  { "libc.so.6", FLAG_ELF_LIBC6 },	\
> -  { "libm.so.6", FLAG_ELF_LIBC6 },
> diff --git a/sysdeps/unix/sysv/linux/i386/ldconfig.h b/sysdeps/unix/sysv/linux/i386/ldconfig.h
> index bafbec1231c7..9afda09cca63 100644
> --- a/sysdeps/unix/sysv/linux/i386/ldconfig.h
> +++ b/sysdeps/unix/sysv/linux/i386/ldconfig.h
> @@ -16,9 +16,3 @@
>     <https://www.gnu.org/licenses/>.  */
>  
>  #include <sysdeps/generic/ldconfig.h>
> -
> -#define SYSDEP_KNOWN_INTERPRETER_NAMES \
> -  { "/lib/ld-linux.so.1", FLAG_ELF_LIBC5 },
> -#define SYSDEP_KNOWN_LIBRARY_NAMES \
> -  { "libc.so.5", FLAG_ELF_LIBC5 },	\
> -  { "libm.so.5", FLAG_ELF_LIBC5 },
> diff --git a/sysdeps/unix/sysv/linux/ia64/ldconfig.h b/sysdeps/unix/sysv/linux/ia64/ldconfig.h
> index 4731419bf87b..9afda09cca63 100644
> --- a/sysdeps/unix/sysv/linux/ia64/ldconfig.h
> +++ b/sysdeps/unix/sysv/linux/ia64/ldconfig.h
> @@ -16,9 +16,3 @@
>     <https://www.gnu.org/licenses/>.  */
>  
>  #include <sysdeps/generic/ldconfig.h>
> -
> -#define SYSDEP_KNOWN_INTERPRETER_NAMES \
> -  { "/lib/ld-linux.so.2", FLAG_ELF_LIBC6 },
> -#define SYSDEP_KNOWN_LIBRARY_NAMES \
> -  { "libc.so.6", FLAG_ELF_LIBC6 },	\
> -  { "libm.so.6", FLAG_ELF_LIBC6 },
> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/ldconfig.h b/sysdeps/unix/sysv/linux/mips/mips64/ldconfig.h
> index ac82941affb2..3f2c7cadbbb2 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips64/ldconfig.h
> +++ b/sysdeps/unix/sysv/linux/mips/mips64/ldconfig.h
> @@ -16,10 +16,3 @@
>     <https://www.gnu.org/licenses/>.  */
>  
>  #include <sysdeps/generic/ldconfig.h>
> -
> -#define SYSDEP_KNOWN_INTERPRETER_NAMES \
> -  { "/lib32/ld.so.1", FLAG_ELF_LIBC6 }, \
> -  { "/lib64/ld.so.1", FLAG_ELF_LIBC6 },
> -#define SYSDEP_KNOWN_LIBRARY_NAMES \
> -  { "libc.so.6", FLAG_ELF_LIBC6 },	\
> -  { "libm.so.6", FLAG_ELF_LIBC6 },
> diff --git a/sysdeps/unix/sysv/linux/powerpc/ldconfig.h b/sysdeps/unix/sysv/linux/powerpc/ldconfig.h
> index 1d70657838c2..0791e3020a57 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/ldconfig.h
> +++ b/sysdeps/unix/sysv/linux/powerpc/ldconfig.h
> @@ -17,11 +17,3 @@
>     <https://www.gnu.org/licenses/>.  */
>  
>  #include <sysdeps/generic/ldconfig.h>
> -
> -#define SYSDEP_KNOWN_INTERPRETER_NAMES \
> -  { "/lib/ld.so.1", FLAG_ELF_LIBC6 },	\
> -  { "/lib64/ld64.so.1", FLAG_ELF_LIBC6 }, \
> -  { "/lib64/ld64.so.2", FLAG_ELF_LIBC6 },
> -#define SYSDEP_KNOWN_LIBRARY_NAMES \
> -  { "libc.so.6", FLAG_ELF_LIBC6 },	\
> -  { "libm.so.6", FLAG_ELF_LIBC6 },
> diff --git a/sysdeps/unix/sysv/linux/riscv/ldconfig.h b/sysdeps/unix/sysv/linux/riscv/ldconfig.h
> index e3847f116e00..5308926d8837 100644
> --- a/sysdeps/unix/sysv/linux/riscv/ldconfig.h
> +++ b/sysdeps/unix/sysv/linux/riscv/ldconfig.h
> @@ -17,20 +17,3 @@
>     <https://www.gnu.org/licenses/>.  */
>  
>  #include <sysdeps/generic/ldconfig.h>
> -
> -#define LD_SO_PREFIX "/lib/ld-linux-"
> -#define LD_SO_SUFFIX ".so.1"
> -
> -#if __riscv_xlen == 64
> -# define LD_SO_ABI "riscv64-lp64"
> -#else
> -# define LD_SO_ABI "riscv32-ilp32"
> -#endif
> -
> -#define SYSDEP_KNOWN_INTERPRETER_NAMES				\
> -  { LD_SO_PREFIX LD_SO_ABI "d" LD_SO_SUFFIX, FLAG_ELF_LIBC6 },	\
> -  { LD_SO_PREFIX LD_SO_ABI     LD_SO_SUFFIX, FLAG_ELF_LIBC6 },
> -
> -#define SYSDEP_KNOWN_LIBRARY_NAMES	\
> -  { "libc.so.6", FLAG_ELF_LIBC6 },	\
> -  { "libm.so.6", FLAG_ELF_LIBC6 },
> diff --git a/sysdeps/unix/sysv/linux/s390/ldconfig.h b/sysdeps/unix/sysv/linux/s390/ldconfig.h
> index f564a6eaf673..9afda09cca63 100644
> --- a/sysdeps/unix/sysv/linux/s390/ldconfig.h
> +++ b/sysdeps/unix/sysv/linux/s390/ldconfig.h
> @@ -16,10 +16,3 @@
>     <https://www.gnu.org/licenses/>.  */
>  
>  #include <sysdeps/generic/ldconfig.h>
> -
> -#define SYSDEP_KNOWN_INTERPRETER_NAMES \
> -  { "/lib/ld.so.1", FLAG_ELF_LIBC6 },	\
> -  { "/lib/ld64.so.1", FLAG_ELF_LIBC6 },
> -#define SYSDEP_KNOWN_LIBRARY_NAMES \
> -  { "libc.so.6", FLAG_ELF_LIBC6 },	\
> -  { "libm.so.6", FLAG_ELF_LIBC6 },
> diff --git a/sysdeps/unix/sysv/linux/x86_64/ldconfig.h b/sysdeps/unix/sysv/linux/x86_64/ldconfig.h
> index b67203e0175c..9afda09cca63 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/ldconfig.h
> +++ b/sysdeps/unix/sysv/linux/x86_64/ldconfig.h
> @@ -16,11 +16,3 @@
>     <https://www.gnu.org/licenses/>.  */
>  
>  #include <sysdeps/generic/ldconfig.h>
> -
> -#define SYSDEP_KNOWN_INTERPRETER_NAMES \
> -  { "/lib/ld-linux.so.2", FLAG_ELF_LIBC6 }, \
> -  { "/libx32/ld-linux-x32.so.2", FLAG_ELF_LIBC6 }, \
> -  { "/lib64/ld-linux-x86-64.so.2", FLAG_ELF_LIBC6 },
> -#define SYSDEP_KNOWN_LIBRARY_NAMES \
> -  { "libc.so.6", FLAG_ELF_LIBC6 },	\
> -  { "libm.so.6", FLAG_ELF_LIBC6 },
  
Raoni Fassina Firmino May 18, 2022, 5:13 a.m. UTC | #2
On Mon, May 16, 2022 at 04:24:30PM -0300, AL glibc-alpha wrote:
> Could you resend a new version since this intersec with the linux version
> check removal (and git am does not apply cleanly)?

Sure, I will do it shortly.
  

Patch

diff --git a/elf/cache.c b/elf/cache.c
index dbf4c83a7a61..3023647d595c 100644
--- a/elf/cache.c
+++ b/elf/cache.c
@@ -158,6 +158,7 @@  struct cache_entry
 /* List of all cache entries.  */
 static struct cache_entry *entries;
 
+/* libc4, ELF and libc5 are unsupported */
 static const char *flag_descr[] =
 { "libc4", "ELF", "libc5", "libc6"};
 
@@ -169,14 +170,11 @@  print_entry (const char *lib, int flag, unsigned int osversion,
   printf ("\t%s (", lib);
   switch (flag & FLAG_TYPE_MASK)
     {
-    case FLAG_LIBC4:
-    case FLAG_ELF:
-    case FLAG_ELF_LIBC5:
     case FLAG_ELF_LIBC6:
       fputs (flag_descr[flag & FLAG_TYPE_MASK], stdout);
       break;
     default:
-      fputs (_("unknown"), stdout);
+      fputs (_("unknown or unsupported flag"), stdout);
       break;
     }
   switch (flag & FLAG_REQUIRED_MASK)
diff --git a/elf/ldconfig.c b/elf/ldconfig.c
index 57bb95ebc334..ac2aeeb27d06 100644
--- a/elf/ldconfig.c
+++ b/elf/ldconfig.c
@@ -65,19 +65,6 @@ 
 
 #define PACKAGE _libc_intl_domainname
 
-static const struct
-{
-  const char *name;
-  int flag;
-} lib_types[] =
-{
-  {"libc4", FLAG_LIBC4},
-  {"libc5", FLAG_ELF_LIBC5},
-  {"libc6", FLAG_ELF_LIBC6},
-  {"glibc2", FLAG_ELF_LIBC6}
-};
-
-
 /* List of directories to handle.  */
 struct dir_entry
 {
@@ -469,27 +456,8 @@  add_dir_1 (const char *line, const char *from_file, int from_line)
   entry->from_file = strdup (from_file);
   entry->from_line = from_line;
 
-  /* Search for an '=' sign.  */
   entry->path = xstrdup (line);
-  char *equal_sign = strchr (entry->path, '=');
-  if (equal_sign)
-    {
-      *equal_sign = '\0';
-      ++equal_sign;
-      entry->flag = FLAG_ANY;
-      for (i = 0; i < sizeof (lib_types) / sizeof (lib_types[0]); ++i)
-	if (strcmp (equal_sign, lib_types[i].name) == 0)
-	  {
-	    entry->flag = lib_types[i].flag;
-	    break;
-	  }
-      if (entry->flag == FLAG_ANY)
-	error (0, 0, _("%s is not a known library type"), equal_sign);
-    }
-  else
-    {
-      entry->flag = FLAG_ANY;
-    }
+  entry->flag = FLAG_ELF_LIBC6;
 
   /* Canonify path: for now only remove leading and trailing
      whitespace and the trailing slashes.  */
@@ -1060,23 +1028,11 @@  search_dir (const struct dir_entry *entry)
 	  soname = xstrdup (direntry->d_name);
 	}
 
-      if (flag == FLAG_ELF
-	  && (entry->flag == FLAG_ELF_LIBC5
-	      || entry->flag == FLAG_ELF_LIBC6))
-	flag = entry->flag;
-
       /* Some sanity checks to print warnings.  */
       if (opt_verbose)
 	{
-	  if (flag == FLAG_ELF_LIBC5 && entry->flag != FLAG_ELF_LIBC5
-	      && entry->flag != FLAG_ANY)
-	    error (0, 0, _("libc5 library %s in wrong directory"), file_name);
-	  if (flag == FLAG_ELF_LIBC6 && entry->flag != FLAG_ELF_LIBC6
-	      && entry->flag != FLAG_ANY)
+	  if (flag == FLAG_ELF_LIBC6 && entry->flag != FLAG_ELF_LIBC6)
 	    error (0, 0, _("libc6 library %s in wrong directory"), file_name);
-	  if (flag == FLAG_LIBC4 && entry->flag != FLAG_LIBC4
-	      && entry->flag != FLAG_ANY)
-	    error (0, 0, _("libc4 library %s in wrong directory"), file_name);
 	}
 
       /* Add library to list.  */
@@ -1095,19 +1051,8 @@  search_dir (const struct dir_entry *entry)
 		  /* It's newer - add it.  */
 		  /* Flag should be the same - sanity check.  */
 		  if (dlib_ptr->flag != flag)
-		    {
-		      if (dlib_ptr->flag == FLAG_ELF
-			  && (flag == FLAG_ELF_LIBC5 || flag == FLAG_ELF_LIBC6))
-			dlib_ptr->flag = flag;
-		      else if ((dlib_ptr->flag == FLAG_ELF_LIBC5
-				|| dlib_ptr->flag == FLAG_ELF_LIBC6)
-			       && flag == FLAG_ELF)
-			dlib_ptr->flag = flag;
-		      else
-			error (0, 0, _("libraries %s and %s in directory %s have same soname but different type."),
-			       dlib_ptr->name, direntry->d_name,
-			       entry->path);
-		    }
+		    error (0, 0, _("libraries %s and %s in directory %s have same soname but different type."),
+			   dlib_ptr->name, direntry->d_name, entry->path);
 		  free (dlib_ptr->name);
 		  dlib_ptr->name = xstrdup (direntry->d_name);
 		  dlib_ptr->is_link = is_link;
diff --git a/elf/readelflib.c b/elf/readelflib.c
index e147416363c2..51e90fb56ad9 100644
--- a/elf/readelflib.c
+++ b/elf/readelflib.c
@@ -44,7 +44,6 @@  process_elf_file (const char *file_name, const char *lib, int *flag,
 		  char **soname, void *file_contents, size_t file_length)
 {
   int i;
-  unsigned int j;
   unsigned int dynamic_addr;
   size_t dynamic_size;
   char *program_interpreter;
@@ -82,9 +81,8 @@  process_elf_file (const char *file_name, const char *lib, int *flag,
   elf_pheader = (ElfW(Phdr) *) (elf_header->e_phoff + file_contents);
   check_ptr (elf_pheader);
 
-  /* The library is an elf library, now search for soname and
-     libc5/libc6.  */
-  *flag = FLAG_ELF;
+  /* The library is an elf library   */
+  *flag = FLAG_ELF_LIBC6;
 
   /* The default ISA level is 0.  */
   *isa_level = 0;
@@ -111,16 +109,6 @@  process_elf_file (const char *file_name, const char *lib, int *flag,
 	  program_interpreter = (char *) (file_contents + segment->p_offset);
 	  check_ptr (program_interpreter);
 
-	  /* Check if this is enough to classify the binary.  */
-	  for (j = 0; j < sizeof (interpreters) / sizeof (interpreters [0]);
-	       ++j)
-	    if (strcmp (program_interpreter, interpreters[j].soname) == 0)
-	      {
-		*flag = interpreters[j].flag;
-		break;
-	      }
-	  break;
-
 	case PT_NOTE:
 	  if (!*osversion && segment->p_filesz >= 32 && segment->p_align >= 4)
 	    {
@@ -291,38 +279,16 @@  done:
   if (dynamic_strings == NULL)
     return 1;
 
-  /* Now read the DT_NEEDED and DT_SONAME entries.  */
+  /* Now read the DT_SONAME entries.  */
   for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL;
        ++dyn_entry)
     {
-      if (dyn_entry->d_tag == DT_NEEDED || dyn_entry->d_tag == DT_SONAME)
+      if (dyn_entry->d_tag == DT_SONAME)
 	{
 	  char *name = dynamic_strings + dyn_entry->d_un.d_val;
 	  check_ptr (name);
-
-	  if (dyn_entry->d_tag == DT_NEEDED)
-	    {
-
-	      if (*flag == FLAG_ELF)
-		{
-		  /* Check if this is enough to classify the binary.  */
-		  for (j = 0;
-		       j < sizeof (known_libs) / sizeof (known_libs [0]);
-		       ++j)
-		    if (strcmp (name, known_libs [j].soname) == 0)
-		      {
-			*flag = known_libs [j].flag;
-			break;
-		      }
-		}
-	    }
-
-	  else if (dyn_entry->d_tag == DT_SONAME)
-	    *soname = xstrdup (name);
-
-	  /* Do we have everything we need?  */
-	  if (*soname && *flag != FLAG_ELF)
-	    return 0;
+          *soname = xstrdup (name);
+          return 0;
 	}
     }
 
diff --git a/elf/readlib.c b/elf/readlib.c
index 3651dcdd8e3d..1807aa16f20f 100644
--- a/elf/readlib.c
+++ b/elf/readlib.c
@@ -43,24 +43,6 @@  struct known_names
   int flag;
 };
 
-static struct known_names interpreters[] =
-{
-  { "/lib/" LD_SO, FLAG_ELF_LIBC6 },
-#ifdef SYSDEP_KNOWN_INTERPRETER_NAMES
-  SYSDEP_KNOWN_INTERPRETER_NAMES
-#endif
-};
-
-static struct known_names known_libs[] =
-{
-  { LIBC_SO, FLAG_ELF_LIBC6 },
-  { LIBM_SO, FLAG_ELF_LIBC6 },
-#ifdef SYSDEP_KNOWN_LIBRARY_NAMES
-  SYSDEP_KNOWN_LIBRARY_NAMES
-#endif
-};
-
-
 /* Check if string corresponds to a GDB Python file.  */
 static bool
 is_gdb_python_file (const char *name)
@@ -84,7 +66,8 @@  process_file (const char *real_file_name, const char *file_name,
   struct exec *aout_header;
 
   ret = 0;
-  *flag = FLAG_ANY;
+  /* Just set FLAG_ELF_LIBC6 as old formats are not supported anymore.  */
+  *flag = FLAG_ELF_LIBC6;
   *soname = NULL;
 
   file = fopen (real_file_name, "rb");
@@ -151,7 +134,6 @@  process_file (const char *real_file_name, const char *file_name,
 	    *dot = '\0';
 	}
       *soname = copy;
-      *flag = FLAG_LIBC4;
       goto done;
     }
 
@@ -192,9 +174,6 @@  implicit_soname (const char *lib, int flag)
 {
   char *soname = xstrdup (lib);
 
-  if ((flag & FLAG_TYPE_MASK) != FLAG_LIBC4)
-    return soname;
-
   /* Aout files don't have a soname, just return the name
      including the major number.  */
   char *major = strstr (soname, ".so.");
diff --git a/sysdeps/unix/sysv/linux/aarch64/ldconfig.h b/sysdeps/unix/sysv/linux/aarch64/ldconfig.h
index 5cbfb327141d..69871151ed8c 100644
--- a/sysdeps/unix/sysv/linux/aarch64/ldconfig.h
+++ b/sysdeps/unix/sysv/linux/aarch64/ldconfig.h
@@ -17,14 +17,3 @@ 
    <https://www.gnu.org/licenses/>.  */
 
 #include <sysdeps/generic/ldconfig.h>
-
-#define SYSDEP_KNOWN_INTERPRETER_NAMES \
-  { "/lib/ld-linux-aarch64.so.1", FLAG_ELF_LIBC6 }, \
-  { "/lib/ld-linux-aarch64_be.so.1", FLAG_ELF_LIBC6 }, \
-  { "/lib/ld-linux-aarch64_ilp32.so.1", FLAG_ELF_LIBC6 }, \
-  { "/lib/ld-linux-aarch64_be_ilp32.so.1", FLAG_ELF_LIBC6 }, \
-  { "/lib/ld-linux.so.3", FLAG_ELF_LIBC6 }, \
-  { "/lib/ld-linux-armhf.so.3", FLAG_ELF_LIBC6 },
-#define SYSDEP_KNOWN_LIBRARY_NAMES \
-  { "libc.so.6", FLAG_ELF_LIBC6 },	\
-  { "libm.so.6", FLAG_ELF_LIBC6 },
diff --git a/sysdeps/unix/sysv/linux/arc/ldconfig.h b/sysdeps/unix/sysv/linux/arc/ldconfig.h
index f673170e59a2..ed019a8cdb61 100644
--- a/sysdeps/unix/sysv/linux/arc/ldconfig.h
+++ b/sysdeps/unix/sysv/linux/arc/ldconfig.h
@@ -17,11 +17,3 @@ 
    <https://www.gnu.org/licenses/>.  */
 
 #include <sysdeps/generic/ldconfig.h>
-
-#define SYSDEP_KNOWN_INTERPRETER_NAMES 		\
-  { "/lib/ld-linux-arc.so.2", FLAG_ELF_LIBC6 },	\
-  { "/lib/ld-linux-arceb.so.2", FLAG_ELF_LIBC6 },
-
-#define SYSDEP_KNOWN_LIBRARY_NAMES 	\
-  { "libc.so.6", FLAG_ELF_LIBC6 },	\
-  { "libm.so.6", FLAG_ELF_LIBC6 },
diff --git a/sysdeps/unix/sysv/linux/arm/ldconfig.h b/sysdeps/unix/sysv/linux/arm/ldconfig.h
index d1253993eaa1..9afda09cca63 100644
--- a/sysdeps/unix/sysv/linux/arm/ldconfig.h
+++ b/sysdeps/unix/sysv/linux/arm/ldconfig.h
@@ -16,10 +16,3 @@ 
    <https://www.gnu.org/licenses/>.  */
 
 #include <sysdeps/generic/ldconfig.h>
-
-#define SYSDEP_KNOWN_INTERPRETER_NAMES \
-  { "/lib/ld-linux.so.3", FLAG_ELF_LIBC6 }, \
-  { "/lib/ld-linux-armhf.so.3", FLAG_ELF_LIBC6 },
-#define SYSDEP_KNOWN_LIBRARY_NAMES \
-  { "libc.so.6", FLAG_ELF_LIBC6 },	\
-  { "libm.so.6", FLAG_ELF_LIBC6 },
diff --git a/sysdeps/unix/sysv/linux/csky/ldconfig.h b/sysdeps/unix/sysv/linux/csky/ldconfig.h
index fbe17e3dc81f..d4bea7b9e465 100644
--- a/sysdeps/unix/sysv/linux/csky/ldconfig.h
+++ b/sysdeps/unix/sysv/linux/csky/ldconfig.h
@@ -26,9 +26,3 @@ 
 #else
 # define LD_SO_ABI "cskyv2"
 #endif
-
-#define SYSDEP_KNOWN_INTERPRETER_NAMES	\
-  { LD_SO_PREFIX LD_SO_ABI LD_SO_SUFFIX, FLAG_ELF_LIBC6 },
-#define SYSDEP_KNOWN_LIBRARY_NAMES	\
-  { "libc.so.6", FLAG_ELF_LIBC6 },	\
-  { "libm.so.6", FLAG_ELF_LIBC6 },
diff --git a/sysdeps/unix/sysv/linux/i386/ldconfig.h b/sysdeps/unix/sysv/linux/i386/ldconfig.h
index bafbec1231c7..9afda09cca63 100644
--- a/sysdeps/unix/sysv/linux/i386/ldconfig.h
+++ b/sysdeps/unix/sysv/linux/i386/ldconfig.h
@@ -16,9 +16,3 @@ 
    <https://www.gnu.org/licenses/>.  */
 
 #include <sysdeps/generic/ldconfig.h>
-
-#define SYSDEP_KNOWN_INTERPRETER_NAMES \
-  { "/lib/ld-linux.so.1", FLAG_ELF_LIBC5 },
-#define SYSDEP_KNOWN_LIBRARY_NAMES \
-  { "libc.so.5", FLAG_ELF_LIBC5 },	\
-  { "libm.so.5", FLAG_ELF_LIBC5 },
diff --git a/sysdeps/unix/sysv/linux/ia64/ldconfig.h b/sysdeps/unix/sysv/linux/ia64/ldconfig.h
index 4731419bf87b..9afda09cca63 100644
--- a/sysdeps/unix/sysv/linux/ia64/ldconfig.h
+++ b/sysdeps/unix/sysv/linux/ia64/ldconfig.h
@@ -16,9 +16,3 @@ 
    <https://www.gnu.org/licenses/>.  */
 
 #include <sysdeps/generic/ldconfig.h>
-
-#define SYSDEP_KNOWN_INTERPRETER_NAMES \
-  { "/lib/ld-linux.so.2", FLAG_ELF_LIBC6 },
-#define SYSDEP_KNOWN_LIBRARY_NAMES \
-  { "libc.so.6", FLAG_ELF_LIBC6 },	\
-  { "libm.so.6", FLAG_ELF_LIBC6 },
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/ldconfig.h b/sysdeps/unix/sysv/linux/mips/mips64/ldconfig.h
index ac82941affb2..3f2c7cadbbb2 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/ldconfig.h
+++ b/sysdeps/unix/sysv/linux/mips/mips64/ldconfig.h
@@ -16,10 +16,3 @@ 
    <https://www.gnu.org/licenses/>.  */
 
 #include <sysdeps/generic/ldconfig.h>
-
-#define SYSDEP_KNOWN_INTERPRETER_NAMES \
-  { "/lib32/ld.so.1", FLAG_ELF_LIBC6 }, \
-  { "/lib64/ld.so.1", FLAG_ELF_LIBC6 },
-#define SYSDEP_KNOWN_LIBRARY_NAMES \
-  { "libc.so.6", FLAG_ELF_LIBC6 },	\
-  { "libm.so.6", FLAG_ELF_LIBC6 },
diff --git a/sysdeps/unix/sysv/linux/powerpc/ldconfig.h b/sysdeps/unix/sysv/linux/powerpc/ldconfig.h
index 1d70657838c2..0791e3020a57 100644
--- a/sysdeps/unix/sysv/linux/powerpc/ldconfig.h
+++ b/sysdeps/unix/sysv/linux/powerpc/ldconfig.h
@@ -17,11 +17,3 @@ 
    <https://www.gnu.org/licenses/>.  */
 
 #include <sysdeps/generic/ldconfig.h>
-
-#define SYSDEP_KNOWN_INTERPRETER_NAMES \
-  { "/lib/ld.so.1", FLAG_ELF_LIBC6 },	\
-  { "/lib64/ld64.so.1", FLAG_ELF_LIBC6 }, \
-  { "/lib64/ld64.so.2", FLAG_ELF_LIBC6 },
-#define SYSDEP_KNOWN_LIBRARY_NAMES \
-  { "libc.so.6", FLAG_ELF_LIBC6 },	\
-  { "libm.so.6", FLAG_ELF_LIBC6 },
diff --git a/sysdeps/unix/sysv/linux/riscv/ldconfig.h b/sysdeps/unix/sysv/linux/riscv/ldconfig.h
index e3847f116e00..5308926d8837 100644
--- a/sysdeps/unix/sysv/linux/riscv/ldconfig.h
+++ b/sysdeps/unix/sysv/linux/riscv/ldconfig.h
@@ -17,20 +17,3 @@ 
    <https://www.gnu.org/licenses/>.  */
 
 #include <sysdeps/generic/ldconfig.h>
-
-#define LD_SO_PREFIX "/lib/ld-linux-"
-#define LD_SO_SUFFIX ".so.1"
-
-#if __riscv_xlen == 64
-# define LD_SO_ABI "riscv64-lp64"
-#else
-# define LD_SO_ABI "riscv32-ilp32"
-#endif
-
-#define SYSDEP_KNOWN_INTERPRETER_NAMES				\
-  { LD_SO_PREFIX LD_SO_ABI "d" LD_SO_SUFFIX, FLAG_ELF_LIBC6 },	\
-  { LD_SO_PREFIX LD_SO_ABI     LD_SO_SUFFIX, FLAG_ELF_LIBC6 },
-
-#define SYSDEP_KNOWN_LIBRARY_NAMES	\
-  { "libc.so.6", FLAG_ELF_LIBC6 },	\
-  { "libm.so.6", FLAG_ELF_LIBC6 },
diff --git a/sysdeps/unix/sysv/linux/s390/ldconfig.h b/sysdeps/unix/sysv/linux/s390/ldconfig.h
index f564a6eaf673..9afda09cca63 100644
--- a/sysdeps/unix/sysv/linux/s390/ldconfig.h
+++ b/sysdeps/unix/sysv/linux/s390/ldconfig.h
@@ -16,10 +16,3 @@ 
    <https://www.gnu.org/licenses/>.  */
 
 #include <sysdeps/generic/ldconfig.h>
-
-#define SYSDEP_KNOWN_INTERPRETER_NAMES \
-  { "/lib/ld.so.1", FLAG_ELF_LIBC6 },	\
-  { "/lib/ld64.so.1", FLAG_ELF_LIBC6 },
-#define SYSDEP_KNOWN_LIBRARY_NAMES \
-  { "libc.so.6", FLAG_ELF_LIBC6 },	\
-  { "libm.so.6", FLAG_ELF_LIBC6 },
diff --git a/sysdeps/unix/sysv/linux/x86_64/ldconfig.h b/sysdeps/unix/sysv/linux/x86_64/ldconfig.h
index b67203e0175c..9afda09cca63 100644
--- a/sysdeps/unix/sysv/linux/x86_64/ldconfig.h
+++ b/sysdeps/unix/sysv/linux/x86_64/ldconfig.h
@@ -16,11 +16,3 @@ 
    <https://www.gnu.org/licenses/>.  */
 
 #include <sysdeps/generic/ldconfig.h>
-
-#define SYSDEP_KNOWN_INTERPRETER_NAMES \
-  { "/lib/ld-linux.so.2", FLAG_ELF_LIBC6 }, \
-  { "/libx32/ld-linux-x32.so.2", FLAG_ELF_LIBC6 }, \
-  { "/lib64/ld-linux-x86-64.so.2", FLAG_ELF_LIBC6 },
-#define SYSDEP_KNOWN_LIBRARY_NAMES \
-  { "libc.so.6", FLAG_ELF_LIBC6 },	\
-  { "libm.so.6", FLAG_ELF_LIBC6 },