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 roland/nacl-debug-hack created. glibc-2.21-498-gae9ef4d


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, roland/nacl-debug-hack has been created
        at  ae9ef4d35e21370a5bc7d281fa85a5cec250b8c0 (commit)

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=ae9ef4d35e21370a5bc7d281fa85a5cec250b8c0

commit ae9ef4d35e21370a5bc7d281fa85a5cec250b8c0
Author: Roland McGrath <roland@hack.frob.com>
Date:   Wed Jun 17 11:29:47 2015 -0700

    foo

diff --git a/elf/dl-debug.c b/elf/dl-debug.c
index e32a5a6..b89ea4d 100644
--- a/elf/dl-debug.c
+++ b/elf/dl-debug.c
@@ -72,5 +72,8 @@ _dl_debug_initialize (ElfW(Addr) ldbase, Lmid_t ns)
 void
 _dl_debug_state (void)
 {
+#ifdef DL_DEBUG_STATE
+  DL_DEBUG_STATE;
+#endif
 }
 rtld_hidden_def (_dl_debug_state)
diff --git a/sysdeps/nacl/dl-sysdep.c b/sysdeps/nacl/dl-sysdep.c
index 3e902c2..82d122f 100644
--- a/sysdeps/nacl/dl-sysdep.c
+++ b/sysdeps/nacl/dl-sysdep.c
@@ -44,6 +44,33 @@
 
 # define DL_STACK_END(cookie)	(((void **) (cookie))[1])
 
+# define DL_PLATFORM_AUXV \
+  case AT_SYSINFO_EHDR: handle_sysinfo_ehdr ((void *) av->a_un.a_val);
+
+void (*__nacl_extra_r_brk) (void) attribute_hidden;
+
+static void
+handle_sysinfo_ehdr (const void *loader_ehdr)
+{
+  const ElfW(Ehdr) *ehdr = loader_ehdr;
+  const ElfW(Phdr) *phdr = loader_ehdr + ehdr->e_phoff;
+  for (uint_fast16_t i = 0; i < ehdr->e_phnum; ++i)
+    if (phdr[i].p_type == PT_DYNAMIC)
+      {
+        ElfW(Dyn) *end = (void *) (phdr[i].p_vaddr + phdr[i].p_memsz);
+	for (ElfW(Dyn) *d = (void *) phdr[i].p_vaddr; d < end; ++d)
+	  if (d->d_tag == DT_DEBUG)
+	    {
+	      const struct r_debug *r = (void *) d->d_un.d_ptr;
+	      if (r != NULL)
+		__nacl_extra_r_brk = (void (*) (void)) r->r_brk;
+              d->d_un.d_ptr = (ElfW(Addr)) &_r_debug;
+	      break;
+	    }
+	break;
+      }
+}
+
 /* This is called from the entry point (_start), defined by the RTLD_START
    macro in the machine-specific dl-machine.h file.  At this point, dynamic
    linking has been completed and the first argument is the application's
diff --git a/sysdeps/nacl/glob.c b/sysdeps/nacl/glob.c
index 36d62e8..eda6e9e 100644
--- a/sysdeps/nacl/glob.c
+++ b/sysdeps/nacl/glob.c
@@ -16,11 +16,11 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <unistd.h>			/* Declares getlogin_r.  */
+#include <unistd.h>			/* Declares __getlogin_r.  */
 
 /* We do not have getlogin_r in the library at all for NaCl.
    Define it away so the glob code does not try to use it.  */
-#define getlogin_r(name, len)		(ENOSYS)
+#define __getlogin_r(name, len)		(ENOSYS)
 
 /* Fetch the version that defines glob64 as an alias.  */
 #include <sysdeps/wordsize-64/glob.c>
diff --git a/sysdeps/nacl/ldsodefs.h b/sysdeps/nacl/ldsodefs.h
index 383ced5..d8c1552 100644
--- a/sysdeps/nacl/ldsodefs.h
+++ b/sysdeps/nacl/ldsodefs.h
@@ -32,4 +32,11 @@ extern void _dl_aux_init (ElfW(auxv_t) *av) internal_function;
 /* Initialization which is normally done by the dynamic linker.  */
 extern void _dl_non_dynamic_init (void) internal_function;
 
+#ifdef SHARED
+extern void (*__nacl_extra_r_brk) (void) attribute_hidden;
+# define DL_DEBUG_STATE \
+  if (__nacl_extra_r_brk != NULL) \
+    (*__nacl_extra_r_brk) ();
+#endif
+
 #endif  /* ldsodefs.h */

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


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]