This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch hjl/pr14557/master created. glibc-2.16-ports-merge-393-ga0d6e03


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, hjl/pr14557/master has been created
        at  a0d6e038079349d958e43517382147c82e6f3d05 (commit)

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=a0d6e038079349d958e43517382147c82e6f3d05

commit a0d6e038079349d958e43517382147c82e6f3d05
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Sep 19 17:25:34 2012 -0700

    Add dl_sysinfo_dso support to static dl_iterate_phdr

diff --git a/ChangeLog.pr14557 b/ChangeLog.pr14557
new file mode 100644
index 0000000..95320c4
--- /dev/null
+++ b/ChangeLog.pr14557
@@ -0,0 +1,9 @@
+2012-09-27  H.J. Lu  <hongjiu.lu@intel.com>
+
+	[BZ #14557]
+	* elf/dl-iteratephdr.c (__dl_iterate_phdr): Use
+	_dl_sysinfo_dso_phdr_info in libc.a if needed.
+	* elf/dl-support.c: Include <assert.h>.
+	(_dl_sysinfo_dso_phdr_info): New.
+	(_dl_aux_init): Initialize _dl_sysinfo_dso_phdr_info in libc.a
+	if needed.
diff --git a/elf/dl-iteratephdr.c b/elf/dl-iteratephdr.c
index 95c2afd..94ba02a 100644
--- a/elf/dl-iteratephdr.c
+++ b/elf/dl-iteratephdr.c
@@ -78,6 +78,15 @@ __dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info,
 	break;
     }
 
+#if !defined SHARED && (defined NEED_DL_SYSINFO || defined NEED_DL_SYSINFO_DSO)
+  if (!ret && GLRO(dl_sysinfo_dso))
+    {
+      extern struct dl_phdr_info _dl_sysinfo_dso_phdr_info;
+      ret = callback (&_dl_sysinfo_dso_phdr_info,
+		      sizeof (struct dl_phdr_info), data);
+    }
+#endif
+
   /* Release the lock.  */
   __libc_cleanup_pop (0);
   __rtld_lock_unlock_recursive (GL(dl_load_write_lock));
diff --git a/elf/dl-support.c b/elf/dl-support.c
index 2bb468a..558e687 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -33,6 +33,7 @@
 #include <unsecvars.h>
 #include <hp-timing.h>
 #include <stackinfo.h>
+#include <assert.h>
 
 extern char *__progname;
 char **_dl_argv = &__progname;	/* This is checked for some error messages.  */
@@ -161,6 +162,7 @@ uintptr_t _dl_sysinfo = DL_SYSINFO_DEFAULT;
 #if defined NEED_DL_SYSINFO || defined NEED_DL_SYSINFO_DSO
 /* Address of the ELF headers in the vsyscall page.  */
 const ElfW(Ehdr) *_dl_sysinfo_dso;
+struct dl_phdr_info _dl_sysinfo_dso_phdr_info;
 #endif
 
 /* During the program run we must not modify the global data of
@@ -250,6 +252,29 @@ _dl_aux_init (ElfW(auxv_t) *av)
       __libc_enable_secure = uid != 0 || gid != 0;
       __libc_enable_secure_decided = 1;
     }
+# if !defined SHARED && (defined NEED_DL_SYSINFO || defined NEED_DL_SYSINFO_DSO)
+  /* Set up the dl_phdr_info structure for the system-supplied virtual DSO.  */
+  const ElfW(Ehdr) *const ehdr = GLRO(dl_sysinfo_dso);
+  if (ehdr != NULL)
+    {
+      /* GLRO(dl_sysinfo_dso) points to the virtual DSO ELF header.  */
+      const ElfW(Phdr) *const phdr = (const void *) ehdr + ehdr->e_phoff;
+      _dl_sysinfo_dso_phdr_info.dlpi_phdr = phdr;
+      _dl_sysinfo_dso_phdr_info.dlpi_phnum = ehdr->e_phnum;
+      for (uint_fast16_t i = 0; i < ehdr->e_phnum; ++i)
+	{
+	  const ElfW(Phdr) *const ph = &phdr[i];
+	  /* Compute the base address from the PT_LOAD segment.  */
+	  if (ph->p_type == PT_LOAD)
+	    {
+	      assert (ph->p_offset == 0);
+	      _dl_sysinfo_dso_phdr_info.dlpi_addr
+		= (ElfW(Addr)) ehdr - ph->p_vaddr;
+	      break;
+	    }
+	}
+    }
+# endif
 }
 #endif
 
diff --git a/nptl/ChangeLog.pr14557 b/nptl/ChangeLog.pr14557
new file mode 100644
index 0000000..f786716
--- /dev/null
+++ b/nptl/ChangeLog.pr14557
@@ -0,0 +1,14 @@
+2012-09-25  H.J. Lu  <hongjiu.lu@intel.com>
+
+	[BZ #14557]
+	* Makefile (tests-static): Add tst-cancel24-static
+	tst-cond8-static tst-mutex8-static tst-mutexpi8-static
+	tst-sem11-static tst-sem12-static.
+	(tests): Likewise.
+	(LDLIBS-tst-cancel24-static): New macro.
+	* tst-cancel24-static.cc: New file.
+	* tst-cond8-static.c: Likewise.
+	* tst-mutex8-static.c: Likewise.
+	* tst-mutexpi8-static.c: Likewise.
+	* tst-sem11-static.c: Likewise.
+	* tst-sem12-static.c: Likewise.
diff --git a/nptl/Makefile b/nptl/Makefile
index b081b07..c483ffc 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -349,8 +349,12 @@ link-libc-static := $(common-objpfx)libc.a $(static-gnulib) \
 		    $(common-objpfx)libc.a
 
 tests-static += tst-locale1 tst-locale2 tst-stackguard1-static \
-		tst-cancel21-static
-tests += tst-stackguard1-static tst-cancel21-static
+		tst-cancel21-static tst-cancel24-static tst-cond8-static \
+		tst-mutex8-static tst-mutexpi8-static tst-sem11-static \
+		tst-sem12-static
+tests += tst-stackguard1-static tst-cancel21-static tst-cancel24-static \
+	 tst-cond8-static tst-mutex8-static tst-mutexpi8-static \
+	 tst-sem11-static tst-sem12-static
 xtests-static += tst-setuid1-static
 
 # These tests are linked with libc before libpthread
@@ -508,6 +512,7 @@ $(objpfx)tst-rwlock14: $(common-objpfx)rt/librt.a
 endif
 
 LDLIBS-tst-cancel24 = $(no-as-needed) -lstdc++
+LDLIBS-tst-cancel24-static = $(no-as-needed) -lstdc++
 
 extra-B-pthread.so = -B$(common-objpfx)nptl/
 $(objpfx)libpthread.so: $(addprefix $(objpfx),$(crti-objs) $(crtn-objs))
diff --git a/nptl/tst-cancel24-static.cc b/nptl/tst-cancel24-static.cc
new file mode 100644
index 0000000..3f97de5
--- /dev/null
+++ b/nptl/tst-cancel24-static.cc
@@ -0,0 +1 @@
+#include "tst-cancel24.cc"
diff --git a/nptl/tst-cond8-static.c b/nptl/tst-cond8-static.c
new file mode 100644
index 0000000..fed35db
--- /dev/null
+++ b/nptl/tst-cond8-static.c
@@ -0,0 +1 @@
+#include "tst-cond8.c"
diff --git a/nptl/tst-mutex8-static.c b/nptl/tst-mutex8-static.c
new file mode 100644
index 0000000..d69ed49
--- /dev/null
+++ b/nptl/tst-mutex8-static.c
@@ -0,0 +1 @@
+#include "tst-mutex8.c"
diff --git a/nptl/tst-mutexpi8-static.c b/nptl/tst-mutexpi8-static.c
new file mode 100644
index 0000000..869e6df
--- /dev/null
+++ b/nptl/tst-mutexpi8-static.c
@@ -0,0 +1 @@
+#include "tst-mutexpi8.c"
diff --git a/nptl/tst-sem11-static.c b/nptl/tst-sem11-static.c
new file mode 100644
index 0000000..09b7698
--- /dev/null
+++ b/nptl/tst-sem11-static.c
@@ -0,0 +1 @@
+#include "tst-sem11.c"
diff --git a/nptl/tst-sem12-static.c b/nptl/tst-sem12-static.c
new file mode 100644
index 0000000..c06349f
--- /dev/null
+++ b/nptl/tst-sem12-static.c
@@ -0,0 +1 @@
+#include "tst-sem12.c"

-----------------------------------------------------------------------


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]