diff mbox series

[v3,05/32] elf: In rtld_setup_main_map, assume ld.so has a DYNAMIC segment

Message ID c4f803f31b898d7ea6bfdae3470dbd3e72b312e6.1701944612.git.fweimer@redhat.com
State New
Headers show
Series RELRO linkmaps | expand

Commit Message

Florian Weimer Dec. 7, 2023, 10:31 a.m. UTC
The way we build ld.so, it always has a dynamic segment, so checking for
its absence is unnecessary.
---
 elf/rtld.c | 24 ------------------------
 1 file changed, 24 deletions(-)

Comments

Joseph Myers Feb. 19, 2024, 10:18 p.m. UTC | #1
On Thu, 7 Dec 2023, Florian Weimer wrote:

> The way we build ld.so, it always has a dynamic segment, so checking for
> its absence is unnecessary.

OK.
diff mbox series

Patch

diff --git a/elf/rtld.c b/elf/rtld.c
index f0b0f3328d..a00a8d9d0f 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -386,7 +386,6 @@  static void dl_main (const ElfW(Phdr) *phdr, ElfW(Word) phnum,
 
 /* These two variables cannot be moved into .data.rel.ro.  */
 static struct libname_list _dl_rtld_libname;
-static struct libname_list _dl_rtld_libname2;
 
 /* Variable for statistics.  */
 RLTD_TIMING_DECLARE (relocate_time, static);
@@ -1165,29 +1164,6 @@  rtld_setup_main_map (struct link_map *main_map)
 	/* _dl_rtld_libname.next = NULL;	Already zero.  */
 	GL(dl_rtld_map).l_libname = &_dl_rtld_libname;
 
-	/* Ordinarily, we would get additional names for the loader from
-	   our DT_SONAME.  This can't happen if we were actually linked as
-	   a static executable (detect this case when we have no DYNAMIC).
-	   If so, assume the filename component of the interpreter path to
-	   be our SONAME, and add it to our name list.  */
-	if (GL(dl_rtld_map).l_ld == NULL)
-	  {
-	    const char *p = NULL;
-	    const char *cp = _dl_rtld_libname.name;
-
-	    /* Find the filename part of the path.  */
-	    while (*cp != '\0')
-	      if (*cp++ == '/')
-		p = cp;
-
-	    if (p != NULL)
-	      {
-		_dl_rtld_libname2.name = p;
-		/* _dl_rtld_libname2.next = NULL;  Already zero.  */
-		_dl_rtld_libname.next = &_dl_rtld_libname2;
-	      }
-	  }
-
 	has_interp = true;
 	break;
       case PT_LOAD: