public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Allow prelinking libraries with no dependencies (glibc part)
@ 2003-05-14 21:31 Jakub Jelinek
  2003-05-14 21:40 ` Ulrich Drepper
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2003-05-14 21:31 UTC (permalink / raw)
  To: Ulrich Drepper, Roland McGrath; +Cc: Glibc hackers

Hi!

Some libraries (e.g. /usr/lib/libaio.so.0) don't have any DT_NEEDED entries
because they don't have any relocations against any libraries but
self. Such libraries haven't been prelinkable so far, because ld.so prints
statically linked for them.
This patch just moves the DT_NEEDED check after DL_DEBUG_PRELINK check,
it looks big because of indent changes (diff -upb is very short).

2003-05-14  Jakub Jelinek  <jakub@redhat.com>

	* elf/rtld.c (dl_main): For LD_TRACE_PRELINKING print search scope
	even ifno DT_NEEDED is present.

--- libc/elf/rtld.c.jj	2003-05-13 16:58:06.000000000 -0400
+++ libc/elf/rtld.c	2003-05-14 17:12:35.000000000 -0400
@@ -1262,57 +1262,52 @@ cannot allocate TLS data structures for 
 	 important that we do this before real relocation, because the
 	 functions we call below for output may no longer work properly
 	 after relocation.  */
-      if (! GL(dl_loaded)->l_info[DT_NEEDED])
-	_dl_printf ("\tstatically linked\n");
-      else
+      struct link_map *l;
+
+      if (GL(dl_debug_mask) & DL_DEBUG_PRELINK)
 	{
-	  struct link_map *l;
+	  struct r_scope_elem *scope = &GL(dl_loaded)->l_searchlist;
 
-	  if (GL(dl_debug_mask) & DL_DEBUG_PRELINK)
+	  for (i = 0; i < scope->r_nlist; i++)
 	    {
-	      struct r_scope_elem *scope = &GL(dl_loaded)->l_searchlist;
-
-	      for (i = 0; i < scope->r_nlist; i++)
+	      l = scope->r_list [i];
+	      if (l->l_faked)
 		{
-		  l = scope->r_list [i];
-		  if (l->l_faked)
-		    {
-		      _dl_printf ("\t%s => not found\n", l->l_libname->name);
-		      continue;
-		    }
-		  if (_dl_name_match_p (GL(dl_trace_prelink), l))
-		    GL(dl_trace_prelink_map) = l;
-		  _dl_printf ("\t%s => %s (0x%0*Zx, 0x%0*Zx)",
-			      l->l_libname->name[0] ? l->l_libname->name
-			      : rtld_progname ?: "<main program>",
-			      l->l_name[0] ? l->l_name
-			      : rtld_progname ?: "<main program>",
-			      (int) sizeof l->l_map_start * 2,
-			      l->l_map_start,
-			      (int) sizeof l->l_addr * 2,
-			      l->l_addr);
+		  _dl_printf ("\t%s => not found\n", l->l_libname->name);
+		  continue;
+		}
+	      if (_dl_name_match_p (GL(dl_trace_prelink), l))
+		GL(dl_trace_prelink_map) = l;
+	      _dl_printf ("\t%s => %s (0x%0*Zx, 0x%0*Zx)",
+			  l->l_libname->name[0] ? l->l_libname->name
+			  : rtld_progname ?: "<main program>",
+			  l->l_name[0] ? l->l_name
+			  : rtld_progname ?: "<main program>",
+			  (int) sizeof l->l_map_start * 2, l->l_map_start,
+			  (int) sizeof l->l_addr * 2, l->l_addr);
 #ifdef USE_TLS
-		  if (l->l_tls_modid)
-		    _dl_printf (" TLS(0x%Zx, 0x%0*Zx)\n", l->l_tls_modid,
-				(int) sizeof l->l_tls_offset * 2,
-				l->l_tls_offset);
-		  else
+	      if (l->l_tls_modid)
+		_dl_printf (" TLS(0x%Zx, 0x%0*Zx)\n", l->l_tls_modid,
+			    (int) sizeof l->l_tls_offset * 2,
+			    l->l_tls_offset);
+	      else
 #endif
-		    _dl_printf ("\n");
-		}
-	    }
-	  else
-	    {
-	      for (l = GL(dl_loaded)->l_next; l; l = l->l_next)
-		if (l->l_faked)
-		  /* The library was not found.  */
-		  _dl_printf ("\t%s => not found\n", l->l_libname->name);
-		else
-		  _dl_printf ("\t%s => %s (0x%0*Zx)\n", l->l_libname->name,
-			      l->l_name, (int) sizeof l->l_map_start * 2,
-			      l->l_map_start);
+		_dl_printf ("\n");
 	    }
 	}
+      else if (! GL(dl_loaded)->l_info[DT_NEEDED])
+	_dl_printf ("\tstatically linked\n");
+      else
+	{
+	  for (l = GL(dl_loaded)->l_next; l; l = l->l_next)
+	    if (l->l_faked)
+	      /* The library was not found.  */
+	      _dl_printf ("\t%s => not found\n", l->l_libname->name);
+	    else
+	      _dl_printf ("\t%s => %s (0x%0*Zx)\n", l->l_libname->name,
+			  l->l_name, (int) sizeof l->l_map_start * 2,
+			  l->l_map_start);
+	}
 
       if (__builtin_expect (mode, trace) != trace)
 	for (i = 1; i < (unsigned int) _dl_argc; ++i)

	Jakub

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

* Re: [PATCH] Allow prelinking libraries with no dependencies (glibc part)
  2003-05-14 21:31 [PATCH] Allow prelinking libraries with no dependencies (glibc part) Jakub Jelinek
@ 2003-05-14 21:40 ` Ulrich Drepper
  0 siblings, 0 replies; 2+ messages in thread
From: Ulrich Drepper @ 2003-05-14 21:40 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Roland McGrath, Glibc hackers

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jakub Jelinek wrote:

> 2003-05-14  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* elf/rtld.c (dl_main): For LD_TRACE_PRELINKING print search scope
> 	even ifno DT_NEEDED is present.

Applied.  Thanks,

- -- 
- --------------.                        ,-.            444 Castro Street
Ulrich Drepper \    ,-----------------'   \ Mountain View, CA 94041 USA
Red Hat         `--' drepper at redhat.com `---------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+wreZ2ijCOnn/RHQRAiKhAJ90stnR3Ff8OhdUUy3SPM9Z9uKd6gCdGu+7
XTm4fT4dPTnLqcYOqMmrWT8=
=GPtb
-----END PGP SIGNATURE-----

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

end of thread, other threads:[~2003-05-14 21:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-14 21:31 [PATCH] Allow prelinking libraries with no dependencies (glibc part) Jakub Jelinek
2003-05-14 21:40 ` Ulrich Drepper

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).