about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-05-14 21:40:32 +0000
committerUlrich Drepper <drepper@redhat.com>2003-05-14 21:40:32 +0000
commit81f3ac4c9a003161d3396ea9322ca7330adedefa (patch)
tree21443ee882f1e124aaec974032b4c552a5922f2d
parentc9300aefcd97dffc51d28e8dd5018c6b1a5447c3 (diff)
downloadglibc-81f3ac4c9a003161d3396ea9322ca7330adedefa.tar.gz
glibc-81f3ac4c9a003161d3396ea9322ca7330adedefa.tar.xz
glibc-81f3ac4c9a003161d3396ea9322ca7330adedefa.zip
Update.
2003-05-14  Jakub Jelinek  <jakub@redhat.com>

	* elf/rtld.c (dl_main): For LD_TRACE_PRELINKING print search scope
	even if no DT_NEEDED is present.
-rw-r--r--ChangeLog5
-rw-r--r--elf/rtld.c81
-rw-r--r--nptl/ChangeLog8
-rw-r--r--nptl/Makefile53
4 files changed, 85 insertions, 62 deletions
diff --git a/ChangeLog b/ChangeLog
index 8091442a4b..bcee70b24c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2003-05-14  Jakub Jelinek  <jakub@redhat.com>
+
+	* elf/rtld.c (dl_main): For LD_TRACE_PRELINKING print search scope
+	even if no DT_NEEDED is present.
+
 2003-05-13  David Mosberger  <davidm@hpl.hp.com>
 
 	* sysdeps/unix/sysv/linux/ia64/setjmp.S: Fix the fix from
diff --git a/elf/rtld.c b/elf/rtld.c
index e9e781aa95..a0d8e98c57 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -1262,57 +1262,52 @@ cannot allocate TLS data structures for initial thread");
 	 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)
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index efd8a94c18..c6410804c7 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,11 @@
+2003-05-14  Jakub Jelinek  <jakub@redhat.com>
+
+	* Makefile (crti-objs, crtn-objs): New variables.
+	(omit-deps, extra-objs): Add crtn.
+	($(objpfx)libpthread.so): Depend on both crti and crtn
+	and links to them in multidir.
+	($(objpfx)crtn.S, $(objpfx)crtn.o): New rules.
+
 2003-05-12  Steven Munroe  <sjmunroe@us.ibm.com>
 
 	* sysdeps/unix/sysv/linux/powerpc/lowlevellock.h
diff --git a/nptl/Makefile b/nptl/Makefile
index 4260c7026c..e231c9de08 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -209,8 +209,25 @@ $(objpfx)libpthread_nonshared.a: $(addprefix $(objpfx),$(addsuffix .os,$(libpthr
 	$(AR) $(ARFLAGS) $@ $^
 
 ifeq ($(build-shared),yes)
-extra-objs += crti.o
-omit-deps += crti
+
+# Set the `multidir' variable by grabbing the variable from the compiler.
+# We do it once and save the result in a generated makefile.
+-include $(objpfx)multidir.mk
+$(objpfx)multidir.mk: $(common-objpfx)config.make
+	dir=`$(CC) $(CFLAGS) $(CPPFLAGS) -print-multi-directory`; \
+	echo "multidir := $$dir" > $@T
+	mv -f $@T $@
+
+crti-objs := crti.o
+crtn-objs := crtn.o
+ifneq (,$(patsubst .,,$(multidir)))
+generated-dirs := $(firstword $(subst /, , $(multidir)))
+crti-objs += $(multidir)/crti.o
+crtn-objs += $(multidir)/crtn.o
+omit-deps += $(multidir)/crti $(multidir)/crtn
+endif
+extra-objs += $(crti-objs) $(crtn-objs)
+omit-deps += crti crtn
 
 CFLAGS-pt-initfini.s = -g0 -fPIC -fno-inline-functions
 endif
@@ -292,8 +309,9 @@ $(objpfx)tst-cond11: $(common-objpfx)rt/librt.a
 endif
 
 extra-B-pthread.so = -B$(common-objpfx)nptl/
-$(objpfx)libpthread.so: $(objpfx)crti.o
-$(objpfx)libpthread.so: +preinit += $(objpfx)crti.o
+$(objpfx)libpthread.so: $(addprefix $(objpfx),$(crti-objs) $(crtn-objs))
+$(objpfx)libpthread.so: +preinit += $(addprefix $(objpfx),$(crti-objs))
+$(objpfx)libpthread.so: +postinit += $(addprefix $(objpfx),$(crtn-objs))
 
 # Depend on libc.so so a DT_NEEDED is generated in the shared objects.
 # This ensures they will load libc.so for needed symbols if loaded by
@@ -339,6 +357,10 @@ $(objpfx)crti.S: $(objpfx)pt-initfini.s
 	sed -n -e '1,/@HEADER_ENDS/p' \
 	       -e '/@_.*_PROLOG_BEGINS/,/@_.*_PROLOG_ENDS/p' \
 	       -e '/@TRAILER_BEGINS/,$$p' $< > $@
+$(objpfx)crtn.S: $(objpfx)pt-initfini.s
+	sed -n -e '1,/@HEADER_ENDS/p' \
+	       -e '/@_.*_EPILOG_BEGINS/,/@_.*_EPILOG_ENDS/p' \
+	       -e '/@TRAILER_BEGINS/,$$p' $< > $@
 
 $(objpfx)defs.h: $(objpfx)pt-initfini.s
 	sed -n -e '/@TESTS_BEGIN/,/@TESTS_END/p' $< | \
@@ -347,26 +369,19 @@ $(objpfx)defs.h: $(objpfx)pt-initfini.s
 $(objpfx)crti.o: $(objpfx)crti.S $(objpfx)defs.h
 	$(compile.S) -g0 $(ASFLAGS-.os) -o $@
 
-# Set the `multidir' variable by grabbing the variable from the compiler.
-# We do it once and save the result in a generated makefile.
--include $(objpfx)multidir.mk
-$(objpfx)multidir.mk: $(common-objpfx)config.make
-	dir=`$(CC) $(CFLAGS) $(CPPFLAGS) -print-multi-directory`; \
-	echo "multidir := $$dir" > $@T
-	mv -f $@T $@
-
-generated += crti.S defs.h pt-initfini.s multidir.mk
+$(objpfx)crtn.o: $(objpfx)crtn.S $(objpfx)defs.h
+	$(compile.S) -g0 $(ASFLAGS-.os) -o $@
 
-extra-objs += crti.o
-omit-deps += crti
-ifneq (,$(filter-out .,$(multidir)))
-generated-dirs := $(firstword $(subst /, , $(multidir)))
-extra-objs += $(multidir)/crti.o
-omit-deps += $(multidir)/crti
+ifneq ($(multidir),.)
 $(objpfx)$(multidir)/crti.o: $(objpfx)crti.o $(objpfx)$(multidir)/
 	ln -f $< $@
+
+$(objpfx)$(multidir)/crtn.o: $(objpfx)crtn.o $(objpfx)$(multidir)/
+	ln -f $< $@
 endif
 
+generated += crti.S crtn.S defs.h pt-initfini.s
+
 generated += $(objpfx)tst-atfork2.mtrace \
 	     $(addsuffix .so,$(strip $(modules-names)))