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-port/master updated. 64dbb4e1c1f83872bfea14c3ce2dbe2d8ed30289


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-port/master has been updated
       via  64dbb4e1c1f83872bfea14c3ce2dbe2d8ed30289 (commit)
      from  470984353c80445e12c6a0a16eb040d0b378600f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

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

commit 64dbb4e1c1f83872bfea14c3ce2dbe2d8ed30289
Author: Roland McGrath <roland@hack.frob.com>
Date:   Tue May 7 14:51:54 2013 -0700

    Part way to rtld startup.

diff --git a/sysdeps/arm/nacl/dl-machine.h b/sysdeps/arm/nacl/dl-machine.h
index aa9202f..97a06f4 100644
--- a/sysdeps/arm/nacl/dl-machine.h
+++ b/sysdeps/arm/nacl/dl-machine.h
@@ -20,7 +20,7 @@
 
 /* This is only needed for handling TEXTRELs and NaCl will never
    support TEXTRELs at all.  */
-#define CLEAR_CACHE(start, end) abort ()
+#define CLEAR_CACHE(start, end) __builtin_trap ()
 
 #endif
 
@@ -28,3 +28,25 @@
    This #include is outside the #ifndef because the parts of
    dl-machine.h used only by dynamic-link.h are outside the guard.  */
 #include <sysdeps/arm/dl-machine.h>
+
+#ifdef dl_machine_h
+
+/* Initial entry point code for the dynamic linker.
+   The C function `_dl_start' is the real entry point;
+   its return value is the user program's entry point.  */
+#undef RTLD_START
+#define RTLD_START asm ("\
+.text\n\
+.globl _start\n\
+.type _start, %function\n\
+_start:\n\
+        @ r0 has the pointer to the info block (see nacl_startup.h)\n\
+        mov r1, sp              @ Save stack base for __libc_stack_end.\n\
+        push {r0-r3}            @ Push those, maintaining alignment to 16.\n\
+        mov r0, sp              @ Pointer to {info, sp} is argument.\n\
+        sfi_bl _dl_start\n\
+        pop {r1-r4}             @ Restore stack, getting info block into r1.\n\
+        mov lr, #0              @ Return address for noreturn call.\n\
+        b _dl_start_user");
+
+#endif
diff --git a/sysdeps/nacl/dl-osinfo.h b/sysdeps/nacl/dl-osinfo.h
index 505eb4b..0aacf4e 100644
--- a/sysdeps/nacl/dl-osinfo.h
+++ b/sysdeps/nacl/dl-osinfo.h
@@ -23,11 +23,12 @@
 
 #include "nacl-interfaces.h"
 
+#ifndef SHARED
 /* This doesn't really have anything to do with the purpose for
    which this macro is used in Linux configurations.  But it is
    called at the right place in __libc_start_main.  */
-
-#define DL_SYSDEP_OSCHECK(fatal)        __nacl_initialize_interfaces ()
+# define DL_SYSDEP_OSCHECK(fatal)	__nacl_initialize_interfaces ()
+#endif
 
 
 #endif /* dl-osinfo.h */
diff --git a/sysdeps/nacl/dl-sysdep.c b/sysdeps/nacl/dl-sysdep.c
new file mode 100644
index 0000000..7e6a092
--- /dev/null
+++ b/sysdeps/nacl/dl-sysdep.c
@@ -0,0 +1,83 @@
+/* Operating system support for run-time dynamic linker.  NaCl version.
+   Copyright (C) 2013 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifdef SHARED
+
+#include <assert.h>
+#include <ldsodefs.h>
+#include <stdint.h>
+
+/* NaCl's elf32.h is incompatible with the real <elf.h>.  */
+#define NATIVE_CLIENT_SRC_INCLUDE_ELF32_H_
+#include <native_client/src/untrusted/nacl/nacl_startup.h>
+
+/* The RTLD_START code sets up the pointer that gets to these
+   macros as COOKIE to point to two words:
+   [0] the argument to the entry point from the system (see nacl_startup.h)
+   [1] the stack base
+*/
+
+#define DL_FIND_ARG_COMPONENTS(cookie, argc, argv, envp, auxp)	\
+  do {								\
+    uint32_t *_info = ((void **) (cookie))[0];			\
+    (argc) = nacl_startup_argc (_info);				\
+    (argv) = nacl_startup_argv (_info);				\
+    (envp) = nacl_startup_envp (_info);				\
+    (auxp) = nacl_startup_auxv (_info);				\
+  } while (0)
+
+#define DL_STACK_END(cookie)	(((void **) (cookie))[1])
+
+/* 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
+   entry point.  */
+attribute_hidden internal_function
+void
+_dl_start_user (void (*user_entry) (uint32_t info[]), uint32_t info[])
+{
+  if (_dl_skip_args > 0)
+    {
+      /* There are some arguments that the user program should not see.
+         Just slide up the INFO pointer so its NACL_STARTUP_ARGV points
+         to what should now be argv[0], and copy back the earlier fields.  */
+      assert (nacl_startup_argc (info) >= _dl_skip_args);
+      assert (NACL_STARTUP_ARGV == 3);
+      uint32_t envc = info[NACL_STARTUP_ENVC];
+      uint32_t argc = info[NACL_STARTUP_ARGC];
+      info += _dl_skip_args;
+      info[NACL_STARTUP_ENVC] = envc;
+      info[NACL_STARTUP_ARGC] = argc - _dl_skip_args;
+    }
+
+  /* Pass our finalizer function to the user.  */
+  info[NACL_STARTUP_FINI] = (uintptr_t) &_dl_fini;
+
+  /* Run initializers.  */
+  _dl_init (GL(dl_ns)[0]._ns_loaded,
+            nacl_startup_argc (info),
+            nacl_startup_argv (info),
+            nacl_startup_envp (info));
+
+  /* Call the user's entry point.  This should never return.  */
+  (*user_entry) (info);
+}
+
+#endif  /* SHARED */
+
+#include <elf/dl-sysdep.c>
diff --git a/sysdeps/nacl/dl-sysdep.h b/sysdeps/nacl/dl-sysdep.h
index 19c23cb..86813dd 100644
--- a/sysdeps/nacl/dl-sysdep.h
+++ b/sysdeps/nacl/dl-sysdep.h
@@ -25,3 +25,6 @@
    but we too want to store its value.  */
 #define NEED_DL_SYSINFO         1
 #define DL_SYSINFO_DEFAULT      0
+
+/* sysdeps/arm/dl-sysdep.h defines this but it does not apply to NaCl.  */
+#undef  DL_ARGV_NOT_RELRO
diff --git a/sysdeps/nacl/entry.h b/sysdeps/nacl/entry.h
new file mode 100644
index 0000000..e9dc190
--- /dev/null
+++ b/sysdeps/nacl/entry.h
@@ -0,0 +1,6 @@
+#ifndef __ASSEMBLY__
+# include <stdint.h>
+extern void _start (uint32_t info[]) attribute_hidden;
+#endif
+
+#define ENTRY_POINT _start

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

Summary of changes:
 sysdeps/arm/nacl/dl-machine.h |   24 +++++++++++-
 sysdeps/nacl/dl-osinfo.h      |    5 +-
 sysdeps/nacl/dl-sysdep.c      |   83 +++++++++++++++++++++++++++++++++++++++++
 sysdeps/nacl/dl-sysdep.h      |    3 +
 sysdeps/nacl/entry.h          |    6 +++
 5 files changed, 118 insertions(+), 3 deletions(-)
 create mode 100644 sysdeps/nacl/dl-sysdep.c
 create mode 100644 sysdeps/nacl/entry.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]