diff mbox series

elf: Delete obsoleted DISTINGUISH_LIB_VERSIONS

Message ID 20210807051211.1018349-1-maskray@google.com
State New
Headers show
Series elf: Delete obsoleted DISTINGUISH_LIB_VERSIONS | expand

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

Fāng-ruì Sòng Aug. 7, 2021, 5:12 a.m. UTC
and its only definition in i386/dl-librecon.h which essentially
hasn't been updated since 2004.
---
 elf/rtld.c                                 |  4 ----
 sysdeps/unix/sysv/linux/i386/dl-librecon.h | 25 ----------------------
 2 files changed, 29 deletions(-)

Comments

Fāng-ruì Sòng Aug. 16, 2021, 5:03 p.m. UTC | #1
Ping

On Fri, Aug 6, 2021 at 10:12 PM Fangrui Song <maskray@google.com> wrote:
>
> and its only definition in i386/dl-librecon.h which essentially
> hasn't been updated since 2004.
> ---
>  elf/rtld.c                                 |  4 ----
>  sysdeps/unix/sysv/linux/i386/dl-librecon.h | 25 ----------------------
>  2 files changed, 29 deletions(-)
>
> diff --git a/elf/rtld.c b/elf/rtld.c
> index d733359eaf..4196bae703 100644
> --- a/elf/rtld.c
> +++ b/elf/rtld.c
> @@ -1637,10 +1637,6 @@ dl_main (const ElfW(Phdr) *phdr,
>        if (main_map->l_ld == NULL)
>         _exit (1);
>
> -      /* We allow here some platform specific code.  */
> -#ifdef DISTINGUISH_LIB_VERSIONS
> -      DISTINGUISH_LIB_VERSIONS;
> -#endif
>        _exit (has_interp ? 0 : 2);
>      }
>
> diff --git a/sysdeps/unix/sysv/linux/i386/dl-librecon.h b/sysdeps/unix/sysv/linux/i386/dl-librecon.h
> index 7efe0679b3..e4d90529b8 100644
> --- a/sysdeps/unix/sysv/linux/i386/dl-librecon.h
> +++ b/sysdeps/unix/sysv/linux/i386/dl-librecon.h
> @@ -21,31 +21,6 @@
>
>  #include <sysdeps/unix/sysv/linux/dl-librecon.h>
>
> -#define DISTINGUISH_LIB_VERSIONS \
> -  do                                                                         \
> -    {                                                                        \
> -      /* We have to find out whether the binary is linked against            \
> -        libc 5 or glibc.  We do this by looking at all the DT_NEEDED         \
> -        entries.  If one is libc.so.5 this is a libc 5 linked binary.  */    \
> -      if (main_map->l_info[DT_NEEDED])                                       \
> -       {                                                                     \
> -         /* We have dependencies.  */                                        \
> -         const ElfW(Dyn) *d;                                                 \
> -         const char *strtab;                                                 \
> -                                                                             \
> -         strtab = (const char *) D_PTR (main_map, l_info[DT_STRTAB]);        \
> -                                                                             \
> -         for (d = main_map->l_ld; d->d_tag != DT_NULL; ++d)                  \
> -           if (d->d_tag == DT_NEEDED                                         \
> -               && strcmp (strtab + d->d_un.d_val, "libc.so.5") == 0)         \
> -             break;                                                          \
> -                                                                             \
> -         /* We print a `5' or `6' depending on the outcome.  */              \
> -         _dl_printf (d->d_tag != DT_NULL ? "5\n" : "6\n");                   \
> -       }                                                                     \
> -    }                                                                        \
> -  while (0)
> -
>  /* Recognizing extra environment variables.  */
>  #define EXTRA_LD_ENVVARS \
>    case 15:                                                                   \
> --
> 2.32.0.605.g8dce9f2422-goog
>
Florian Weimer Aug. 16, 2021, 5:13 p.m. UTC | #2
* Fangrui Song via Libc-alpha:

> and its only definition in i386/dl-librecon.h which essentially
> hasn't been updated since 2004.

There is closely related to this around _DL_CACHE_DEFAULT_ID and
FLAG_ELF_LIBC5.  Should that be removed as well?

Thanks,
Florian
Fāng-ruì Sòng Aug. 16, 2021, 5:36 p.m. UTC | #3
On Mon, Aug 16, 2021 at 10:13 AM Florian Weimer <fweimer@redhat.com> wrote:
>
> * Fangrui Song via Libc-alpha:
>
> > and its only definition in i386/dl-librecon.h which essentially
> > hasn't been updated since 2004.
>
> There is closely related to this around _DL_CACHE_DEFAULT_ID and
> FLAG_ELF_LIBC5.  Should that be removed as well?
>
> Thanks,
> Florian

I can take a look. _DL_CACHE_DEFAULT_ID and FLAG_ELF_LIBC5 appear to
be used by more arches.
I think it may be prudent to treat them separately.
Andreas Schwab Aug. 17, 2021, 7:51 a.m. UTC | #4
On Aug 06 2021, Fangrui Song via Libc-alpha wrote:

> and its only definition in i386/dl-librecon.h which essentially
> hasn't been updated since 2004.

What has obsoleted it?  Why is it relevant how long a block of code has
been stable?

Andreas.
diff mbox series

Patch

diff --git a/elf/rtld.c b/elf/rtld.c
index d733359eaf..4196bae703 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -1637,10 +1637,6 @@  dl_main (const ElfW(Phdr) *phdr,
       if (main_map->l_ld == NULL)
 	_exit (1);
 
-      /* We allow here some platform specific code.  */
-#ifdef DISTINGUISH_LIB_VERSIONS
-      DISTINGUISH_LIB_VERSIONS;
-#endif
       _exit (has_interp ? 0 : 2);
     }
 
diff --git a/sysdeps/unix/sysv/linux/i386/dl-librecon.h b/sysdeps/unix/sysv/linux/i386/dl-librecon.h
index 7efe0679b3..e4d90529b8 100644
--- a/sysdeps/unix/sysv/linux/i386/dl-librecon.h
+++ b/sysdeps/unix/sysv/linux/i386/dl-librecon.h
@@ -21,31 +21,6 @@ 
 
 #include <sysdeps/unix/sysv/linux/dl-librecon.h>
 
-#define DISTINGUISH_LIB_VERSIONS \
-  do									      \
-    {									      \
-      /* We have to find out whether the binary is linked against	      \
-	 libc 5 or glibc.  We do this by looking at all the DT_NEEDED	      \
-	 entries.  If one is libc.so.5 this is a libc 5 linked binary.  */    \
-      if (main_map->l_info[DT_NEEDED])					      \
-	{								      \
-	  /* We have dependencies.  */					      \
-	  const ElfW(Dyn) *d;						      \
-	  const char *strtab;						      \
-									      \
-	  strtab = (const char *) D_PTR (main_map, l_info[DT_STRTAB]);	      \
-									      \
-	  for (d = main_map->l_ld; d->d_tag != DT_NULL; ++d)		      \
-	    if (d->d_tag == DT_NEEDED					      \
-		&& strcmp (strtab + d->d_un.d_val, "libc.so.5") == 0)	      \
-	      break;							      \
-									      \
-	  /* We print a `5' or `6' depending on the outcome.  */	      \
-	  _dl_printf (d->d_tag != DT_NULL ? "5\n" : "6\n");		      \
-	}								      \
-    }									      \
-  while (0)
-
 /* Recognizing extra environment variables.  */
 #define EXTRA_LD_ENVVARS \
   case 15:								      \