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. d3de4b133c3d2a1aef4c4a839648fcd2e6b52f69


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  d3de4b133c3d2a1aef4c4a839648fcd2e6b52f69 (commit)
       via  a36d8936d00e9944eb376451cc82880477034747 (commit)
       via  04c647cf8a1274dfb9c8e9e80ec5f2e0b1189199 (commit)
       via  5c1b33d5d0d58031068f652d7950c2fd33cca832 (commit)
       via  1b7eaf06179cd7d3e15b35774fe12ff7aba39daa (commit)
      from  a928fd829207e6ad9675ca6a80050517a2f3917f (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=d3de4b133c3d2a1aef4c4a839648fcd2e6b52f69

commit d3de4b133c3d2a1aef4c4a839648fcd2e6b52f69
Author: Roland McGrath <roland@hack.frob.com>
Date:   Tue Mar 31 16:11:53 2015 -0700

    Implement _dl_runtime_profile.

diff --git a/sysdeps/arm/nacl/dl-trampoline.S b/sysdeps/arm/nacl/dl-trampoline.S
index 64389aa..47bc0ca 100644
--- a/sysdeps/arm/nacl/dl-trampoline.S
+++ b/sysdeps/arm/nacl/dl-trampoline.S
@@ -95,8 +95,183 @@ _dl_runtime_resolve:
 _dl_runtime_profile:
 	cfi_startproc
 	cfi_adjust_cfa_offset (8)
-	@ XXX tbd
-	sfi_trap
+
+	@ We get called with:
+	@ 	lr contains the return address from this call
+	@	stack[1] contains &GOT[n+3] (pointer to function)
+	@	stack[0] points to &GOT[2]
+
+	@ Stack layout:
+	@ sp + 204		framesize returned from pltenter
+	@ sp + 12		La_arm_regs
+	@ sp + 4		Saved two arguments to _dl_profile_fixup
+	@ sp + 0		outgoing argument to _dl_profile_fixup
+	@ For now, we only save the general purpose registers.
+# define PLTEXIT_ARGS		4
+# define LA_ARM_REGS		(PLTEXIT_ARGS + 8)
+# define LA_ARM_REGS_SIZE	(4 * (4 + 1 + 1 + 42))
+# define PLTENTER_FRAMESIZE	(LA_ARM_REGS + LA_ARM_REGS_SIZE)
+# define FRAMESIZE		(((PLTENTER_FRAMESIZE + 4) + 15) & -16)
+
+	@ The NaCl ABI requires that sp be aligned to 16 bytes at call
+	@ sites.  Assuming that was met on entry to the PLT, sp is
+	@ now exactly 8 bytes misaligned.
+	sfi_sp sub sp, #(FRAMESIZE - 8)
+	cfi_def_cfa_offset (FRAMESIZE)
+
+	@ Store the argument registers in La_arm_regs.
+	strd r0, r1, [sp, #LA_ARM_REGS]
+	cfi_offset (r0, LA_ARM_REGS + 0)
+	cfi_offset (r1, LA_ARM_REGS + 4)
+	strd r2, r3, [sp, #(LA_ARM_REGS + 8)]
+	cfi_offset (r2, LA_ARM_REGS + 8)
+	cfi_offset (r3, LA_ARM_REGS + 12)
+
+	ldr ip, [sp, #(FRAMESIZE - 8)]		@ ip gets &GOT[2]
+	ldr r3, [sp, #(FRAMESIZE - 4)]		@ r3 gets &GOT[n+3]
+
+	@ Recover the incoming sp and lr and save those in La_arm_regs.
+	add r0, sp, #FRAMESIZE
+	mov r1, lr
+	strd r0, r1, [sp, #(LA_ARM_REGS + 16)]
+	cfi_offset (sp, LA_ARM_REGS + 16)
+	cfi_offset (lr, LA_ARM_REGS + 20)
+
+	@ Get the 'struct link_map *' for the first arg to _dl_profile_fixup.
+	sfi_breg ip, ldr r0, [\B, #-4]
+
+	@ Get the reloc offset for the second argument to _dl_profile_fixup.
+	compute_reloc_arg r3, ip
+
+	@ The third argument is the original return address, still in lr.
+	mov r2, lr
+
+	@ Compute the fourth argument, the La_arm_regs pointer.
+	add r3, sp, #PLTEXIT_ARGS
+
+	@ Compute the fifth argument, the address of the 'framesize'
+	@ out parameter, and store it at the top of the stack.
+	add ip, sp, #PLTENTER_FRAMESIZE
+	str ip, [sp]
+
+	@ Save away the first two arguments, which we will need
+	@ again for _dl_call_pltexit, below.
+	strd r0, r1, [sp, #PLTEXIT_ARGS]
+
+	@ This does the real work, and returns the real call target.
+	sfi_bl _dl_profile_fixup
+
+	@ The address to call is now in r0.
+
+	@ Check whether we're wrapping this function,
+	@ i.e. if the framesize out parameter is >= 0.
+	ldr	ip, [sp, #PLTENTER_FRAMESIZE]
+	cmp	ip, #0
+	bge	1f
+	cfi_remember_state
+
+	@ Save _dl_profile_fixup's return value: the real call target.
+	mov ip, r0
+
+	@ Restore the registers from the La_arm_regs (perhaps as modified
+	@ by audit modules' pltenter functions).
+	add r1, sp, #LA_ARM_REGS
+	sfi_sp sfi_breg r1, ldmia \B, {r0-r3, sp, lr}
+	cfi_def_cfa_offset (0)
+	cfi_restore (r0)
+	cfi_restore (r1)
+	cfi_restore (r2)
+	cfi_restore (r3)
+	cfi_restore (sp)
+	cfi_restore (lr)
+
+	@ Finally, jump to the newfound call target.
+	sfi_bx ip
+
+1:	cfi_restore_state
+	@ The new frame size is in ip.
+
+	@ Save the fp in the stack slot previously used for the fifth
+	@ argument to _dl_profile_fixup.
+	str fp, [sp]
+	cfi_offset (fp, 0)
+
+	@ Save the result of _dl_profile_fixup, the real call target.
+	@ We'll reuse the stack slot just used for the 'framesize'
+	@ out parameter to _dl_profile_fixup.
+	str r0, [sp, #PLTENTER_FRAMESIZE]
+
+	@ Stack layout:
+	@ fp + 264		call target
+	@ fp + 72		La_arm_regs
+	@ fp + 68		Saved two arguments to _dl_profile_fixup
+	@ fp + 64		saved fp
+	@ fp + 0		La_arm_retval
+	@ sp..fp		copied incoming stack space (plus alignment)
+	@ For now, we only save the general purpose registers.
+# define FP_LA_ARM_RETVAL	0
+# define LA_ARM_RETVAL_SIZE	(4 * (4 + 12))
+# define FP_SAVED_FP		LA_ARM_RETVAL_SIZE
+# define FP_PLTEXIT_ARGS	(FP_SAVED_FP + 4)
+# define FP_LA_ARM_REGS		(FP_PLTEXIT_ARGS + 8)
+# define FP_CALL_TARGET		(FP_LA_ARM_REGS + LA_ARM_REGS_SIZE)
+# define FP_FRAMESIZE		(FP_CALL_TARGET + 4)
+
+	sub fp, sp, #(FP_FRAMESIZE - FRAMESIZE)
+	cfi_def_cfa (fp, FP_FRAMESIZE)
+
+	sub r1, fp, ip
+	@ This doesn't need sfi_sp because we just include the
+	@ sandboxing mask along with the alignment mask.
+	bic sp, r1, #0xc000000f
+
+	@ Copy the stack arguments.  The audit modules' pltenter
+	@ function(s) decided how much needs to be copied.
+	@ Load the sp as modified by pltenter functions, rather
+	@ than what we think the incoming sp was (fp + FP_FRAMESIZE).
+	sfi_breg fp, ldr r1, [\B, #(FP_LA_ARM_REGS + 16)]
+	mov r0, sp
+	mov r2, ip
+	sfi_bl memcpy
+
+	@ Load up the arguments from La_arm_regs and call the user's function.
+	sfi_breg fp, ldr ip, [\B, #FP_CALL_TARGET]
+	sfi_breg fp, ldrd r0, r1, [\B, #FP_LA_ARM_REGS]
+	sfi_breg fp, ldrd r2, r3, [\B, #(FP_LA_ARM_REGS + 8)]
+	sfi_blx ip
+
+	@ Stash the return value registers in La_arm_retval.
+	sfi_breg fp, strd r0, r1, [\B, #FP_LA_ARM_RETVAL]
+	sfi_breg fp, strd r2, r3, [\B, #(FP_LA_ARM_RETVAL + 8)]
+
+	@ Call pltexit.  We saved the first two arguments earlier--they
+	@ are the same ones passed to _dl_profile_fixup.  The latter two
+	@ arguments are La_arm_regs and La_arm_retval blocks, respectively.
+	sfi_breg fp, ldrd r0, r1, [\B, #FP_PLTEXIT_ARGS]
+	add r2, fp, #FP_LA_ARM_REGS
+	add r3, fp, #FP_LA_ARM_RETVAL
+	sfi_bl _dl_call_pltexit
+
+	@ Reload the saved return value registers for the caller.
+	sfi_breg fp, ldrd r0, r1, [\B, #FP_LA_ARM_RETVAL]
+	sfi_breg fp, ldrd r2, r3, [\B, #(FP_LA_ARM_RETVAL + 8)]
+
+	@ Unwind the frame.
+	sfi_sp mov sp, fp
+	cfi_def_cfa_register (sp)
+	ldr fp, [sp, #FP_SAVED_FP]
+	cfi_restore (fp)
+	@ Reload the lr and sp values from La_arm_regs, where they
+	@ might have been modified by pltenter functions, rather than
+	@ computing what we think the incoming value was.
+	ldr lr, [sp, #(FP_LA_ARM_REGS + 20)]
+	cfi_restore (lr)
+	sfi_sp ldr sp, [sp, #(FP_LA_ARM_REGS + 16)]
+	cfi_def_cfa_offset (0)
+
+	@ Finally, return to the caller.
+	sfi_bx lr
+
 	cfi_endproc
 	.size _dl_runtime_profile, .-_dl_runtime_profile
 #endif

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

commit a36d8936d00e9944eb376451cc82880477034747
Author: Roland McGrath <roland@hack.frob.com>
Date:   Tue Mar 31 11:08:08 2015 -0700

    Make fdopen work.

diff --git a/sysdeps/nacl/iofdopen.c b/sysdeps/nacl/iofdopen.c
new file mode 100644
index 0000000..fd5271f
--- /dev/null
+++ b/sysdeps/nacl/iofdopen.c
@@ -0,0 +1,26 @@
+/* Open a stream from a file descriptor.  NaCl version.
+   Copyright (C) 2015 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/>.  */
+
+#include <fcntl.h>
+
+/* NaCl does not have a functioning fcntl, so don't use the stub and fail.  */
+#undef  F_GETFL
+#undef  F_SETFL
+#define __fcntl(...)    ???should not be called???
+
+#include <libio/iofdopen.c>

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=04c647cf8a1274dfb9c8e9e80ec5f2e0b1189199

commit 04c647cf8a1274dfb9c8e9e80ec5f2e0b1189199
Author: Roland McGrath <roland@hack.frob.com>
Date:   Thu Mar 19 15:25:53 2015 -0700

    (__get_nprocs_conf): Comment typo fix.

diff --git a/sysdeps/nacl/getsysstats.c b/sysdeps/nacl/getsysstats.c
index c9c8a19..97a2edb 100644
--- a/sysdeps/nacl/getsysstats.c
+++ b/sysdeps/nacl/getsysstats.c
@@ -29,7 +29,7 @@ __get_nprocs_conf (void)
 {
   int nprocs;
   if (__nacl_irt_basic.sysconf (NACL_ABI__SC_NPROCESSORS_ONLN, &nprocs) != 0)
-    /* On failure (which should be impossible). just report one processor.  */
+    /* On failure (which should be impossible), just report one processor.  */
     nprocs = 1;
   return nprocs;
 }

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=5c1b33d5d0d58031068f652d7950c2fd33cca832

commit 5c1b33d5d0d58031068f652d7950c2fd33cca832
Author: Roland McGrath <roland@hack.frob.com>
Date:   Thu Mar 19 15:25:23 2015 -0700

    Rewritten.

diff --git a/sysdeps/nacl/dl-unmap-segments.h b/sysdeps/nacl/dl-unmap-segments.h
index f1043ee..02851e7 100644
--- a/sysdeps/nacl/dl-unmap-segments.h
+++ b/sysdeps/nacl/dl-unmap-segments.h
@@ -22,36 +22,44 @@
 #include <link.h>
 #include <sys/mman.h>
 
-/* There is always a big gap between the executable segment and the
-   data segments.  Other code segments and data pages lie in there.
-   So we must unmap each segment individually.  */
+/* There is always a big gap between the executable segment and the data
+   segments.  Other code segments and data pages lie in there.  So we must
+   unmap each segment individually (except for a codeless module).  */
 
 static void __always_inline
 _dl_unmap_segments (struct link_map *l)
 {
-  /* Normally l_phdr points into the RODATA segment, which we will unmap in
-     one iteration of the loop.  So we cannot use it directly throughout.  */
-
-  struct { void *start; size_t size; } segments[l->l_phnum], *seg = segments;
-
-  for (const ElfW(Phdr) *ph = l->l_phdr; ph < &l->l_phdr[l->l_phnum]; ++ph)
-    if (ph->p_type == PT_LOAD)
-      {
-        seg->start = (void *) (l->l_addr + ph->p_vaddr);
-        seg->size = l->l_map_end - l->l_map_start;
-        if (seg > segments && seg[-1].start + seg[-1].size == seg->start)
-          /* Coalesce two adjacent segments into one munmap call.  */
-          seg[-1].size += seg->size;
-        else
-          ++seg;
-      }
-
-  do
+  if (l->l_contiguous)
+    /* Simple case.  */
+    __munmap ((void *) l->l_map_start, l->l_map_end - l->l_map_start);
+  else
     {
-      --seg;
-      __munmap (seg->start, seg->size);
+      /* Normally l_phdr points into the RODATA segment, which we will
+         unmap in one iteration of the loop.  So we cannot use it directly
+         throughout.  */
+
+      struct { ElfW(Addr) start, end; } segments[l->l_phnum], *seg = segments;
+
+      for (const ElfW(Phdr) *ph = l->l_phdr; ph < &l->l_phdr[l->l_phnum]; ++ph)
+        if (ph->p_type == PT_LOAD)
+          {
+            seg->start = (l->l_addr + ph->p_vaddr) & -GLRO(dl_pagesize);
+            seg->end = (l->l_addr + ph->p_vaddr + ph->p_memsz
+                        + GLRO(dl_pagesize) - 1) & -GLRO(dl_pagesize);
+            if (seg > segments && seg[-1].end == seg->start)
+              /* Coalesce two adjacent segments into one munmap call.  */
+              seg[-1].end = seg->end;
+            else
+              ++seg;
+          }
+
+      do
+        {
+          --seg;
+          __munmap ((void *) seg->start, seg->end - seg->start);
+        }
+      while (seg > segments);
     }
-  while (seg > segments);
 }
 
 #endif  /* dl-unmap-segments.h */

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=1b7eaf06179cd7d3e15b35774fe12ff7aba39daa

commit 1b7eaf06179cd7d3e15b35774fe12ff7aba39daa
Author: Roland McGrath <roland@hack.frob.com>
Date:   Thu Mar 19 15:25:05 2015 -0700

    Disable tlsdesc stuff.

diff --git a/sysdeps/arm/nacl/Makefile b/sysdeps/arm/nacl/Makefile
index afe2733..5e56895 100644
--- a/sysdeps/arm/nacl/Makefile
+++ b/sysdeps/arm/nacl/Makefile
@@ -1,5 +1,5 @@
-# XXX temporary until the compiler build can be fixed
-sysdep-CPPFLAGS += -D__ARM_NEON__=1
+# We don't really support TLSDESC, even though the compiler thinks it does.
+have-arm-tls-desc = no
 
 ifeq ($(subdir),csu)
 sysdep_routines += aeabi_read_tp

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

Summary of changes:
 sysdeps/arm/nacl/Makefile                 |    4 +-
 sysdeps/arm/nacl/dl-trampoline.S          |  179 ++++++++++++++++++++++++++++-
 sysdeps/nacl/dl-unmap-segments.h          |   56 +++++----
 sysdeps/nacl/getsysstats.c                |    2 +-
 sysdeps/nacl/{init-first.c => iofdopen.c} |   15 +--
 5 files changed, 219 insertions(+), 37 deletions(-)
 copy sysdeps/nacl/{init-first.c => iofdopen.c} (74%)


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]