diff --git a/ap/libc/glibc/glibc-2.23/gmon/Makefile b/ap/libc/glibc/glibc-2.23/gmon/Makefile
new file mode 100644
index 0000000..abb96d7
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.23/gmon/Makefile
@@ -0,0 +1,55 @@
+# Copyright (C) 1995-2016 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/>.
+
+#
+#	Sub-makefile for gmon portion of the library.
+#
+subdir	:= gmon
+
+include ../Makeconfig
+
+headers	:= sys/gmon.h sys/gmon_out.h sys/profil.h
+routines := gmon mcount profil sprofil bb_init_func bb_exit_func prof-freq
+
+elide-routines.os = bb_init_func bb_exit_func
+
+tests	= tst-sprofil
+ifeq ($(build-profile),yes)
+tests	+= tst-profile-static
+tests-static	+= tst-profile-static
+
+LDFLAGS-tst-profile-static = -profile
+endif
+
+# The mcount code won't work without a frame pointer.
+CFLAGS-mcount.c := -fno-omit-frame-pointer
+
+include ../Rules
+
+# We cannot compile mcount.c with -pg because that would
+# create recursive calls.  Just copy the normal static object.
+# On systems where `profil' is not a system call, the same
+# problem exists for the internal functions in profil.c.
+
+noprof := mcount
+ifeq (,$(filter profil,$(unix-syscalls)))
+noprof += profil sprofil
+endif
+
+$(noprof:%=$(objpfx)%.op): %.op: %.o
+	rm -f $@
+	ln $< $@
diff --git a/ap/libc/glibc/glibc-2.23/gmon/Versions b/ap/libc/glibc/glibc-2.23/gmon/Versions
new file mode 100644
index 0000000..d0b6333
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.23/gmon/Versions
@@ -0,0 +1,22 @@
+libc {
+  GLIBC_2.0 {
+    # functions with special/multiple interfaces
+    _mcount;
+
+    # Profiling support
+    __monstartup; _mcleanup; __profile_frequency;
+
+    # m*
+    monstartup;
+
+    # p*
+    profil; profil_counter;
+  }
+  GLIBC_2.2 {
+    # m*
+    moncontrol;
+  }
+  GLIBC_2.2.3 {
+    sprofil;
+  }
+}
diff --git a/ap/libc/glibc/glibc-2.23/gmon/bb_exit_func.c b/ap/libc/glibc/glibc-2.23/gmon/bb_exit_func.c
new file mode 100644
index 0000000..d9c91bc
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.23/gmon/bb_exit_func.c
@@ -0,0 +1,74 @@
+/* Copyright (C) 1996-2016 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by David Mosberger (davidm@cs.arizona.edu).
+
+   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/>.  */
+
+/* __bb_exit_func() dumps all the basic-block statistics linked into
+   the __bb_head chain to .d files.  */
+
+#include <sys/gmon.h>
+#include <sys/gmon_out.h>
+#include <sys/types.h>
+
+#include <stdio.h>
+#include <stdio_ext.h>
+#include <string.h>
+
+#define OUT_NAME	"gmon.out"
+
+
+extern struct __bb *__bb_head attribute_hidden;
+
+
+void
+__bb_exit_func (void)
+{
+  const int version = GMON_VERSION;
+  struct gmon_hdr ghdr;
+  struct __bb *ptr;
+  FILE *fp;
+  fp = fopen (OUT_NAME, "wb");
+  if (!fp)
+    {
+      perror (OUT_NAME);
+      return;
+    }
+  /* No threads use this stream.  */
+  __fsetlocking (fp, FSETLOCKING_BYCALLER);
+
+  memcpy (&ghdr.cookie[0], GMON_MAGIC, 4);
+  memcpy (&ghdr.version, &version, sizeof (version));
+  fwrite_unlocked (&ghdr, sizeof (ghdr), 1, fp);
+
+  for (ptr = __bb_head; ptr != 0; ptr = ptr->next)
+    {
+      u_int ncounts = ptr->ncounts;
+      u_char tag;
+      u_int i;
+
+      tag = GMON_TAG_BB_COUNT;
+      fwrite_unlocked (&tag, sizeof (tag), 1, fp);
+      fwrite_unlocked (&ncounts, sizeof (ncounts), 1, fp);
+
+      for (i = 0; i < ncounts; ++i)
+	{
+	  fwrite_unlocked (&ptr->addresses[i], sizeof (ptr->addresses[0]), 1,
+			   fp);
+	  fwrite_unlocked (&ptr->counts[i], sizeof (ptr->counts[0]), 1, fp);
+	}
+    }
+  fclose (fp);
+}
diff --git a/ap/libc/glibc/glibc-2.23/gmon/bb_init_func.c b/ap/libc/glibc/glibc-2.23/gmon/bb_init_func.c
new file mode 100644
index 0000000..c635da7
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.23/gmon/bb_init_func.c
@@ -0,0 +1,53 @@
+/* Copyright (C) 1996-2016 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by David Mosberger (davidm@cs.arizona.edu).
+
+   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/>.  */
+
+/* __bb_init_func is invoked at the beginning of each function, before
+   any registers have been saved.  This generic routine should work
+   provided that calling this function doesn't mangle the arguments
+   passed to the function being called.  If that's not the case, a
+   system specific routine must be provided.  */
+
+#include <sys/types.h>
+#include <sys/gmon.h>
+
+#include <stdlib.h>
+
+void
+__bb_init_func (struct __bb *bb)
+{
+  struct gmonparam *p = &_gmonparam;
+
+  if (bb->zero_word != 0)
+    {
+      return;	/* handle common case quickly */
+    }
+
+  /* insert this basic-block into basic-block list: */
+  bb->zero_word = 1;
+  bb->next = __bb_head;
+  __bb_head = bb;
+
+  if (bb->next == 0 && p->state != GMON_PROF_ON)
+    {
+      /* we didn't register _mcleanup yet and pc profiling doesn't seem
+	 to be active, so let's register it now: */
+      extern void *__dso_handle __attribute__ ((__weak__));
+      __cxa_atexit ((void (*) (void *)) _mcleanup, NULL,
+		    &__dso_handle ? __dso_handle : NULL);
+    }
+}
diff --git a/ap/libc/glibc/glibc-2.23/gmon/gmon.c b/ap/libc/glibc/glibc-2.23/gmon/gmon.c
new file mode 100644
index 0000000..e9988c0
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.23/gmon/gmon.c
@@ -0,0 +1,426 @@
+/*-
+ * Copyright (c) 1983, 1992, 1993, 2011
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/gmon.h>
+#include <sys/gmon_out.h>
+#include <sys/uio.h>
+
+#include <errno.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <wchar.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stddef.h>
+#include <unistd.h>
+#include <libc-internal.h>
+#include <not-cancel.h>
+
+
+/*  Head of basic-block list or NULL. */
+struct __bb *__bb_head attribute_hidden;
+
+struct gmonparam _gmonparam attribute_hidden = { GMON_PROF_OFF };
+
+/*
+ * See profil(2) where this is described:
+ */
+static int	s_scale;
+#define		SCALE_1_TO_1	0x10000L
+
+#define ERR(s) write_not_cancel (STDERR_FILENO, s, sizeof (s) - 1)
+
+void moncontrol (int mode);
+void __moncontrol (int mode);
+static void write_hist (int fd) internal_function;
+static void write_call_graph (int fd) internal_function;
+static void write_bb_counts (int fd) internal_function;
+
+/*
+ * Control profiling
+ *	profiling is what mcount checks to see if
+ *	all the data structures are ready.
+ */
+void
+__moncontrol (int mode)
+{
+  struct gmonparam *p = &_gmonparam;
+
+  /* Don't change the state if we ran into an error.  */
+  if (p->state == GMON_PROF_ERROR)
+    return;
+
+  if (mode)
+    {
+      /* start */
+      __profil((void *) p->kcount, p->kcountsize, p->lowpc, s_scale);
+      p->state = GMON_PROF_ON;
+    }
+  else
+    {
+      /* stop */
+      __profil(NULL, 0, 0, 0);
+      p->state = GMON_PROF_OFF;
+    }
+}
+weak_alias (__moncontrol, moncontrol)
+
+
+void
+__monstartup (u_long lowpc, u_long highpc)
+{
+  int o;
+  char *cp;
+  struct gmonparam *p = &_gmonparam;
+
+  /*
+   * round lowpc and highpc to multiples of the density we're using
+   * so the rest of the scaling (here and in gprof) stays in ints.
+   */
+  p->lowpc = ROUNDDOWN(lowpc, HISTFRACTION * sizeof(HISTCOUNTER));
+  p->highpc = ROUNDUP(highpc, HISTFRACTION * sizeof(HISTCOUNTER));
+  p->textsize = p->highpc - p->lowpc;
+  p->kcountsize = ROUNDUP(p->textsize / HISTFRACTION, sizeof(*p->froms));
+  p->hashfraction = HASHFRACTION;
+  p->log_hashfraction = -1;
+  /* The following test must be kept in sync with the corresponding
+     test in mcount.c.  */
+  if ((HASHFRACTION & (HASHFRACTION - 1)) == 0) {
+      /* if HASHFRACTION is a power of two, mcount can use shifting
+	 instead of integer division.  Precompute shift amount. */
+      p->log_hashfraction = ffs(p->hashfraction * sizeof(*p->froms)) - 1;
+  }
+  p->fromssize = p->textsize / HASHFRACTION;
+  p->tolimit = p->textsize * ARCDENSITY / 100;
+  if (p->tolimit < MINARCS)
+    p->tolimit = MINARCS;
+  else if (p->tolimit > MAXARCS)
+    p->tolimit = MAXARCS;
+  p->tossize = p->tolimit * sizeof(struct tostruct);
+
+  cp = calloc (p->kcountsize + p->fromssize + p->tossize, 1);
+  if (! cp)
+    {
+      ERR("monstartup: out of memory\n");
+      p->tos = NULL;
+      p->state = GMON_PROF_ERROR;
+      return;
+    }
+  p->tos = (struct tostruct *)cp;
+  cp += p->tossize;
+  p->kcount = (HISTCOUNTER *)cp;
+  cp += p->kcountsize;
+  p->froms = (ARCINDEX *)cp;
+
+  p->tos[0].link = 0;
+
+  o = p->highpc - p->lowpc;
+  if (p->kcountsize < (u_long) o)
+    {
+#ifndef hp300
+      s_scale = ((float)p->kcountsize / o ) * SCALE_1_TO_1;
+#else
+      /* avoid floating point operations */
+      int quot = o / p->kcountsize;
+
+      if (quot >= 0x10000)
+	s_scale = 1;
+      else if (quot >= 0x100)
+	s_scale = 0x10000 / quot;
+      else if (o >= 0x800000)
+	s_scale = 0x1000000 / (o / (p->kcountsize >> 8));
+      else
+	s_scale = 0x1000000 / ((o << 8) / p->kcountsize);
+#endif
+    } else
+      s_scale = SCALE_1_TO_1;
+
+  __moncontrol(1);
+}
+weak_alias (__monstartup, monstartup)
+
+
+static void
+internal_function
+write_hist (int fd)
+{
+  u_char tag = GMON_TAG_TIME_HIST;
+
+  if (_gmonparam.kcountsize > 0)
+    {
+      struct real_gmon_hist_hdr
+      {
+	char *low_pc;
+	char *high_pc;
+	int32_t hist_size;
+	int32_t prof_rate;
+	char dimen[15];
+	char dimen_abbrev;
+      } thdr;
+      struct iovec iov[3] =
+	{
+	  { &tag, sizeof (tag) },
+	  { &thdr, sizeof (struct gmon_hist_hdr) },
+	  { _gmonparam.kcount, _gmonparam.kcountsize }
+	};
+
+      if (sizeof (thdr) != sizeof (struct gmon_hist_hdr)
+	  || (offsetof (struct real_gmon_hist_hdr, low_pc)
+	      != offsetof (struct gmon_hist_hdr, low_pc))
+	  || (offsetof (struct real_gmon_hist_hdr, high_pc)
+	      != offsetof (struct gmon_hist_hdr, high_pc))
+	  || (offsetof (struct real_gmon_hist_hdr, hist_size)
+	      != offsetof (struct gmon_hist_hdr, hist_size))
+	  || (offsetof (struct real_gmon_hist_hdr, prof_rate)
+	      != offsetof (struct gmon_hist_hdr, prof_rate))
+	  || (offsetof (struct real_gmon_hist_hdr, dimen)
+	      != offsetof (struct gmon_hist_hdr, dimen))
+	  || (offsetof (struct real_gmon_hist_hdr, dimen_abbrev)
+	      != offsetof (struct gmon_hist_hdr, dimen_abbrev)))
+	abort ();
+
+      thdr.low_pc = (char *) _gmonparam.lowpc;
+      thdr.high_pc = (char *) _gmonparam.highpc;
+      thdr.hist_size = _gmonparam.kcountsize / sizeof (HISTCOUNTER);
+      thdr.prof_rate = __profile_frequency ();
+      strncpy (thdr.dimen, "seconds", sizeof (thdr.dimen));
+      thdr.dimen_abbrev = 's';
+
+      writev_not_cancel_no_status (fd, iov, 3);
+    }
+}
+
+
+static void
+internal_function
+write_call_graph (int fd)
+{
+#define NARCS_PER_WRITEV	32
+  u_char tag = GMON_TAG_CG_ARC;
+  struct gmon_cg_arc_record raw_arc[NARCS_PER_WRITEV]
+    __attribute__ ((aligned (__alignof__ (char*))));
+  ARCINDEX from_index, to_index;
+  u_long from_len;
+  u_long frompc;
+  struct iovec iov[2 * NARCS_PER_WRITEV];
+  int nfilled;
+
+  for (nfilled = 0; nfilled < NARCS_PER_WRITEV; ++nfilled)
+    {
+      iov[2 * nfilled].iov_base = &tag;
+      iov[2 * nfilled].iov_len = sizeof (tag);
+
+      iov[2 * nfilled + 1].iov_base = &raw_arc[nfilled];
+      iov[2 * nfilled + 1].iov_len = sizeof (struct gmon_cg_arc_record);
+    }
+
+  nfilled = 0;
+  from_len = _gmonparam.fromssize / sizeof (*_gmonparam.froms);
+  for (from_index = 0; from_index < from_len; ++from_index)
+    {
+      if (_gmonparam.froms[from_index] == 0)
+	continue;
+
+      frompc = _gmonparam.lowpc;
+      frompc += (from_index * _gmonparam.hashfraction
+		 * sizeof (*_gmonparam.froms));
+      for (to_index = _gmonparam.froms[from_index];
+	   to_index != 0;
+	   to_index = _gmonparam.tos[to_index].link)
+	{
+	  struct arc
+	    {
+	      char *frompc;
+	      char *selfpc;
+	      int32_t count;
+	    }
+	  arc;
+
+	  arc.frompc = (char *) frompc;
+	  arc.selfpc = (char *) _gmonparam.tos[to_index].selfpc;
+	  arc.count  = _gmonparam.tos[to_index].count;
+	  memcpy (raw_arc + nfilled, &arc, sizeof (raw_arc [0]));
+
+	  if (++nfilled == NARCS_PER_WRITEV)
+	    {
+	      writev_not_cancel_no_status (fd, iov, 2 * nfilled);
+	      nfilled = 0;
+	    }
+	}
+    }
+  if (nfilled > 0)
+    writev_not_cancel_no_status (fd, iov, 2 * nfilled);
+}
+
+
+static void
+internal_function
+write_bb_counts (int fd)
+{
+  struct __bb *grp;
+  u_char tag = GMON_TAG_BB_COUNT;
+  size_t ncounts;
+  size_t i;
+
+  struct iovec bbhead[2] =
+    {
+      { &tag, sizeof (tag) },
+      { &ncounts, sizeof (ncounts) }
+    };
+  struct iovec bbbody[8];
+  size_t nfilled;
+
+  for (i = 0; i < (sizeof (bbbody) / sizeof (bbbody[0])); i += 2)
+    {
+      bbbody[i].iov_len = sizeof (grp->addresses[0]);
+      bbbody[i + 1].iov_len = sizeof (grp->counts[0]);
+    }
+
+  /* Write each group of basic-block info (all basic-blocks in a
+     compilation unit form a single group). */
+
+  for (grp = __bb_head; grp; grp = grp->next)
+    {
+      ncounts = grp->ncounts;
+      writev_not_cancel_no_status (fd, bbhead, 2);
+      for (nfilled = i = 0; i < ncounts; ++i)
+	{
+	  if (nfilled > (sizeof (bbbody) / sizeof (bbbody[0])) - 2)
+	    {
+	      writev_not_cancel_no_status (fd, bbbody, nfilled);
+	      nfilled = 0;
+	    }
+
+	  bbbody[nfilled++].iov_base = (char *) &grp->addresses[i];
+	  bbbody[nfilled++].iov_base = &grp->counts[i];
+	}
+      if (nfilled > 0)
+	writev_not_cancel_no_status (fd, bbbody, nfilled);
+    }
+}
+
+
+static void
+write_gmon (void)
+{
+    int fd = -1;
+    char *env;
+
+#ifndef O_NOFOLLOW
+# define O_NOFOLLOW	0
+#endif
+
+    env = getenv ("GMON_OUT_PREFIX");
+    if (env != NULL && !__libc_enable_secure)
+      {
+	size_t len = strlen (env);
+	char buf[len + 20];
+	__snprintf (buf, sizeof (buf), "%s.%u", env, __getpid ());
+	fd = open_not_cancel (buf, O_CREAT|O_TRUNC|O_WRONLY|O_NOFOLLOW, 0666);
+      }
+
+    if (fd == -1)
+      {
+	fd = open_not_cancel ("gmon.out", O_CREAT|O_TRUNC|O_WRONLY|O_NOFOLLOW,
+			      0666);
+	if (fd < 0)
+	  {
+	    char buf[300];
+	    int errnum = errno;
+	    __fxprintf (NULL, "_mcleanup: gmon.out: %s\n",
+			__strerror_r (errnum, buf, sizeof buf));
+	    return;
+	  }
+      }
+
+    /* write gmon.out header: */
+    struct real_gmon_hdr
+    {
+      char cookie[4];
+      int32_t version;
+      char spare[3 * 4];
+    } ghdr;
+    if (sizeof (ghdr) != sizeof (struct gmon_hdr)
+	|| (offsetof (struct real_gmon_hdr, cookie)
+	    != offsetof (struct gmon_hdr, cookie))
+	|| (offsetof (struct real_gmon_hdr, version)
+	    != offsetof (struct gmon_hdr, version)))
+      abort ();
+    memcpy (&ghdr.cookie[0], GMON_MAGIC, sizeof (ghdr.cookie));
+    ghdr.version = GMON_VERSION;
+    memset (ghdr.spare, '\0', sizeof (ghdr.spare));
+    write_not_cancel (fd, &ghdr, sizeof (struct gmon_hdr));
+
+    /* write PC histogram: */
+    write_hist (fd);
+
+    /* write call-graph: */
+    write_call_graph (fd);
+
+    /* write basic-block execution counts: */
+    write_bb_counts (fd);
+
+    close_not_cancel_no_status (fd);
+}
+
+
+void
+__write_profiling (void)
+{
+  int save = _gmonparam.state;
+  _gmonparam.state = GMON_PROF_OFF;
+  if (save == GMON_PROF_ON)
+    write_gmon ();
+  _gmonparam.state = save;
+}
+#ifndef SHARED
+/* This symbol isn't used anywhere in the DSO and it is not exported.
+   This would normally mean it should be removed to get the same API
+   in static libraries.  But since profiling is special in static libs
+   anyway we keep it.  But not when building the DSO since some
+   quality assurance tests will otherwise trigger.  */
+weak_alias (__write_profiling, write_profiling)
+#endif
+
+
+void
+_mcleanup (void)
+{
+  __moncontrol (0);
+
+  if (_gmonparam.state != GMON_PROF_ERROR)
+    write_gmon ();
+
+  /* free the memory. */
+  free (_gmonparam.tos);
+}
diff --git a/ap/libc/glibc/glibc-2.23/gmon/mcount.c b/ap/libc/glibc/glibc-2.23/gmon/mcount.c
new file mode 100644
index 0000000..9d4a1a5
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.23/gmon/mcount.c
@@ -0,0 +1,180 @@
+/*-
+ * Copyright (c) 1983, 1992, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#if !defined(lint) && !defined(KERNEL) && defined(LIBC_SCCS)
+static char sccsid[] = "@(#)mcount.c	8.1 (Berkeley) 6/4/93";
+#endif
+
+#include <unistd.h>
+#include <sys/param.h>
+#include <sys/gmon.h>
+
+/* This file provides the machine-dependent definitions of the _MCOUNT_DECL
+   and MCOUNT macros.  */
+#include <machine-gmon.h>
+
+#include <atomic.h>
+
+/*
+ * mcount is called on entry to each function compiled with the profiling
+ * switch set.  _mcount(), which is declared in a machine-dependent way
+ * with _MCOUNT_DECL, does the actual work and is either inlined into a
+ * C routine or called by an assembly stub.  In any case, this magic is
+ * taken care of by the MCOUNT definition in <machine/profile.h>.
+ *
+ * _mcount updates data structures that represent traversals of the
+ * program's call graph edges.  frompc and selfpc are the return
+ * address and function address that represents the given call graph edge.
+ *
+ * Note: the original BSD code used the same variable (frompcindex) for
+ * both frompcindex and frompc.  Any reasonable, modern compiler will
+ * perform this optimization.
+ */
+_MCOUNT_DECL(frompc, selfpc)	/* _mcount; may be static, inline, etc */
+{
+	ARCINDEX *frompcindex;
+	struct tostruct *top, *prevtop;
+	struct gmonparam *p;
+	ARCINDEX toindex;
+	int i;
+
+	p = &_gmonparam;
+	/*
+	 * check that we are profiling
+	 * and that we aren't recursively invoked.
+	 */
+	if (atomic_compare_and_exchange_bool_acq (&p->state, GMON_PROF_BUSY,
+						  GMON_PROF_ON))
+	  return;
+
+	/*
+	 * check that frompcindex is a reasonable pc value.
+	 * for example:	signal catchers get called from the stack,
+	 *		not from text space.  too bad.
+	 */
+	frompc -= p->lowpc;
+	if (frompc > p->textsize)
+		goto done;
+
+	/* The following test used to be
+		if (p->log_hashfraction >= 0)
+	   But we can simplify this if we assume the profiling data
+	   is always initialized by the functions in gmon.c.  But
+	   then it is possible to avoid a runtime check and use the
+	   smae `if' as in gmon.c.  So keep these tests in sync.  */
+	if ((HASHFRACTION & (HASHFRACTION - 1)) == 0) {
+	  /* avoid integer divide if possible: */
+	    i = frompc >> p->log_hashfraction;
+	} else {
+	    i = frompc / (p->hashfraction * sizeof(*p->froms));
+	}
+	frompcindex = &p->froms[i];
+	toindex = *frompcindex;
+	if (toindex == 0) {
+		/*
+		 *	first time traversing this arc
+		 */
+		toindex = ++p->tos[0].link;
+		if (toindex >= p->tolimit)
+			/* halt further profiling */
+			goto overflow;
+
+		*frompcindex = toindex;
+		top = &p->tos[toindex];
+		top->selfpc = selfpc;
+		top->count = 1;
+		top->link = 0;
+		goto done;
+	}
+	top = &p->tos[toindex];
+	if (top->selfpc == selfpc) {
+		/*
+		 * arc at front of chain; usual case.
+		 */
+		top->count++;
+		goto done;
+	}
+	/*
+	 * have to go looking down chain for it.
+	 * top points to what we are looking at,
+	 * prevtop points to previous top.
+	 * we know it is not at the head of the chain.
+	 */
+	for (; /* goto done */; ) {
+		if (top->link == 0) {
+			/*
+			 * top is end of the chain and none of the chain
+			 * had top->selfpc == selfpc.
+			 * so we allocate a new tostruct
+			 * and link it to the head of the chain.
+			 */
+			toindex = ++p->tos[0].link;
+			if (toindex >= p->tolimit)
+				goto overflow;
+
+			top = &p->tos[toindex];
+			top->selfpc = selfpc;
+			top->count = 1;
+			top->link = *frompcindex;
+			*frompcindex = toindex;
+			goto done;
+		}
+		/*
+		 * otherwise, check the next arc on the chain.
+		 */
+		prevtop = top;
+		top = &p->tos[top->link];
+		if (top->selfpc == selfpc) {
+			/*
+			 * there it is.
+			 * increment its count
+			 * move it to the head of the chain.
+			 */
+			top->count++;
+			toindex = prevtop->link;
+			prevtop->link = top->link;
+			top->link = *frompcindex;
+			*frompcindex = toindex;
+			goto done;
+		}
+
+	}
+done:
+	p->state = GMON_PROF_ON;
+	return;
+overflow:
+	p->state = GMON_PROF_ERROR;
+	return;
+}
+
+/*
+ * Actual definition of mcount function.  Defined in <machine/profile.h>,
+ * which is included by <sys/gmon.h>.
+ */
+MCOUNT
diff --git a/ap/libc/glibc/glibc-2.23/gmon/prof-freq.c b/ap/libc/glibc/glibc-2.23/gmon/prof-freq.c
new file mode 100644
index 0000000..ffcc679
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.23/gmon/prof-freq.c
@@ -0,0 +1,55 @@
+/* Return frequency of ticks reported by profil.  Generic version. */
+/*-
+ * Copyright (c) 1983, 1992, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+
+#include <sys/types.h>
+#include <sys/time.h>
+#include <libc-internal.h>
+
+int
+__profile_frequency (void)
+{
+  /*
+   * Discover the tick frequency of the machine if something goes wrong,
+   * we return 0, an impossible hertz.
+   */
+  struct itimerval tim;
+
+  tim.it_interval.tv_sec = 0;
+  tim.it_interval.tv_usec = 1;
+  tim.it_value.tv_sec = 0;
+  tim.it_value.tv_usec = 0;
+  __setitimer(ITIMER_REAL, &tim, 0);
+  __setitimer(ITIMER_REAL, 0, &tim);
+  if (tim.it_interval.tv_usec < 2)
+    return 0;
+  return (1000000 / tim.it_interval.tv_usec);
+}
+libc_hidden_def (__profile_frequency)
diff --git a/ap/libc/glibc/glibc-2.23/gmon/profil.c b/ap/libc/glibc/glibc-2.23/gmon/profil.c
new file mode 100644
index 0000000..e1eff8b
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.23/gmon/profil.c
@@ -0,0 +1,40 @@
+/* Low-level statistical profiling support function.  Stub version.
+   Copyright (C) 1995-2016 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 <sys/types.h>
+#include <unistd.h>
+#include <errno.h>
+
+/* Enable statistical profiling, writing samples of the PC into at most
+   SIZE bytes of SAMPLE_BUFFER; every processor clock tick while profiling
+   is enabled, the system examines the user PC and increments
+   SAMPLE_BUFFER[((PC - OFFSET) / 2) * SCALE / 65536].  If SCALE is zero,
+   disable profiling.  Returns zero on success, -1 on error.  */
+
+int
+__profil (u_short *sample_buffer, size_t size, size_t offset, u_int scale)
+{
+  if (scale == 0)
+    /* Disable profiling.  */
+    return 0;
+
+  __set_errno (ENOSYS);
+  return -1;
+}
+weak_alias (__profil, profil)
+stub_warning (profil)
diff --git a/ap/libc/glibc/glibc-2.23/gmon/sprofil.c b/ap/libc/glibc/glibc-2.23/gmon/sprofil.c
new file mode 100644
index 0000000..945cf18
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.23/gmon/sprofil.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 2001-2016 Free Software Foundation, Inc.
+   Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
+   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 <errno.h>
+
+#include <sys/profil.h>
+#include <sys/time.h>
+
+int
+__sprofil (struct prof *profp, int profcnt, struct timeval *tvp,
+	   unsigned int flags)
+{
+  if (profcnt == 0)
+    return 0;
+
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+weak_alias (__sprofil, sprofil)
diff --git a/ap/libc/glibc/glibc-2.23/gmon/sys/gmon.h b/ap/libc/glibc/glibc-2.23/gmon/sys/gmon.h
new file mode 100644
index 0000000..5b430ab
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.23/gmon/sys/gmon.h
@@ -0,0 +1,201 @@
+/*-
+ * Copyright (c) 1982, 1986, 1992, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)gmon.h	8.2 (Berkeley) 1/4/94
+ */
+
+#ifndef	_SYS_GMON_H
+#define	_SYS_GMON_H	1
+
+#include <features.h>
+
+#include <sys/types.h>
+
+/*
+ * See gmon_out.h for gmon.out format.
+ */
+
+/* structure emitted by "gcc -a".  This must match struct bb in
+   gcc/libgcc2.c.  It is OK for gcc to declare a longer structure as
+   long as the members below are present.  */
+struct __bb
+{
+  long			zero_word;
+  const char		*filename;
+  long			*counts;
+  long			ncounts;
+  struct __bb		*next;
+  const unsigned long	*addresses;
+};
+
+extern struct __bb *__bb_head;
+
+/*
+ * histogram counters are unsigned shorts (according to the kernel).
+ */
+#define	HISTCOUNTER	unsigned short
+
+/*
+ * fraction of text space to allocate for histogram counters here, 1/2
+ */
+#define	HISTFRACTION	2
+
+/*
+ * Fraction of text space to allocate for from hash buckets.
+ * The value of HASHFRACTION is based on the minimum number of bytes
+ * of separation between two subroutine call points in the object code.
+ * Given MIN_SUBR_SEPARATION bytes of separation the value of
+ * HASHFRACTION is calculated as:
+ *
+ *	HASHFRACTION = MIN_SUBR_SEPARATION / (2 * sizeof(short) - 1);
+ *
+ * For example, on the VAX, the shortest two call sequence is:
+ *
+ *	calls	$0,(r0)
+ *	calls	$0,(r0)
+ *
+ * which is separated by only three bytes, thus HASHFRACTION is
+ * calculated as:
+ *
+ *	HASHFRACTION = 3 / (2 * 2 - 1) = 1
+ *
+ * Note that the division above rounds down, thus if MIN_SUBR_FRACTION
+ * is less than three, this algorithm will not work!
+ *
+ * In practice, however, call instructions are rarely at a minimal
+ * distance.  Hence, we will define HASHFRACTION to be 2 across all
+ * architectures.  This saves a reasonable amount of space for
+ * profiling data structures without (in practice) sacrificing
+ * any granularity.
+ */
+#define	HASHFRACTION	2
+
+/*
+ * Percent of text space to allocate for tostructs.
+ * This is a heuristic; we will fail with a warning when profiling programs
+ * with a very large number of very small functions, but that's
+ * normally OK.
+ * 2 is probably still a good value for normal programs.
+ * Profiling a test case with 64000 small functions will work if
+ * you raise this value to 3 and link statically (which bloats the
+ * text size, thus raising the number of arcs expected by the heuristic).
+ */
+#define ARCDENSITY	3
+
+/*
+ * Always allocate at least this many tostructs.  This
+ * hides the inadequacy of the ARCDENSITY heuristic, at least
+ * for small programs.
+ */
+#define MINARCS		50
+
+/*
+ * The type used to represent indices into gmonparam.tos[].
+ */
+#define	ARCINDEX	u_long
+
+/*
+ * Maximum number of arcs we want to allow.
+ * Used to be max representable value of ARCINDEX minus 2, but now
+ * that ARCINDEX is a long, that's too large; we don't really want
+ * to allow a 48 gigabyte table.
+ * The old value of 1<<16 wasn't high enough in practice for large C++
+ * programs; will 1<<20 be adequate for long?  FIXME
+ */
+#define MAXARCS		(1 << 20)
+
+struct tostruct {
+	u_long		selfpc;
+	long		count;
+	ARCINDEX	link;
+};
+
+/*
+ * a raw arc, with pointers to the calling site and
+ * the called site and a count.
+ */
+struct rawarc {
+	u_long	raw_frompc;
+	u_long	raw_selfpc;
+	long	raw_count;
+};
+
+/*
+ * general rounding functions.
+ */
+#define ROUNDDOWN(x,y)	(((x)/(y))*(y))
+#define ROUNDUP(x,y)	((((x)+(y)-1)/(y))*(y))
+
+/*
+ * The profiling data structures are housed in this structure.
+ */
+struct gmonparam {
+	long int	state;
+	u_short		*kcount;
+	u_long		kcountsize;
+	ARCINDEX	*froms;
+	u_long		fromssize;
+	struct tostruct	*tos;
+	u_long		tossize;
+	long		tolimit;
+	u_long		lowpc;
+	u_long		highpc;
+	u_long		textsize;
+	u_long		hashfraction;
+	long		log_hashfraction;
+};
+
+/*
+ * Possible states of profiling.
+ */
+#define	GMON_PROF_ON	0
+#define	GMON_PROF_BUSY	1
+#define	GMON_PROF_ERROR	2
+#define	GMON_PROF_OFF	3
+
+/*
+ * Sysctl definitions for extracting profiling information from the kernel.
+ */
+#define	GPROF_STATE	0	/* int: profiling enabling variable */
+#define	GPROF_COUNT	1	/* struct: profile tick count buffer */
+#define	GPROF_FROMS	2	/* struct: from location hash bucket */
+#define	GPROF_TOS	3	/* struct: destination/count structure */
+#define	GPROF_GMONPARAM	4	/* struct: profiling parameters (see above) */
+
+__BEGIN_DECLS
+
+/* Set up data structures and start profiling.  */
+extern void __monstartup (u_long __lowpc, u_long __highpc) __THROW;
+extern void monstartup (u_long __lowpc, u_long __highpc) __THROW;
+
+/* Clean up profiling and write out gmon.out.  */
+extern void _mcleanup (void) __THROW;
+
+__END_DECLS
+
+#endif /* sys/gmon.h */
diff --git a/ap/libc/glibc/glibc-2.23/gmon/sys/gmon_out.h b/ap/libc/glibc/glibc-2.23/gmon/sys/gmon_out.h
new file mode 100644
index 0000000..b948799
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.23/gmon/sys/gmon_out.h
@@ -0,0 +1,79 @@
+/* Copyright (C) 1996-2016 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by David Mosberger <davidm@cs.arizona.edu>.
+
+   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/>.  */
+
+/* This file specifies the format of gmon.out files.  It should have
+   as few external dependencies as possible as it is going to be included
+   in many different programs.  That is, minimize the number of #include's.
+
+   A gmon.out file consists of a header (defined by gmon_hdr) followed by
+   a sequence of records.  Each record starts with a one-byte tag
+   identifying the type of records, followed by records specific data. */
+
+#ifndef _SYS_GMON_OUT_H
+#define _SYS_GMON_OUT_H	1
+
+#include <features.h>
+
+#define	GMON_MAGIC	"gmon"	/* magic cookie */
+#define GMON_VERSION	1	/* version number */
+
+/* For profiling shared object we need a new format.  */
+#define GMON_SHOBJ_VERSION	0x1ffff
+
+__BEGIN_DECLS
+
+/*
+ * Raw header as it appears on file (without padding).  This header
+ * always comes first in gmon.out and is then followed by a series
+ * records defined below.
+ */
+struct gmon_hdr
+  {
+    char cookie[4];
+    char version[4];
+    char spare[3 * 4];
+  };
+
+/* types of records in this file: */
+typedef enum
+  {
+    GMON_TAG_TIME_HIST = 0,
+    GMON_TAG_CG_ARC = 1,
+    GMON_TAG_BB_COUNT = 2
+  } GMON_Record_Tag;
+
+struct gmon_hist_hdr
+  {
+    char low_pc[sizeof (char *)];	/* base pc address of sample buffer */
+    char high_pc[sizeof (char *)];	/* max pc address of sampled buffer */
+    char hist_size[4];			/* size of sample buffer */
+    char prof_rate[4];			/* profiling clock rate */
+    char dimen[15];			/* phys. dim., usually "seconds" */
+    char dimen_abbrev;			/* usually 's' for "seconds" */
+  };
+
+struct gmon_cg_arc_record
+  {
+    char from_pc[sizeof (char *)];	/* address within caller's body */
+    char self_pc[sizeof (char *)];	/* address within callee's body */
+    char count[4];			/* number of arc traversals */
+  };
+
+__END_DECLS
+
+#endif /* sys/gmon_out.h */
diff --git a/ap/libc/glibc/glibc-2.23/gmon/sys/profil.h b/ap/libc/glibc/glibc-2.23/gmon/sys/profil.h
new file mode 100644
index 0000000..5790fe0
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.23/gmon/sys/profil.h
@@ -0,0 +1,60 @@
+/* Copyright (C) 2001-2016 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/>.  */
+
+#ifndef _PROFIL_H
+#define _PROFIL_H	1
+
+#include <features.h>
+
+#include <sys/time.h>
+#include <sys/types.h>
+
+/* This interface is intended to follow the sprofil() system calls as
+   described by the sprofil(2) man page of Irix v6.5, except that:
+
+	- there is no a priori limit on number of text sections
+	- pr_scale is declared as unsigned long (instead of "unsigned int")
+	- pr_size is declared as size_t (instead of "unsigned int")
+	- pr_off is declared as void * (instead of "__psunsigned_t")
+	- the overflow bin (pr_base==0, pr_scale==2) can appear anywhere
+	  in the profp array
+	- PROF_FAST has no effect  */
+
+struct prof
+  {
+    void *pr_base;		/* buffer base */
+    size_t pr_size;		/* buffer size */
+    size_t pr_off;		/* pc offset */
+    unsigned long int pr_scale;	/* pc scaling (fixed-point number) */
+  };
+
+enum
+  {
+    PROF_USHORT	= 0,		/* use 16-bit counters (default) */
+    PROF_UINT	= 1 << 0,	/* use 32-bit counters */
+    PROF_FAST   = 1 << 1	/* profile faster than usual */
+  };
+
+
+__BEGIN_DECLS
+
+extern int sprofil (struct prof *__profp, int __profcnt,
+		    struct timeval *__tvp, unsigned int __flags) __THROW;
+
+__END_DECLS
+
+#endif /* profil.h */
diff --git a/ap/libc/glibc/glibc-2.23/gmon/tst-profile-static.c b/ap/libc/glibc/glibc-2.23/gmon/tst-profile-static.c
new file mode 100644
index 0000000..b2f371e
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.23/gmon/tst-profile-static.c
@@ -0,0 +1,10 @@
+#include <stdio.h>
+static int
+do_test (void)
+{
+  puts ("Hello world");
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ap/libc/glibc/glibc-2.23/gmon/tst-sprofil.c b/ap/libc/glibc/glibc-2.23/gmon/tst-sprofil.c
new file mode 100644
index 0000000..66cede9
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.23/gmon/tst-sprofil.c
@@ -0,0 +1,171 @@
+/* Copyright (C) 2001-2016 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
+
+   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 <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/profil.h>
+
+#include <bits/wordsize.h>
+
+#define NELEMS(a)	(sizeof (a)/sizeof ((a)[0]))
+
+size_t taddr[] =
+  {
+    0x00001000,		/* elf32/hppa */
+    0x08048000,		/* Linux elf32/x86 */
+    0x80000000,		/* Linux elf32/m68k */
+    0x00400000,		/* Linux elf32/mips */
+    0x01800000,		/* Linux elf32/ppc */
+    0x00010000		/* Linux elf32/sparc */
+#if __WORDSIZE > 32
+    ,
+    0x4000000000000000,	/* Linux elf64/ia64 */
+    0x0000000120000000,	/* Linux elf64/alpha */
+    0x4000000000001000,	/* elf64/hppa */
+    0x0000000100000000	/* Linux elf64/sparc */
+#endif
+  };
+
+unsigned int buf[NELEMS (taddr)][0x10000 / sizeof (int)];
+unsigned int bshort[5][0x100 / sizeof (int)];
+unsigned int blong[1][0x1000 / sizeof (int)];
+unsigned int vlong[1][0x2000 / sizeof (int)];
+
+static long int
+fac (long int n)
+{
+  if (n == 0)
+    return 1;
+  return n * fac (n - 1);
+}
+
+int
+main (int argc, char **argv)
+{
+  unsigned int ovfl = 0, profcnt = 0;
+  struct timeval tv, start;
+  struct prof prof[32];
+  double t_tick, delta;
+  long int sum = 0;
+  int i, j;
+
+  for (i = 0; i < NELEMS (taddr); ++i)
+    {
+      prof[profcnt].pr_base = buf[i];
+      prof[profcnt].pr_size = sizeof (buf[i]);
+      prof[profcnt].pr_off = taddr[i];
+      prof[profcnt].pr_scale = 0x10000;
+      ++profcnt;
+    }
+
+  prof[profcnt].pr_base = blong[0];
+  prof[profcnt].pr_size = sizeof (blong[0]);
+  prof[profcnt].pr_off = 0x80001000;
+  prof[profcnt].pr_scale = 0x10000;
+  ++profcnt;
+
+  prof[profcnt].pr_base = bshort[0];
+  prof[profcnt].pr_size = sizeof (bshort[0]);
+  prof[profcnt].pr_off = 0x80000080;
+  prof[profcnt].pr_scale = 0x10000;
+  ++profcnt;
+
+  prof[profcnt].pr_base = bshort[1];
+  prof[profcnt].pr_size = sizeof (bshort[1]);
+  prof[profcnt].pr_off = 0x80000f80;
+  prof[profcnt].pr_scale = 0x10000;
+  ++profcnt;
+
+  prof[profcnt].pr_base = bshort[2];
+  prof[profcnt].pr_size = sizeof (bshort[2]);
+  prof[profcnt].pr_off = 0x80001080;
+  prof[profcnt].pr_scale = 0x10000;
+  ++profcnt;
+
+  prof[profcnt].pr_base = bshort[3];
+  prof[profcnt].pr_size = sizeof (bshort[3]);
+  prof[profcnt].pr_off = 0x80001f80;
+  prof[profcnt].pr_scale = 0x10000;
+  ++profcnt;
+
+  prof[profcnt].pr_base = bshort[4];
+  prof[profcnt].pr_size = sizeof (bshort[4]);
+  prof[profcnt].pr_off = 0x80002080;
+  prof[profcnt].pr_scale = 0x10000;
+  ++profcnt;
+
+  prof[profcnt].pr_base = vlong[0];
+  prof[profcnt].pr_size = sizeof (vlong[0]);
+  prof[profcnt].pr_off = 0x80000080;
+  prof[profcnt].pr_scale = 0x10000;
+  ++profcnt;
+
+  /* Set up overflow counter (must be last on Irix).  */
+  prof[profcnt].pr_base = &ovfl;
+  prof[profcnt].pr_size = sizeof (ovfl);
+  prof[profcnt].pr_off = 0;
+  prof[profcnt].pr_scale = 2;
+  ++profcnt;
+
+  /* Turn it on.  */
+  if (sprofil (prof, profcnt, &tv, PROF_UINT) < 0)
+    {
+      if (errno == ENOSYS)
+	exit (0);
+      perror ("sprofil");
+      exit (1);
+    }
+
+  t_tick = tv.tv_sec + 1e-6 * tv.tv_usec;
+  printf ("profiling period = %g ms\n", 1e3 * t_tick);
+
+  gettimeofday (&start, NULL);
+  do
+    {
+      for (i = 0; i < 21; ++i)
+	sum += fac (i);
+
+      gettimeofday (&tv, NULL);
+      timersub (&tv, &start, &tv);
+      delta = tv.tv_sec + 1e-6 * tv.tv_usec;
+    }
+  while (delta < 1000 * t_tick);
+
+  printf ("sum = 0x%lx\n", sum);
+
+  /* Turn it off.  */
+  if (sprofil (NULL, 0, NULL, 0) < 0)
+    {
+      if (errno == ENOSYS)
+	exit (0);
+      perror ("sprofil");
+      exit (1);
+    }
+
+  printf ("overflow = %u\n", ovfl);
+  for (i = 0; i < NELEMS (taddr); ++i)
+    for (j = 0; j < 0x10000 / sizeof (int); ++j)
+      if (buf[i][j] != 0)
+	printf ("%0*Zx\t%u\t(buffer %d)\n",
+		(int) (sizeof (size_t) * 2),
+		(taddr[i] + ((char *) &buf[i][j] - (char *) &buf[i][0])),
+		buf[i][j], i);
+
+  return 0;
+}
