This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch hjl/pr14557 created. glibc-2.16-ports-merge-344-g55de85c
- From: hjl at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 20 Sep 2012 00:27:58 -0000
- Subject: GNU C Library master sources branch hjl/pr14557 created. glibc-2.16-ports-merge-344-g55de85c
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 has been created
at 55de85c4fe02215a63bf6df1e06c34e00d2f5524 (commit)
- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=55de85c4fe02215a63bf6df1e06c34e00d2f5524
commit 55de85c4fe02215a63bf6df1e06c34e00d2f5524
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/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/Makefile b/nptl/Makefile
index 6f2b66c..9842bee 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