[arch-commits] Commit in glibc/repos/staging-x86_64 (22 files)

Frederik Schwan freswa at gemini.archlinux.org
Wed Feb 9 17:48:32 UTC 2022


    Date: Wednesday, February 9, 2022 @ 17:48:32
  Author: freswa
Revision: 436750

archrelease: copy trunk to staging-x86_64

Added:
  glibc/repos/staging-x86_64/0001-nptl_db-Support-different-libpthread-ld.so-load-orde.patch
    (from rev 436749, glibc/trunk/0001-nptl_db-Support-different-libpthread-ld.so-load-orde.patch)
  glibc/repos/staging-x86_64/0002-nptl-Check-for-compatible-GDB-in-nptl-tst-pthread-gd.patch
    (from rev 436749, glibc/trunk/0002-nptl-Check-for-compatible-GDB-in-nptl-tst-pthread-gd.patch)
  glibc/repos/staging-x86_64/0003-nptl-Do-not-build-nptl-tst-pthread-gdb-attach-as-PIE.patch
    (from rev 436749, glibc/trunk/0003-nptl-Do-not-build-nptl-tst-pthread-gdb-attach-as-PIE.patch)
  glibc/repos/staging-x86_64/PKGBUILD
    (from rev 436749, glibc/trunk/PKGBUILD)
  glibc/repos/staging-x86_64/bz27343.patch
    (from rev 436749, glibc/trunk/bz27343.patch)
  glibc/repos/staging-x86_64/glibc.install
    (from rev 436749, glibc/trunk/glibc.install)
  glibc/repos/staging-x86_64/lib32-glibc.conf
    (from rev 436749, glibc/trunk/lib32-glibc.conf)
  glibc/repos/staging-x86_64/locale-gen
    (from rev 436749, glibc/trunk/locale-gen)
  glibc/repos/staging-x86_64/locale.gen.txt
    (from rev 436749, glibc/trunk/locale.gen.txt)
  glibc/repos/staging-x86_64/sdt-config.h
    (from rev 436749, glibc/trunk/sdt-config.h)
  glibc/repos/staging-x86_64/sdt.h
    (from rev 436749, glibc/trunk/sdt.h)
Deleted:
  glibc/repos/staging-x86_64/0001-nptl_db-Support-different-libpthread-ld.so-load-orde.patch
  glibc/repos/staging-x86_64/0002-nptl-Check-for-compatible-GDB-in-nptl-tst-pthread-gd.patch
  glibc/repos/staging-x86_64/0003-nptl-Do-not-build-nptl-tst-pthread-gdb-attach-as-PIE.patch
  glibc/repos/staging-x86_64/PKGBUILD
  glibc/repos/staging-x86_64/bz27343.patch
  glibc/repos/staging-x86_64/glibc.install
  glibc/repos/staging-x86_64/lib32-glibc.conf
  glibc/repos/staging-x86_64/locale-gen
  glibc/repos/staging-x86_64/locale.gen.txt
  glibc/repos/staging-x86_64/sdt-config.h
  glibc/repos/staging-x86_64/sdt.h

-----------------------------------------------------------------+
 0001-nptl_db-Support-different-libpthread-ld.so-load-orde.patch |  616 +++----
 0002-nptl-Check-for-compatible-GDB-in-nptl-tst-pthread-gd.patch |  270 +--
 0003-nptl-Do-not-build-nptl-tst-pthread-gdb-attach-as-PIE.patch |   52 
 PKGBUILD                                                        |  482 ++---
 bz27343.patch                                                   |   96 -
 glibc.install                                                   |   10 
 lib32-glibc.conf                                                |    2 
 locale-gen                                                      |   84 
 locale.gen.txt                                                  |   46 
 sdt-config.h                                                    |   12 
 sdt.h                                                           |  860 +++++-----
 11 files changed, 1265 insertions(+), 1265 deletions(-)

Deleted: 0001-nptl_db-Support-different-libpthread-ld.so-load-orde.patch
===================================================================
--- 0001-nptl_db-Support-different-libpthread-ld.so-load-orde.patch	2022-02-09 17:44:01 UTC (rev 436749)
+++ 0001-nptl_db-Support-different-libpthread-ld.so-load-orde.patch	2022-02-09 17:48:32 UTC (rev 436750)
@@ -1,308 +0,0 @@
-From a64afc225240b2b27129ccfb0516d7c958b98040 Mon Sep 17 00:00:00 2001
-From: Florian Weimer <fweimer at redhat.com>
-Date: Wed, 21 Apr 2021 11:50:43 +0200
-Subject: [PATCH 364/576] nptl_db: Support different libpthread/ld.so load
- orders (bug 27744)
-
-libthread_db is loaded once GDB encounters libpthread, and at this
-point, ld.so may not have been processed by GDB yet. As a result,
-_rtld_global cannot be accessed by regular means from libthread_db.
-To make this work until GDB can be fixed, acess _rtld_global through
-a pointer stored in libpthread.
-
-The new test does not reproduce bug 27744 with
---disable-hardcoded-path-in-tests, but is still a valid smoke test.
-With --enable-hardcoded-path-in-tests, it is necessary to avoid
-add-symbol-file because this can tickle a GDB bug.
-
-Fixes commit 1daccf403b1bd86370eb94edca794dc106d02039 ("nptl: Move
-stack list variables into _rtld_global").
-
-Tested-by: Emil Velikov <emil.velikov at collabora.com>
----
- nptl/Makefile                        |  19 +++-
- nptl/pthread_create.c                |   8 ++
- nptl/tst-pthread-gdb-attach-static.c |   1 +
- nptl/tst-pthread-gdb-attach.c        | 143 +++++++++++++++++++++++++++
- nptl_db/structs.def                  |   3 +-
- nptl_db/td_init.c                    |  15 +--
- nptl_db/thread_dbP.h                 |   2 +
- 7 files changed, 180 insertions(+), 11 deletions(-)
- create mode 100644 nptl/tst-pthread-gdb-attach-static.c
- create mode 100644 nptl/tst-pthread-gdb-attach.c
-
-diff --git a/nptl/Makefile b/nptl/Makefile
-index 8fe92d43fa..e665d37e52 100644
---- a/nptl/Makefile
-+++ b/nptl/Makefile
-@@ -313,7 +313,8 @@ tests = tst-attr2 tst-attr3 tst-default-attr \
- 	tst-thread-affinity-sched \
- 	tst-pthread-defaultattr-free \
- 	tst-pthread-attr-sigmask \
--	tst-pthread-timedlock-lockloop
-+	tst-pthread-timedlock-lockloop \
-+	tst-pthread-gdb-attach tst-pthread-gdb-attach-static
- 
- tests-container =  tst-pthread-getattr
- 
-@@ -359,6 +360,19 @@ CPPFLAGS-test-cond-printers.c := $(CFLAGS-printers-tests)
- CPPFLAGS-test-rwlockattr-printers.c := $(CFLAGS-printers-tests)
- CPPFLAGS-test-rwlock-printers.c := $(CFLAGS-printers-tests)
- 
-+# Reuse the CFLAGS setting for the GDB attaching test.  It needs
-+# debugging information.
-+CFLAGS-tst-pthread-gdb-attach.c := $(CFLAGS-printers-tests)
-+CPPFLAGS-tst-pthread-gdb-attach.c := $(CFLAGS-printers-tests)
-+ifeq ($(build-shared)$(build-hardcoded-path-in-tests),yesno)
-+CPPFLAGS-tst-pthread-gdb-attach.c += -DDO_ADD_SYMBOL_FILE=1
-+else
-+CPPFLAGS-tst-pthread-gdb-attach.c += -DDO_ADD_SYMBOL_FILE=0
-+endif
-+CFLAGS-tst-pthread-gdb-attach-static.c := $(CFLAGS-printers-tests)
-+CPPFLAGS-tst-pthread-gdb-attach-static.c := \
-+  $(CFLAGS-printers-tests) -DDO_ADD_SYMBOL_FILE=0
-+
- ifeq ($(build-shared),yes)
- tests-printers-libs := $(shared-thread-library)
- else
-@@ -430,7 +444,8 @@ link-libc-static := $(common-objpfx)libc.a $(static-gnulib) \
- tests-static += tst-stackguard1-static \
- 		tst-cancel24-static \
- 		tst-mutex8-static tst-mutexpi8-static tst-sem11-static \
--		tst-sem12-static tst-cond11-static
-+		tst-sem12-static tst-cond11-static \
-+		tst-pthread-gdb-attach-static
- 
- tests += tst-cancel24-static
- 
-diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
-index 6c645aff48..f13d8e44a4 100644
---- a/nptl/pthread_create.c
-+++ b/nptl/pthread_create.c
-@@ -51,6 +51,14 @@ static td_thr_events_t __nptl_threads_events __attribute_used__;
- /* Pointer to descriptor with the last event.  */
- static struct pthread *__nptl_last_event __attribute_used__;
- 
-+#ifdef SHARED
-+/* This variable is used to access _rtld_global from libthread_db.  If
-+   GDB loads libpthread before ld.so, it is not possible to resolve
-+   _rtld_global directly during libpthread initialization.  */
-+static struct rtld_global *__nptl_rtld_global __attribute_used__
-+  = &_rtld_global;
-+#endif
-+
- /* Number of threads running.  */
- unsigned int __nptl_nthreads = 1;
- 
-diff --git a/nptl/tst-pthread-gdb-attach-static.c b/nptl/tst-pthread-gdb-attach-static.c
-new file mode 100644
-index 0000000000..e159632cac
---- /dev/null
-+++ b/nptl/tst-pthread-gdb-attach-static.c
-@@ -0,0 +1 @@
-+#include "tst-pthread-gdb-attach.c"
-diff --git a/nptl/tst-pthread-gdb-attach.c b/nptl/tst-pthread-gdb-attach.c
-new file mode 100644
-index 0000000000..0603ad844d
---- /dev/null
-+++ b/nptl/tst-pthread-gdb-attach.c
-@@ -0,0 +1,143 @@
-+/* Smoke testing GDB process attach with thread-local variable access.
-+   Copyright (C) 2021 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
-+   <https://www.gnu.org/licenses/>.  */
-+
-+/* This test runs GDB against a forked copy of itself, to check
-+   whether libthread_db can be loaded, and that access to thread-local
-+   variables works.  */
-+
-+#include <errno.h>
-+#include <stdlib.h>
-+#include <support/check.h>
-+#include <support/support.h>
-+#include <support/temp_file.h>
-+#include <support/test-driver.h>
-+#include <support/xstdio.h>
-+#include <support/xthread.h>
-+#include <support/xunistd.h>
-+#include <unistd.h>
-+
-+/* Starts out as zero, changed to 1 or 2 by the debugger, depending on
-+   the thread.  */
-+__thread volatile int altered_by_debugger;
-+
-+/* Writes the GDB script to run the test to PATH.  */
-+static void
-+write_gdbscript (const char *path, int tested_pid)
-+{
-+  FILE *fp = xfopen (path, "w");
-+  fprintf (fp,
-+           "set trace-commands on\n"
-+           "set debug libthread-db 1\n"
-+#if DO_ADD_SYMBOL_FILE
-+           /* Do not do this unconditionally to work around a GDB
-+              assertion failure: ../../gdb/symtab.c:6404:
-+              internal-error: CORE_ADDR get_msymbol_address(objfile*,
-+              const minimal_symbol*): Assertion `(objf->flags &
-+              OBJF_MAINLINE) == 0' failed.  */
-+           "add-symbol-file %1$s/nptl/tst-pthread-gdb-attach\n"
-+#endif
-+           "set auto-load safe-path %1$s/nptl_db\n"
-+           "set libthread-db-search-path %1$s/nptl_db\n"
-+           "attach %2$d\n",
-+           support_objdir_root, tested_pid);
-+  fputs ("break debugger_inspection_point\n"
-+         "continue\n"
-+         "thread 1\n"
-+         "print altered_by_debugger\n"
-+         "print altered_by_debugger = 1\n"
-+         "thread 2\n"
-+         "print altered_by_debugger\n"
-+         "print altered_by_debugger = 2\n"
-+         "continue\n",
-+         fp);
-+  xfclose (fp);
-+}
-+
-+/* The test sets a breakpoint on this function and alters the
-+   altered_by_debugger thread-local variable.  */
-+void __attribute__ ((weak))
-+debugger_inspection_point (void)
-+{
-+}
-+
-+/* Thread function for the test thread in the subprocess.  */
-+static void *
-+subprocess_thread (void *closure)
-+{
-+  /* Wait until altered_by_debugger changes the value away from 0.  */
-+  while (altered_by_debugger == 0)
-+    {
-+      usleep (100 * 1000);
-+      debugger_inspection_point ();
-+    }
-+
-+  TEST_COMPARE (altered_by_debugger, 2);
-+  return NULL;
-+}
-+
-+/* This function implements the subprocess under test.  It creates a
-+   second thread, waiting for its value to change to 2, and checks
-+   that the main thread also changed its value to 1.  */
-+static void
-+in_subprocess (void)
-+{
-+  pthread_t thr = xpthread_create (NULL, subprocess_thread, NULL);
-+  TEST_VERIFY (xpthread_join (thr) == NULL);
-+  TEST_COMPARE (altered_by_debugger, 1);
-+  _exit (0);
-+}
-+
-+static int
-+do_test (void)
-+{
-+  pid_t tested_pid = xfork ();
-+  if (tested_pid == 0)
-+    in_subprocess ();
-+  char *tested_pid_string = xasprintf ("%d", tested_pid);
-+
-+  char *gdbscript;
-+  xclose (create_temp_file ("tst-pthread-gdb-attach-", &gdbscript));
-+  write_gdbscript (gdbscript, tested_pid);
-+
-+  pid_t gdb_pid = xfork ();
-+  if (gdb_pid == 0)
-+    {
-+      clearenv ();
-+      xdup2 (STDOUT_FILENO, STDERR_FILENO);
-+      execlp ("gdb", "gdb", "-nx", "-batch", "-x", gdbscript, NULL);
-+      if (errno == ENOENT)
-+        _exit (EXIT_UNSUPPORTED);
-+      else
-+        _exit (1);
-+    }
-+
-+  int status;
-+  TEST_COMPARE (xwaitpid (gdb_pid, &status, 0), gdb_pid);
-+  if (WIFEXITED (status) && WEXITSTATUS (status) == EXIT_UNSUPPORTED)
-+    /* gdb is not installed.  */
-+    return EXIT_UNSUPPORTED;
-+  TEST_COMPARE (status, 0);
-+  TEST_COMPARE (xwaitpid (tested_pid, &status, 0), tested_pid);
-+  TEST_COMPARE (status, 0);
-+
-+  free (tested_pid_string);
-+  free (gdbscript);
-+  return 0;
-+}
-+
-+#include <support/test-driver.c>
-diff --git a/nptl_db/structs.def b/nptl_db/structs.def
-index 999a9fc35a..8a613dd2f5 100644
---- a/nptl_db/structs.def
-+++ b/nptl_db/structs.def
-@@ -100,8 +100,7 @@ DB_STRUCT_FIELD (pthread, dtvp)
- #endif
- 
- #if !(IS_IN (libpthread) && !defined SHARED)
--DB_STRUCT (rtld_global)
--DB_RTLD_VARIABLE (_rtld_global)
-+DB_VARIABLE (__nptl_rtld_global)
- #endif
- DB_RTLD_GLOBAL_FIELD (dl_tls_dtv_slotinfo_list)
- DB_RTLD_GLOBAL_FIELD (dl_stack_user)
-diff --git a/nptl_db/td_init.c b/nptl_db/td_init.c
-index 1d15681228..06b5adc5c2 100644
---- a/nptl_db/td_init.c
-+++ b/nptl_db/td_init.c
-@@ -33,13 +33,14 @@ td_init (void)
- bool
- __td_ta_rtld_global (td_thragent_t *ta)
- {
--  if (ta->ta_addr__rtld_global == 0
--      && td_mod_lookup (ta->ph, LD_SO, SYM__rtld_global,
--                        &ta->ta_addr__rtld_global) != PS_OK)
-+  if (ta->ta_addr__rtld_global == 0)
-     {
--      ta->ta_addr__rtld_global = (void*)-1;
--      return false;
-+      psaddr_t rtldglobalp;
-+      if (DB_GET_VALUE (rtldglobalp, ta, __nptl_rtld_global, 0) == TD_OK)
-+        ta->ta_addr__rtld_global = rtldglobalp;
-+      else
-+        ta->ta_addr__rtld_global = (void *) -1;
-     }
--  else
--    return ta->ta_addr__rtld_global != (void*)-1;
-+
-+  return ta->ta_addr__rtld_global != (void *)-1;
- }
-diff --git a/nptl_db/thread_dbP.h b/nptl_db/thread_dbP.h
-index 580a70c471..712fa3aeb6 100644
---- a/nptl_db/thread_dbP.h
-+++ b/nptl_db/thread_dbP.h
-@@ -108,6 +108,8 @@ struct td_thragent
- # undef DB_SYMBOL
- # undef DB_VARIABLE
- 
-+  psaddr_t ta_addr__rtld_global;
-+
-   /* The method of locating a thread's th_unique value.  */
-   enum
-     {
--- 
-2.31.1
-

Copied: glibc/repos/staging-x86_64/0001-nptl_db-Support-different-libpthread-ld.so-load-orde.patch (from rev 436749, glibc/trunk/0001-nptl_db-Support-different-libpthread-ld.so-load-orde.patch)
===================================================================
--- 0001-nptl_db-Support-different-libpthread-ld.so-load-orde.patch	                        (rev 0)
+++ 0001-nptl_db-Support-different-libpthread-ld.so-load-orde.patch	2022-02-09 17:48:32 UTC (rev 436750)
@@ -0,0 +1,308 @@
+From a64afc225240b2b27129ccfb0516d7c958b98040 Mon Sep 17 00:00:00 2001
+From: Florian Weimer <fweimer at redhat.com>
+Date: Wed, 21 Apr 2021 11:50:43 +0200
+Subject: [PATCH 364/576] nptl_db: Support different libpthread/ld.so load
+ orders (bug 27744)
+
+libthread_db is loaded once GDB encounters libpthread, and at this
+point, ld.so may not have been processed by GDB yet. As a result,
+_rtld_global cannot be accessed by regular means from libthread_db.
+To make this work until GDB can be fixed, acess _rtld_global through
+a pointer stored in libpthread.
+
+The new test does not reproduce bug 27744 with
+--disable-hardcoded-path-in-tests, but is still a valid smoke test.
+With --enable-hardcoded-path-in-tests, it is necessary to avoid
+add-symbol-file because this can tickle a GDB bug.
+
+Fixes commit 1daccf403b1bd86370eb94edca794dc106d02039 ("nptl: Move
+stack list variables into _rtld_global").
+
+Tested-by: Emil Velikov <emil.velikov at collabora.com>
+---
+ nptl/Makefile                        |  19 +++-
+ nptl/pthread_create.c                |   8 ++
+ nptl/tst-pthread-gdb-attach-static.c |   1 +
+ nptl/tst-pthread-gdb-attach.c        | 143 +++++++++++++++++++++++++++
+ nptl_db/structs.def                  |   3 +-
+ nptl_db/td_init.c                    |  15 +--
+ nptl_db/thread_dbP.h                 |   2 +
+ 7 files changed, 180 insertions(+), 11 deletions(-)
+ create mode 100644 nptl/tst-pthread-gdb-attach-static.c
+ create mode 100644 nptl/tst-pthread-gdb-attach.c
+
+diff --git a/nptl/Makefile b/nptl/Makefile
+index 8fe92d43fa..e665d37e52 100644
+--- a/nptl/Makefile
++++ b/nptl/Makefile
+@@ -313,7 +313,8 @@ tests = tst-attr2 tst-attr3 tst-default-attr \
+ 	tst-thread-affinity-sched \
+ 	tst-pthread-defaultattr-free \
+ 	tst-pthread-attr-sigmask \
+-	tst-pthread-timedlock-lockloop
++	tst-pthread-timedlock-lockloop \
++	tst-pthread-gdb-attach tst-pthread-gdb-attach-static
+ 
+ tests-container =  tst-pthread-getattr
+ 
+@@ -359,6 +360,19 @@ CPPFLAGS-test-cond-printers.c := $(CFLAGS-printers-tests)
+ CPPFLAGS-test-rwlockattr-printers.c := $(CFLAGS-printers-tests)
+ CPPFLAGS-test-rwlock-printers.c := $(CFLAGS-printers-tests)
+ 
++# Reuse the CFLAGS setting for the GDB attaching test.  It needs
++# debugging information.
++CFLAGS-tst-pthread-gdb-attach.c := $(CFLAGS-printers-tests)
++CPPFLAGS-tst-pthread-gdb-attach.c := $(CFLAGS-printers-tests)
++ifeq ($(build-shared)$(build-hardcoded-path-in-tests),yesno)
++CPPFLAGS-tst-pthread-gdb-attach.c += -DDO_ADD_SYMBOL_FILE=1
++else
++CPPFLAGS-tst-pthread-gdb-attach.c += -DDO_ADD_SYMBOL_FILE=0
++endif
++CFLAGS-tst-pthread-gdb-attach-static.c := $(CFLAGS-printers-tests)
++CPPFLAGS-tst-pthread-gdb-attach-static.c := \
++  $(CFLAGS-printers-tests) -DDO_ADD_SYMBOL_FILE=0
++
+ ifeq ($(build-shared),yes)
+ tests-printers-libs := $(shared-thread-library)
+ else
+@@ -430,7 +444,8 @@ link-libc-static := $(common-objpfx)libc.a $(static-gnulib) \
+ tests-static += tst-stackguard1-static \
+ 		tst-cancel24-static \
+ 		tst-mutex8-static tst-mutexpi8-static tst-sem11-static \
+-		tst-sem12-static tst-cond11-static
++		tst-sem12-static tst-cond11-static \
++		tst-pthread-gdb-attach-static
+ 
+ tests += tst-cancel24-static
+ 
+diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
+index 6c645aff48..f13d8e44a4 100644
+--- a/nptl/pthread_create.c
++++ b/nptl/pthread_create.c
+@@ -51,6 +51,14 @@ static td_thr_events_t __nptl_threads_events __attribute_used__;
+ /* Pointer to descriptor with the last event.  */
+ static struct pthread *__nptl_last_event __attribute_used__;
+ 
++#ifdef SHARED
++/* This variable is used to access _rtld_global from libthread_db.  If
++   GDB loads libpthread before ld.so, it is not possible to resolve
++   _rtld_global directly during libpthread initialization.  */
++static struct rtld_global *__nptl_rtld_global __attribute_used__
++  = &_rtld_global;
++#endif
++
+ /* Number of threads running.  */
+ unsigned int __nptl_nthreads = 1;
+ 
+diff --git a/nptl/tst-pthread-gdb-attach-static.c b/nptl/tst-pthread-gdb-attach-static.c
+new file mode 100644
+index 0000000000..e159632cac
+--- /dev/null
++++ b/nptl/tst-pthread-gdb-attach-static.c
+@@ -0,0 +1 @@
++#include "tst-pthread-gdb-attach.c"
+diff --git a/nptl/tst-pthread-gdb-attach.c b/nptl/tst-pthread-gdb-attach.c
+new file mode 100644
+index 0000000000..0603ad844d
+--- /dev/null
++++ b/nptl/tst-pthread-gdb-attach.c
+@@ -0,0 +1,143 @@
++/* Smoke testing GDB process attach with thread-local variable access.
++   Copyright (C) 2021 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
++   <https://www.gnu.org/licenses/>.  */
++
++/* This test runs GDB against a forked copy of itself, to check
++   whether libthread_db can be loaded, and that access to thread-local
++   variables works.  */
++
++#include <errno.h>
++#include <stdlib.h>
++#include <support/check.h>
++#include <support/support.h>
++#include <support/temp_file.h>
++#include <support/test-driver.h>
++#include <support/xstdio.h>
++#include <support/xthread.h>
++#include <support/xunistd.h>
++#include <unistd.h>
++
++/* Starts out as zero, changed to 1 or 2 by the debugger, depending on
++   the thread.  */
++__thread volatile int altered_by_debugger;
++
++/* Writes the GDB script to run the test to PATH.  */
++static void
++write_gdbscript (const char *path, int tested_pid)
++{
++  FILE *fp = xfopen (path, "w");
++  fprintf (fp,
++           "set trace-commands on\n"
++           "set debug libthread-db 1\n"
++#if DO_ADD_SYMBOL_FILE
++           /* Do not do this unconditionally to work around a GDB
++              assertion failure: ../../gdb/symtab.c:6404:
++              internal-error: CORE_ADDR get_msymbol_address(objfile*,
++              const minimal_symbol*): Assertion `(objf->flags &
++              OBJF_MAINLINE) == 0' failed.  */
++           "add-symbol-file %1$s/nptl/tst-pthread-gdb-attach\n"
++#endif
++           "set auto-load safe-path %1$s/nptl_db\n"
++           "set libthread-db-search-path %1$s/nptl_db\n"
++           "attach %2$d\n",
++           support_objdir_root, tested_pid);
++  fputs ("break debugger_inspection_point\n"
++         "continue\n"
++         "thread 1\n"
++         "print altered_by_debugger\n"
++         "print altered_by_debugger = 1\n"
++         "thread 2\n"
++         "print altered_by_debugger\n"
++         "print altered_by_debugger = 2\n"
++         "continue\n",
++         fp);
++  xfclose (fp);
++}
++
++/* The test sets a breakpoint on this function and alters the
++   altered_by_debugger thread-local variable.  */
++void __attribute__ ((weak))
++debugger_inspection_point (void)
++{
++}
++
++/* Thread function for the test thread in the subprocess.  */
++static void *
++subprocess_thread (void *closure)
++{
++  /* Wait until altered_by_debugger changes the value away from 0.  */
++  while (altered_by_debugger == 0)
++    {
++      usleep (100 * 1000);
++      debugger_inspection_point ();
++    }
++
++  TEST_COMPARE (altered_by_debugger, 2);
++  return NULL;
++}
++
++/* This function implements the subprocess under test.  It creates a
++   second thread, waiting for its value to change to 2, and checks
++   that the main thread also changed its value to 1.  */
++static void
++in_subprocess (void)
++{
++  pthread_t thr = xpthread_create (NULL, subprocess_thread, NULL);
++  TEST_VERIFY (xpthread_join (thr) == NULL);
++  TEST_COMPARE (altered_by_debugger, 1);
++  _exit (0);
++}
++
++static int
++do_test (void)
++{
++  pid_t tested_pid = xfork ();
++  if (tested_pid == 0)
++    in_subprocess ();
++  char *tested_pid_string = xasprintf ("%d", tested_pid);
++
++  char *gdbscript;
++  xclose (create_temp_file ("tst-pthread-gdb-attach-", &gdbscript));
++  write_gdbscript (gdbscript, tested_pid);
++
++  pid_t gdb_pid = xfork ();
++  if (gdb_pid == 0)
++    {
++      clearenv ();
++      xdup2 (STDOUT_FILENO, STDERR_FILENO);
++      execlp ("gdb", "gdb", "-nx", "-batch", "-x", gdbscript, NULL);
++      if (errno == ENOENT)
++        _exit (EXIT_UNSUPPORTED);
++      else
++        _exit (1);
++    }
++
++  int status;
++  TEST_COMPARE (xwaitpid (gdb_pid, &status, 0), gdb_pid);
++  if (WIFEXITED (status) && WEXITSTATUS (status) == EXIT_UNSUPPORTED)
++    /* gdb is not installed.  */
++    return EXIT_UNSUPPORTED;
++  TEST_COMPARE (status, 0);
++  TEST_COMPARE (xwaitpid (tested_pid, &status, 0), tested_pid);
++  TEST_COMPARE (status, 0);
++
++  free (tested_pid_string);
++  free (gdbscript);
++  return 0;
++}
++
++#include <support/test-driver.c>
+diff --git a/nptl_db/structs.def b/nptl_db/structs.def
+index 999a9fc35a..8a613dd2f5 100644
+--- a/nptl_db/structs.def
++++ b/nptl_db/structs.def
+@@ -100,8 +100,7 @@ DB_STRUCT_FIELD (pthread, dtvp)
+ #endif
+ 
+ #if !(IS_IN (libpthread) && !defined SHARED)
+-DB_STRUCT (rtld_global)
+-DB_RTLD_VARIABLE (_rtld_global)
++DB_VARIABLE (__nptl_rtld_global)
+ #endif
+ DB_RTLD_GLOBAL_FIELD (dl_tls_dtv_slotinfo_list)
+ DB_RTLD_GLOBAL_FIELD (dl_stack_user)
+diff --git a/nptl_db/td_init.c b/nptl_db/td_init.c
+index 1d15681228..06b5adc5c2 100644
+--- a/nptl_db/td_init.c
++++ b/nptl_db/td_init.c
+@@ -33,13 +33,14 @@ td_init (void)
+ bool
+ __td_ta_rtld_global (td_thragent_t *ta)
+ {
+-  if (ta->ta_addr__rtld_global == 0
+-      && td_mod_lookup (ta->ph, LD_SO, SYM__rtld_global,
+-                        &ta->ta_addr__rtld_global) != PS_OK)
++  if (ta->ta_addr__rtld_global == 0)
+     {
+-      ta->ta_addr__rtld_global = (void*)-1;
+-      return false;
++      psaddr_t rtldglobalp;
++      if (DB_GET_VALUE (rtldglobalp, ta, __nptl_rtld_global, 0) == TD_OK)
++        ta->ta_addr__rtld_global = rtldglobalp;
++      else
++        ta->ta_addr__rtld_global = (void *) -1;
+     }
+-  else
+-    return ta->ta_addr__rtld_global != (void*)-1;
++
++  return ta->ta_addr__rtld_global != (void *)-1;
+ }
+diff --git a/nptl_db/thread_dbP.h b/nptl_db/thread_dbP.h
+index 580a70c471..712fa3aeb6 100644
+--- a/nptl_db/thread_dbP.h
++++ b/nptl_db/thread_dbP.h
+@@ -108,6 +108,8 @@ struct td_thragent
+ # undef DB_SYMBOL
+ # undef DB_VARIABLE
+ 
++  psaddr_t ta_addr__rtld_global;
++
+   /* The method of locating a thread's th_unique value.  */
+   enum
+     {
+-- 
+2.31.1
+

Deleted: 0002-nptl-Check-for-compatible-GDB-in-nptl-tst-pthread-gd.patch
===================================================================
--- 0002-nptl-Check-for-compatible-GDB-in-nptl-tst-pthread-gd.patch	2022-02-09 17:44:01 UTC (rev 436749)
+++ 0002-nptl-Check-for-compatible-GDB-in-nptl-tst-pthread-gd.patch	2022-02-09 17:48:32 UTC (rev 436750)
@@ -1,135 +0,0 @@
-From f553dc066071a4465321fbc122bed8a75afd996b Mon Sep 17 00:00:00 2001
-From: Florian Weimer <fweimer at redhat.com>
-Date: Thu, 22 Apr 2021 11:07:43 +0200
-Subject: [PATCH 405/576] nptl: Check for compatible GDB in
- nptl/tst-pthread-gdb-attach
-
-Also do not clear the subprocess environment, in case running
-GDB needs certain environment variables.
----
- nptl/tst-pthread-gdb-attach.c | 78 ++++++++++++++++++++++++++++++++++-
- 1 file changed, 76 insertions(+), 2 deletions(-)
-
-diff --git a/nptl/tst-pthread-gdb-attach.c b/nptl/tst-pthread-gdb-attach.c
-index 0603ad844d..901a120034 100644
---- a/nptl/tst-pthread-gdb-attach.c
-+++ b/nptl/tst-pthread-gdb-attach.c
-@@ -20,8 +20,12 @@
-    whether libthread_db can be loaded, and that access to thread-local
-    variables works.  */
- 
-+#include <elf.h>
- #include <errno.h>
-+#include <fcntl.h>
-+#include <stdbool.h>
- #include <stdlib.h>
-+#include <string.h>
- #include <support/check.h>
- #include <support/support.h>
- #include <support/temp_file.h>
-@@ -35,6 +39,49 @@
-    the thread.  */
- __thread volatile int altered_by_debugger;
- 
-+/* Common prefix between 32-bit and 64-bit ELF.  */
-+struct elf_prefix
-+{
-+  unsigned char e_ident[EI_NIDENT];
-+  uint16_t e_type;
-+  uint16_t e_machine;
-+  uint32_t e_version;
-+};
-+_Static_assert (sizeof (struct elf_prefix) == EI_NIDENT + 8,
-+                "padding in struct elf_prefix");
-+
-+/* Reads the ELF header from PATH.  Returns true if the header can be
-+   read, false if the file is too short.  */
-+static bool
-+read_elf_header (const char *path, struct elf_prefix *elf)
-+{
-+  int fd = xopen (path, O_RDONLY, 0);
-+  bool result = read (fd, elf, sizeof (*elf)) == sizeof (*elf);
-+  xclose (fd);
-+  return result;
-+}
-+
-+/* Searches for "gdb" alongside the path variable.  See execvpe.  */
-+static char *
-+find_gdb (void)
-+{
-+  const char *path = getenv ("PATH");
-+  if (path == NULL)
-+    return NULL;
-+  while (true)
-+    {
-+      const char *colon = strchrnul (path, ':');
-+      char *candidate = xasprintf ("%.*s/gdb", (int) (colon - path), path);
-+      if (access (candidate, X_OK) == 0)
-+        return candidate;
-+      free (candidate);
-+      if (*colon == '\0')
-+        break;
-+      path = colon + 1;
-+    }
-+  return NULL;
-+}
-+
- /* Writes the GDB script to run the test to PATH.  */
- static void
- write_gdbscript (const char *path, int tested_pid)
-@@ -105,6 +152,33 @@ in_subprocess (void)
- static int
- do_test (void)
- {
-+  char *gdb_path = find_gdb ();
-+  if (gdb_path == NULL)
-+    FAIL_UNSUPPORTED ("gdb command not found in PATH: %s", getenv ("PATH"));
-+
-+  /* Check that libthread_db is compatible with the gdb architecture
-+     because gdb loads it via dlopen.  */
-+  {
-+    char *threaddb_path = xasprintf ("%s/nptl_db/libthread_db.so",
-+                                     support_objdir_root);
-+    struct elf_prefix elf_threaddb;
-+    TEST_VERIFY_EXIT (read_elf_header (threaddb_path, &elf_threaddb));
-+    struct elf_prefix elf_gdb;
-+    /* If the ELF header cannot be read or "gdb" is not an ELF file,
-+       assume this is a wrapper script that can run.  */
-+    if (read_elf_header (gdb_path, &elf_gdb)
-+        && memcmp (&elf_gdb, ELFMAG, SELFMAG) == 0)
-+      {
-+        if (elf_gdb.e_ident[EI_CLASS] != elf_threaddb.e_ident[EI_CLASS])
-+          FAIL_UNSUPPORTED ("GDB at %s has wrong class", gdb_path);
-+        if (elf_gdb.e_ident[EI_DATA] != elf_threaddb.e_ident[EI_DATA])
-+          FAIL_UNSUPPORTED ("GDB at %s has wrong data", gdb_path);
-+        if (elf_gdb.e_machine != elf_threaddb.e_machine)
-+          FAIL_UNSUPPORTED ("GDB at %s has wrong machine", gdb_path);
-+      }
-+    free (threaddb_path);
-+  }
-+
-   pid_t tested_pid = xfork ();
-   if (tested_pid == 0)
-     in_subprocess ();
-@@ -117,9 +191,8 @@ do_test (void)
-   pid_t gdb_pid = xfork ();
-   if (gdb_pid == 0)
-     {
--      clearenv ();
-       xdup2 (STDOUT_FILENO, STDERR_FILENO);
--      execlp ("gdb", "gdb", "-nx", "-batch", "-x", gdbscript, NULL);
-+      execl (gdb_path, "gdb", "-nx", "-batch", "-x", gdbscript, NULL);
-       if (errno == ENOENT)
-         _exit (EXIT_UNSUPPORTED);
-       else
-@@ -137,6 +210,7 @@ do_test (void)
- 
-   free (tested_pid_string);
-   free (gdbscript);
-+  free (gdb_path);
-   return 0;
- }
- 
--- 
-2.31.1
-

Copied: glibc/repos/staging-x86_64/0002-nptl-Check-for-compatible-GDB-in-nptl-tst-pthread-gd.patch (from rev 436749, glibc/trunk/0002-nptl-Check-for-compatible-GDB-in-nptl-tst-pthread-gd.patch)
===================================================================
--- 0002-nptl-Check-for-compatible-GDB-in-nptl-tst-pthread-gd.patch	                        (rev 0)
+++ 0002-nptl-Check-for-compatible-GDB-in-nptl-tst-pthread-gd.patch	2022-02-09 17:48:32 UTC (rev 436750)
@@ -0,0 +1,135 @@
+From f553dc066071a4465321fbc122bed8a75afd996b Mon Sep 17 00:00:00 2001
+From: Florian Weimer <fweimer at redhat.com>
+Date: Thu, 22 Apr 2021 11:07:43 +0200
+Subject: [PATCH 405/576] nptl: Check for compatible GDB in
+ nptl/tst-pthread-gdb-attach
+
+Also do not clear the subprocess environment, in case running
+GDB needs certain environment variables.
+---
+ nptl/tst-pthread-gdb-attach.c | 78 ++++++++++++++++++++++++++++++++++-
+ 1 file changed, 76 insertions(+), 2 deletions(-)
+
+diff --git a/nptl/tst-pthread-gdb-attach.c b/nptl/tst-pthread-gdb-attach.c
+index 0603ad844d..901a120034 100644
+--- a/nptl/tst-pthread-gdb-attach.c
++++ b/nptl/tst-pthread-gdb-attach.c
+@@ -20,8 +20,12 @@
+    whether libthread_db can be loaded, and that access to thread-local
+    variables works.  */
+ 
++#include <elf.h>
+ #include <errno.h>
++#include <fcntl.h>
++#include <stdbool.h>
+ #include <stdlib.h>
++#include <string.h>
+ #include <support/check.h>
+ #include <support/support.h>
+ #include <support/temp_file.h>
+@@ -35,6 +39,49 @@
+    the thread.  */
+ __thread volatile int altered_by_debugger;
+ 
++/* Common prefix between 32-bit and 64-bit ELF.  */
++struct elf_prefix
++{
++  unsigned char e_ident[EI_NIDENT];
++  uint16_t e_type;
++  uint16_t e_machine;
++  uint32_t e_version;
++};
++_Static_assert (sizeof (struct elf_prefix) == EI_NIDENT + 8,
++                "padding in struct elf_prefix");
++
++/* Reads the ELF header from PATH.  Returns true if the header can be
++   read, false if the file is too short.  */
++static bool
++read_elf_header (const char *path, struct elf_prefix *elf)
++{
++  int fd = xopen (path, O_RDONLY, 0);
++  bool result = read (fd, elf, sizeof (*elf)) == sizeof (*elf);
++  xclose (fd);
++  return result;
++}
++
++/* Searches for "gdb" alongside the path variable.  See execvpe.  */
++static char *
++find_gdb (void)
++{
++  const char *path = getenv ("PATH");
++  if (path == NULL)
++    return NULL;
++  while (true)
++    {
++      const char *colon = strchrnul (path, ':');
++      char *candidate = xasprintf ("%.*s/gdb", (int) (colon - path), path);
++      if (access (candidate, X_OK) == 0)
++        return candidate;
++      free (candidate);
++      if (*colon == '\0')
++        break;
++      path = colon + 1;
++    }
++  return NULL;
++}
++
+ /* Writes the GDB script to run the test to PATH.  */
+ static void
+ write_gdbscript (const char *path, int tested_pid)
+@@ -105,6 +152,33 @@ in_subprocess (void)
+ static int
+ do_test (void)
+ {
++  char *gdb_path = find_gdb ();
++  if (gdb_path == NULL)
++    FAIL_UNSUPPORTED ("gdb command not found in PATH: %s", getenv ("PATH"));
++
++  /* Check that libthread_db is compatible with the gdb architecture
++     because gdb loads it via dlopen.  */
++  {
++    char *threaddb_path = xasprintf ("%s/nptl_db/libthread_db.so",
++                                     support_objdir_root);
++    struct elf_prefix elf_threaddb;
++    TEST_VERIFY_EXIT (read_elf_header (threaddb_path, &elf_threaddb));
++    struct elf_prefix elf_gdb;
++    /* If the ELF header cannot be read or "gdb" is not an ELF file,
++       assume this is a wrapper script that can run.  */
++    if (read_elf_header (gdb_path, &elf_gdb)
++        && memcmp (&elf_gdb, ELFMAG, SELFMAG) == 0)
++      {
++        if (elf_gdb.e_ident[EI_CLASS] != elf_threaddb.e_ident[EI_CLASS])
++          FAIL_UNSUPPORTED ("GDB at %s has wrong class", gdb_path);
++        if (elf_gdb.e_ident[EI_DATA] != elf_threaddb.e_ident[EI_DATA])
++          FAIL_UNSUPPORTED ("GDB at %s has wrong data", gdb_path);
++        if (elf_gdb.e_machine != elf_threaddb.e_machine)
++          FAIL_UNSUPPORTED ("GDB at %s has wrong machine", gdb_path);
++      }
++    free (threaddb_path);
++  }
++
+   pid_t tested_pid = xfork ();
+   if (tested_pid == 0)
+     in_subprocess ();
+@@ -117,9 +191,8 @@ do_test (void)
+   pid_t gdb_pid = xfork ();
+   if (gdb_pid == 0)
+     {
+-      clearenv ();
+       xdup2 (STDOUT_FILENO, STDERR_FILENO);
+-      execlp ("gdb", "gdb", "-nx", "-batch", "-x", gdbscript, NULL);
++      execl (gdb_path, "gdb", "-nx", "-batch", "-x", gdbscript, NULL);
+       if (errno == ENOENT)
+         _exit (EXIT_UNSUPPORTED);
+       else
+@@ -137,6 +210,7 @@ do_test (void)
+ 
+   free (tested_pid_string);
+   free (gdbscript);
++  free (gdb_path);
+   return 0;
+ }
+ 
+-- 
+2.31.1
+

Deleted: 0003-nptl-Do-not-build-nptl-tst-pthread-gdb-attach-as-PIE.patch
===================================================================
--- 0003-nptl-Do-not-build-nptl-tst-pthread-gdb-attach-as-PIE.patch	2022-02-09 17:44:01 UTC (rev 436749)
+++ 0003-nptl-Do-not-build-nptl-tst-pthread-gdb-attach-as-PIE.patch	2022-02-09 17:48:32 UTC (rev 436750)
@@ -1,26 +0,0 @@
-From 6f3e54d404cfe1ba7d1444e6dfcfd77b102d9287 Mon Sep 17 00:00:00 2001
-From: Florian Weimer <fweimer at redhat.com>
-Date: Thu, 22 Apr 2021 19:53:15 +0200
-Subject: [PATCH 409/576] nptl: Do not build nptl/tst-pthread-gdb-attach as PIE
-
----
- nptl/Makefile | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/nptl/Makefile b/nptl/Makefile
-index a3d1ef8d66..294bb2faa4 100644
---- a/nptl/Makefile
-+++ b/nptl/Makefile
-@@ -377,6 +377,9 @@ endif
- CFLAGS-tst-pthread-gdb-attach-static.c := $(CFLAGS-printers-tests)
- CPPFLAGS-tst-pthread-gdb-attach-static.c := \
-   $(CFLAGS-printers-tests) -DDO_ADD_SYMBOL_FILE=0
-+# As of version 9.2, GDB cannot attach properly to PIE programs that
-+# were launched with an explicit ld.so invocation.
-+tst-pthread-gdb-attach-no-pie = yes
- 
- ifeq ($(build-shared),yes)
- tests-printers-libs := $(shared-thread-library)
--- 
-2.31.1
-

Copied: glibc/repos/staging-x86_64/0003-nptl-Do-not-build-nptl-tst-pthread-gdb-attach-as-PIE.patch (from rev 436749, glibc/trunk/0003-nptl-Do-not-build-nptl-tst-pthread-gdb-attach-as-PIE.patch)
===================================================================
--- 0003-nptl-Do-not-build-nptl-tst-pthread-gdb-attach-as-PIE.patch	                        (rev 0)
+++ 0003-nptl-Do-not-build-nptl-tst-pthread-gdb-attach-as-PIE.patch	2022-02-09 17:48:32 UTC (rev 436750)
@@ -0,0 +1,26 @@
+From 6f3e54d404cfe1ba7d1444e6dfcfd77b102d9287 Mon Sep 17 00:00:00 2001
+From: Florian Weimer <fweimer at redhat.com>
+Date: Thu, 22 Apr 2021 19:53:15 +0200
+Subject: [PATCH 409/576] nptl: Do not build nptl/tst-pthread-gdb-attach as PIE
+
+---
+ nptl/Makefile | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/nptl/Makefile b/nptl/Makefile
+index a3d1ef8d66..294bb2faa4 100644
+--- a/nptl/Makefile
++++ b/nptl/Makefile
+@@ -377,6 +377,9 @@ endif
+ CFLAGS-tst-pthread-gdb-attach-static.c := $(CFLAGS-printers-tests)
+ CPPFLAGS-tst-pthread-gdb-attach-static.c := \
+   $(CFLAGS-printers-tests) -DDO_ADD_SYMBOL_FILE=0
++# As of version 9.2, GDB cannot attach properly to PIE programs that
++# were launched with an explicit ld.so invocation.
++tst-pthread-gdb-attach-no-pie = yes
+ 
+ ifeq ($(build-shared),yes)
+ tests-printers-libs := $(shared-thread-library)
+-- 
+2.31.1
+

Deleted: PKGBUILD
===================================================================
--- PKGBUILD	2022-02-09 17:44:01 UTC (rev 436749)
+++ PKGBUILD	2022-02-09 17:48:32 UTC (rev 436750)
@@ -1,241 +0,0 @@
-# Maintainer: Giancarlo Razzolini <grazzolini at archlinux.org>
-# Maintainer: Frederik Schwan <freswa at archlinux dot org>
-# Contributor: Bartłomiej Piotrowski <bpiotrowski at archlinux.org>
-# Contributor: Allan McRae <allan at archlinux.org>
-
-# toolchain build order: linux-api-headers->glibc->binutils->gcc->glibc->binutils->gcc
-# NOTE: valgrind requires rebuilt with each major glibc version
-
-pkgbase=glibc
-pkgname=(glibc lib32-glibc)
-pkgver=2.35
-pkgrel=1
-arch=(x86_64)
-url='https://www.gnu.org/software/libc'
-license=(GPL LGPL)
-makedepends=(git gd lib32-gcc-libs python)
-optdepends=('perl: for mtrace')
-options=(!strip staticlibs !lto)
-#_commit=3de512be7ea6053255afed6154db9ee31d4e557a
-#source=(git+https://sourceware.org/git/glibc.git#commit=$_commit
-source=(https://ftp.gnu.org/gnu/glibc/glibc-$pkgver.tar.xz{,.sig}
-        locale.gen.txt
-        locale-gen
-        lib32-glibc.conf
-        sdt.h sdt-config.h)
-validpgpkeys=(7273542B39962DF7B299931416792B4EA25340F8 # Carlos O'Donell
-              BC7C7372637EC10C57D7AA6579C43DFBF1CF2187) # Siddhesh Poyarekar
-b2sums=('623c728884f070cd87ffeb9203f74206197c52405ac9bc44f3dd519a3468b8e8ae2536c883e5d17d94417dbd1e91775de2e674314e4ff7424f9720026d6b7063'
-        'SKIP'
-        '46d533d25c7a2ce4ae75d452eee7ebb8e3ce4d191af9be3daa43718b78cb81d33cfd8046a117a15d87de9f5e940448c66005b0490515bf731c9e4691c53908d6'
-        '1f6d927b4972220b1c00abee5329c5d6bc01ed5bee57b20db0c7d7433292f7d666b02baf9968267f8e378b1f3bb273e8eef0ccbf22d21400ac36949d7615a474'
-        '7c265e6d36a5c0dff127093580827d15519b6c7205c2e1300e82f0fb5b9dd00b6accb40c56581f18179c4fbbc95bd2bf1b900ace867a83accde0969f7b609f8a'
-        'a6a5e2f2a627cc0d13d11a82458cfd0aa75ec1c5a3c7647e5d5a3bb1d4c0770887a3909bfda1236803d5bc9801bfd6251e13483e9adf797e4725332cd0d91a0e'
-        '214e995e84b342fe7b2a7704ce011b7c7fc74c2971f98eeb3b4e677b99c860addc0a7d91b8dc0f0b8be7537782ee331999e02ba48f4ccc1c331b60f27d715678')
-
-prepare() {
-  mkdir -p glibc-build lib32-glibc-build
-
-  [[ -d glibc-$pkgver ]] && ln -s glibc-$pkgver glibc 
-  cd glibc
-}
-
-build() {
-  local _configure_flags=(
-      --prefix=/usr
-      --with-headers=/usr/include
-      --with-bugurl=https://bugs.archlinux.org/
-      --enable-add-ons
-      --enable-bind-now
-      --enable-cet
-      --enable-kernel=4.4
-      --enable-lock-elision
-      --enable-multi-arch
-      --enable-stack-protector=strong
-      --enable-stackguard-randomization
-      --enable-static-pie
-      --enable-systemtap
-      --disable-profile
-      --disable-werror
-  )
-
-  cd "$srcdir/glibc-build"
-
-  echo "slibdir=/usr/lib" >> configparms
-  echo "rtlddir=/usr/lib" >> configparms
-  echo "sbindir=/usr/bin" >> configparms
-  echo "rootsbindir=/usr/bin" >> configparms
-
-  # Credits @allanmcrae
-  # https://github.com/allanmcrae/toolchain/blob/f18604d70c5933c31b51a320978711e4e6791cf1/glibc/PKGBUILD
-  # remove fortify for building libraries
-  CFLAGS=${CFLAGS/-Wp,-D_FORTIFY_SOURCE=2/}
-
-  "$srcdir/glibc/configure" \
-      --libdir=/usr/lib \
-      --libexecdir=/usr/lib \
-      ${_configure_flags[@]}
-
-  # build libraries with fortify disabled
-  echo "build-programs=no" >> configparms
-  make -O
-
-  # re-enable fortify for programs
-  sed -i "/build-programs=/s#no#yes#" configparms
-  echo "CFLAGS += -Wp,-D_FORTIFY_SOURCE=2" >> configparms
-  make -O
-
-  # build info pages manually for reprducibility
-  make info
-
-  cd "$srcdir/lib32-glibc-build"
-  export CC="gcc -m32 -mstackrealign"
-  export CXX="g++ -m32 -mstackrealign"
-
-  echo "slibdir=/usr/lib32" >> configparms
-  echo "rtlddir=/usr/lib32" >> configparms
-  echo "sbindir=/usr/bin" >> configparms
-  echo "rootsbindir=/usr/bin" >> configparms
-
-  "$srcdir/glibc/configure" \
-      --host=i686-pc-linux-gnu \
-      --libdir=/usr/lib32 \
-      --libexecdir=/usr/lib32 \
-      ${_configure_flags[@]}
-
-  # build libraries with fortify disabled
-  echo "build-programs=no" >> configparms
-  make -O
-
-  # re-enable fortify for programs
-  sed -i "/build-programs=/s#no#yes#" configparms
-  echo "CFLAGS += -Wp,-D_FORTIFY_SOURCE=2" >> configparms
-  make -O
-
-}
-
-# Credits for skip_test() and check() @allanmcrae
-# https://github.com/allanmcrae/toolchain/blob/f18604d70c5933c31b51a320978711e4e6791cf1/glibc/PKGBUILD
-skip_test() {
-  test=$1
-  file=$2
-  sed -i "s/\b$test\b//" $srcdir/glibc/$file
-}
-
-check() {
-  cd glibc-build
-
-  # adjust/remove buildflags that cause false-positive testsuite failures
-  sed -i '/FORTIFY/d' configparms                                     # failure to build testsuite
-  sed -i 's/-Werror=format-security/-Wformat-security/' config.make   # failure to build testsuite
-  sed -i '/CFLAGS/s/-fno-plt//' config.make                           # 16 failures
-  sed -i '/CFLAGS/s/-fexceptions//' config.make                       # 1 failure
-  LDFLAGS=${LDFLAGS/,-z,now/}                                         # 10 failures
-
-  # The following tests fail due to restrictions in the Arch build system
-  # The correct fix is to add the following to the systemd-nspawn call:
-  # --capability=CAP_IPC_LOCK --system-call-filter="@clock @pkey"
-  skip_test test-errno-linux sysdeps/unix/sysv/linux/Makefile
-  skip_test tst-ntp_gettime  sysdeps/unix/sysv/linux/Makefile
-  skip_test tst-ntp_gettimex sysdeps/unix/sysv/linux/Makefile
-  skip_test tst-mlock2       sysdeps/unix/sysv/linux/Makefile
-  skip_test tst-pkey         sysdeps/unix/sysv/linux/Makefile
-  skip_test tst-adjtime      time/Makefile
-  skip_test tst-clock2       time/Makefile
-
-  make -O check
-}
-
-package_glibc() {
-  pkgdesc='GNU C Library'
-  depends=('linux-api-headers>=4.10' tzdata filesystem)
-  optdepends=('gd: for memusagestat')
-  install=glibc.install
-  backup=(etc/gai.conf
-          etc/locale.gen
-          etc/nscd.conf)
-
-  install -dm755 "$pkgdir/etc"
-  touch "$pkgdir/etc/ld.so.conf"
-
-  make -C glibc-build install_root="$pkgdir" install
-  rm -f "$pkgdir"/etc/ld.so.{cache,conf}
-
-  # Shipped in tzdata
-  rm -f "$pkgdir"/usr/bin/{tzselect,zdump,zic}
-
-  cd glibc
-
-  install -dm755 "$pkgdir"/usr/lib/{locale,systemd/system,tmpfiles.d}
-  install -m644 nscd/nscd.conf "$pkgdir/etc/nscd.conf"
-  install -m644 nscd/nscd.service "$pkgdir/usr/lib/systemd/system"
-  install -m644 nscd/nscd.tmpfiles "$pkgdir/usr/lib/tmpfiles.d/nscd.conf"
-  install -dm755 "$pkgdir/var/db/nscd"
-
-  install -m644 posix/gai.conf "$pkgdir"/etc/gai.conf
-
-  install -m755 "$srcdir/locale-gen" "$pkgdir/usr/bin"
-
-  # Create /etc/locale.gen
-  install -m644 "$srcdir/locale.gen.txt" "$pkgdir/etc/locale.gen"
-  sed -e '1,3d' -e 's|/| |g' -e 's|\\| |g' -e 's|^|#|g' \
-    "$srcdir/glibc/localedata/SUPPORTED" >> "$pkgdir/etc/locale.gen"
-
-  if check_option 'debug' n; then
-    find "$pkgdir"/usr/bin -type f -executable -exec strip $STRIP_BINARIES {} + 2> /dev/null || true
-    find "$pkgdir"/usr/lib -name '*.a' -type f -exec strip $STRIP_STATIC {} + 2> /dev/null || true
-
-    # Do not strip these for gdb and valgrind functionality, but strip the rest
-    find "$pkgdir"/usr/lib \
-      -not -name 'ld-*.so' \
-      -not -name 'libc-*.so' \
-      -not -name 'libpthread-*.so' \
-      -not -name 'libthread_db-*.so' \
-      -name '*-*.so' -type f -exec strip $STRIP_SHARED {} + 2> /dev/null || true
-  fi
-
-  # Provide tracing probes to libstdc++ for exceptions, possibly for other
-  # libraries too. Useful for gdb's catch command.
-  install -Dm644 "$srcdir/sdt.h" "$pkgdir/usr/include/sys/sdt.h"
-  install -Dm644 "$srcdir/sdt-config.h" "$pkgdir/usr/include/sys/sdt-config.h"
-
-  # Provided by libxcrypt; keep the old shared library for backwards compatibility
-  rm -f "$pkgdir"/usr/include/crypt.h "$pkgdir"/usr/lib/libcrypt.{a,so}
-}
-
-package_lib32-glibc() {
-  pkgdesc='GNU C Library (32-bit)'
-  depends=("glibc=$pkgver")
-  options+=('!emptydirs')
-
-  cd lib32-glibc-build
-
-  make install_root="$pkgdir" install
-  rm -rf "$pkgdir"/{etc,sbin,usr/{bin,sbin,share},var}
-
-  # We need to keep 32 bit specific header files
-  find "$pkgdir/usr/include" -type f -not -name '*-32.h' -delete
-
-  # Dynamic linker
-  install -d "$pkgdir/usr/lib"
-  ln -s ../lib32/ld-linux.so.2 "$pkgdir/usr/lib/"
-
-  # Add lib32 paths to the default library search path
-  install -Dm644 "$srcdir/lib32-glibc.conf" "$pkgdir/etc/ld.so.conf.d/lib32-glibc.conf"
-
-  # Symlink /usr/lib32/locale to /usr/lib/locale
-  ln -s ../lib/locale "$pkgdir/usr/lib32/locale"
-
-  if check_option 'debug' n; then
-    find "$pkgdir"/usr/lib32 -name '*.a' -type f -exec strip $STRIP_STATIC {} + 2> /dev/null || true
-    find "$pkgdir"/usr/lib32 \
-      -not -name 'ld-*.so' \
-      -not -name 'libc-*.so' \
-      -not -name 'libpthread-*.so' \
-      -not -name 'libthread_db-*.so' \
-      -name '*-*.so' -type f -exec strip $STRIP_SHARED {} + 2> /dev/null || true
-  fi
-
-  # Provided by lib32-libxcrypt; keep the old shared library for backwards compatibility
-  rm -f "$pkgdir"/usr/lib32/libcrypt.{a,so}
-}

Copied: glibc/repos/staging-x86_64/PKGBUILD (from rev 436749, glibc/trunk/PKGBUILD)
===================================================================
--- PKGBUILD	                        (rev 0)
+++ PKGBUILD	2022-02-09 17:48:32 UTC (rev 436750)
@@ -0,0 +1,241 @@
+# Maintainer: Giancarlo Razzolini <grazzolini at archlinux.org>
+# Maintainer: Frederik Schwan <freswa at archlinux dot org>
+# Contributor: Bartłomiej Piotrowski <bpiotrowski at archlinux.org>
+# Contributor: Allan McRae <allan at archlinux.org>
+
+# toolchain build order: linux-api-headers->glibc->binutils->gcc->glibc->binutils->gcc
+# NOTE: valgrind requires rebuilt with each major glibc version
+
+pkgbase=glibc
+pkgname=(glibc lib32-glibc)
+pkgver=2.35
+pkgrel=1
+arch=(x86_64)
+url='https://www.gnu.org/software/libc'
+license=(GPL LGPL)
+makedepends=(git gd lib32-gcc-libs python)
+optdepends=('perl: for mtrace')
+options=(!strip staticlibs !lto)
+#_commit=3de512be7ea6053255afed6154db9ee31d4e557a
+#source=(git+https://sourceware.org/git/glibc.git#commit=$_commit
+source=(https://ftp.gnu.org/gnu/glibc/glibc-$pkgver.tar.xz{,.sig}
+        locale.gen.txt
+        locale-gen
+        lib32-glibc.conf
+        sdt.h sdt-config.h)
+validpgpkeys=(7273542B39962DF7B299931416792B4EA25340F8 # Carlos O'Donell
+              BC7C7372637EC10C57D7AA6579C43DFBF1CF2187) # Siddhesh Poyarekar
+b2sums=('623c728884f070cd87ffeb9203f74206197c52405ac9bc44f3dd519a3468b8e8ae2536c883e5d17d94417dbd1e91775de2e674314e4ff7424f9720026d6b7063'
+        'SKIP'
+        '46d533d25c7a2ce4ae75d452eee7ebb8e3ce4d191af9be3daa43718b78cb81d33cfd8046a117a15d87de9f5e940448c66005b0490515bf731c9e4691c53908d6'
+        '1f6d927b4972220b1c00abee5329c5d6bc01ed5bee57b20db0c7d7433292f7d666b02baf9968267f8e378b1f3bb273e8eef0ccbf22d21400ac36949d7615a474'
+        '7c265e6d36a5c0dff127093580827d15519b6c7205c2e1300e82f0fb5b9dd00b6accb40c56581f18179c4fbbc95bd2bf1b900ace867a83accde0969f7b609f8a'
+        'a6a5e2f2a627cc0d13d11a82458cfd0aa75ec1c5a3c7647e5d5a3bb1d4c0770887a3909bfda1236803d5bc9801bfd6251e13483e9adf797e4725332cd0d91a0e'
+        '214e995e84b342fe7b2a7704ce011b7c7fc74c2971f98eeb3b4e677b99c860addc0a7d91b8dc0f0b8be7537782ee331999e02ba48f4ccc1c331b60f27d715678')
+
+prepare() {
+  mkdir -p glibc-build lib32-glibc-build
+
+  [[ -d glibc-$pkgver ]] && ln -s glibc-$pkgver glibc 
+  cd glibc
+}
+
+build() {
+  local _configure_flags=(
+      --prefix=/usr
+      --with-headers=/usr/include
+      --with-bugurl=https://bugs.archlinux.org/
+      --enable-add-ons
+      --enable-bind-now
+      --enable-cet
+      --enable-kernel=4.4
+      --enable-lock-elision
+      --enable-multi-arch
+      --enable-stack-protector=strong
+      --enable-stackguard-randomization
+      --enable-static-pie
+      --enable-systemtap
+      --disable-profile
+      --disable-werror
+  )
+
+  cd "$srcdir/glibc-build"
+
+  echo "slibdir=/usr/lib" >> configparms
+  echo "rtlddir=/usr/lib" >> configparms
+  echo "sbindir=/usr/bin" >> configparms
+  echo "rootsbindir=/usr/bin" >> configparms
+
+  # Credits @allanmcrae
+  # https://github.com/allanmcrae/toolchain/blob/f18604d70c5933c31b51a320978711e4e6791cf1/glibc/PKGBUILD
+  # remove fortify for building libraries
+  CFLAGS=${CFLAGS/-Wp,-D_FORTIFY_SOURCE=2/}
+
+  "$srcdir/glibc/configure" \
+      --libdir=/usr/lib \
+      --libexecdir=/usr/lib \
+      ${_configure_flags[@]}
+
+  # build libraries with fortify disabled
+  echo "build-programs=no" >> configparms
+  make -O
+
+  # re-enable fortify for programs
+  sed -i "/build-programs=/s#no#yes#" configparms
+  echo "CFLAGS += -Wp,-D_FORTIFY_SOURCE=2" >> configparms
+  make -O
+
+  # build info pages manually for reprducibility
+  make info
+
+  cd "$srcdir/lib32-glibc-build"
+  export CC="gcc -m32 -mstackrealign"
+  export CXX="g++ -m32 -mstackrealign"
+
+  echo "slibdir=/usr/lib32" >> configparms
+  echo "rtlddir=/usr/lib32" >> configparms
+  echo "sbindir=/usr/bin" >> configparms
+  echo "rootsbindir=/usr/bin" >> configparms
+
+  "$srcdir/glibc/configure" \
+      --host=i686-pc-linux-gnu \
+      --libdir=/usr/lib32 \
+      --libexecdir=/usr/lib32 \
+      ${_configure_flags[@]}
+
+  # build libraries with fortify disabled
+  echo "build-programs=no" >> configparms
+  make -O
+
+  # re-enable fortify for programs
+  sed -i "/build-programs=/s#no#yes#" configparms
+  echo "CFLAGS += -Wp,-D_FORTIFY_SOURCE=2" >> configparms
+  make -O
+
+}
+
+# Credits for skip_test() and check() @allanmcrae
+# https://github.com/allanmcrae/toolchain/blob/f18604d70c5933c31b51a320978711e4e6791cf1/glibc/PKGBUILD
+skip_test() {
+  test=$1
+  file=$2
+  sed -i "s/\b$test\b//" $srcdir/glibc/$file
+}
+
+check() {
+  cd glibc-build
+
+  # adjust/remove buildflags that cause false-positive testsuite failures
+  sed -i '/FORTIFY/d' configparms                                     # failure to build testsuite
+  sed -i 's/-Werror=format-security/-Wformat-security/' config.make   # failure to build testsuite
+  sed -i '/CFLAGS/s/-fno-plt//' config.make                           # 16 failures
+  sed -i '/CFLAGS/s/-fexceptions//' config.make                       # 1 failure
+  LDFLAGS=${LDFLAGS/,-z,now/}                                         # 10 failures
+
+  # The following tests fail due to restrictions in the Arch build system
+  # The correct fix is to add the following to the systemd-nspawn call:
+  # --capability=CAP_IPC_LOCK --system-call-filter="@clock @pkey"
+  skip_test test-errno-linux sysdeps/unix/sysv/linux/Makefile
+  skip_test tst-ntp_gettime  sysdeps/unix/sysv/linux/Makefile
+  skip_test tst-ntp_gettimex sysdeps/unix/sysv/linux/Makefile
+  skip_test tst-mlock2       sysdeps/unix/sysv/linux/Makefile
+  skip_test tst-pkey         sysdeps/unix/sysv/linux/Makefile
+  skip_test tst-adjtime      time/Makefile
+  skip_test tst-clock2       time/Makefile
+
+  make -O check
+}
+
+package_glibc() {
+  pkgdesc='GNU C Library'
+  depends=('linux-api-headers>=4.10' tzdata filesystem)
+  optdepends=('gd: for memusagestat')
+  install=glibc.install
+  backup=(etc/gai.conf
+          etc/locale.gen
+          etc/nscd.conf)
+
+  install -dm755 "$pkgdir/etc"
+  touch "$pkgdir/etc/ld.so.conf"
+
+  make -C glibc-build install_root="$pkgdir" install
+  rm -f "$pkgdir"/etc/ld.so.{cache,conf}
+
+  # Shipped in tzdata
+  rm -f "$pkgdir"/usr/bin/{tzselect,zdump,zic}
+
+  cd glibc
+
+  install -dm755 "$pkgdir"/usr/lib/{locale,systemd/system,tmpfiles.d}
+  install -m644 nscd/nscd.conf "$pkgdir/etc/nscd.conf"
+  install -m644 nscd/nscd.service "$pkgdir/usr/lib/systemd/system"
+  install -m644 nscd/nscd.tmpfiles "$pkgdir/usr/lib/tmpfiles.d/nscd.conf"
+  install -dm755 "$pkgdir/var/db/nscd"
+
+  install -m644 posix/gai.conf "$pkgdir"/etc/gai.conf
+
+  install -m755 "$srcdir/locale-gen" "$pkgdir/usr/bin"
+
+  # Create /etc/locale.gen
+  install -m644 "$srcdir/locale.gen.txt" "$pkgdir/etc/locale.gen"
+  sed -e '1,3d' -e 's|/| |g' -e 's|\\| |g' -e 's|^|#|g' \
+    "$srcdir/glibc/localedata/SUPPORTED" >> "$pkgdir/etc/locale.gen"
+
+  if check_option 'debug' n; then
+    find "$pkgdir"/usr/bin -type f -executable -exec strip $STRIP_BINARIES {} + 2> /dev/null || true
+    find "$pkgdir"/usr/lib -name '*.a' -type f -exec strip $STRIP_STATIC {} + 2> /dev/null || true
+
+    # Do not strip these for gdb and valgrind functionality, but strip the rest
+    find "$pkgdir"/usr/lib \
+      -not -name 'ld-*.so' \
+      -not -name 'libc-*.so' \
+      -not -name 'libpthread-*.so' \
+      -not -name 'libthread_db-*.so' \
+      -name '*-*.so' -type f -exec strip $STRIP_SHARED {} + 2> /dev/null || true
+  fi
+
+  # Provide tracing probes to libstdc++ for exceptions, possibly for other
+  # libraries too. Useful for gdb's catch command.
+  install -Dm644 "$srcdir/sdt.h" "$pkgdir/usr/include/sys/sdt.h"
+  install -Dm644 "$srcdir/sdt-config.h" "$pkgdir/usr/include/sys/sdt-config.h"
+
+  # Provided by libxcrypt; keep the old shared library for backwards compatibility
+  rm -f "$pkgdir"/usr/include/crypt.h "$pkgdir"/usr/lib/libcrypt.{a,so}
+}
+
+package_lib32-glibc() {
+  pkgdesc='GNU C Library (32-bit)'
+  depends=("glibc=$pkgver")
+  options+=('!emptydirs')
+
+  cd lib32-glibc-build
+
+  make install_root="$pkgdir" install
+  rm -rf "$pkgdir"/{etc,sbin,usr/{bin,sbin,share},var}
+
+  # We need to keep 32 bit specific header files
+  find "$pkgdir/usr/include" -type f -not -name '*-32.h' -delete
+
+  # Dynamic linker
+  install -d "$pkgdir/usr/lib"
+  ln -s ../lib32/ld-linux.so.2 "$pkgdir/usr/lib/"
+
+  # Add lib32 paths to the default library search path
+  install -Dm644 "$srcdir/lib32-glibc.conf" "$pkgdir/etc/ld.so.conf.d/lib32-glibc.conf"
+
+  # Symlink /usr/lib32/locale to /usr/lib/locale
+  ln -s ../lib/locale "$pkgdir/usr/lib32/locale"
+
+  if check_option 'debug' n; then
+    find "$pkgdir"/usr/lib32 -name '*.a' -type f -exec strip $STRIP_STATIC {} + 2> /dev/null || true
+    find "$pkgdir"/usr/lib32 \
+      -not -name 'ld-*.so' \
+      -not -name 'libc-*.so' \
+      -not -name 'libpthread-*.so' \
+      -not -name 'libthread_db-*.so' \
+      -name '*-*.so' -type f -exec strip $STRIP_SHARED {} + 2> /dev/null || true
+  fi
+
+  # Provided by lib32-libxcrypt; keep the old shared library for backwards compatibility
+  rm -f "$pkgdir"/usr/lib32/libcrypt.{a,so}
+}

Deleted: bz27343.patch
===================================================================
--- bz27343.patch	2022-02-09 17:44:01 UTC (rev 436749)
+++ bz27343.patch	2022-02-09 17:48:32 UTC (rev 436750)
@@ -1,48 +0,0 @@
-From c3479fb7939898ec22c655c383454d6e8b982a67 Mon Sep 17 00:00:00 2001
-From: Sergei Trofimovich <slyfox at gentoo.org>
-Date: Fri, 5 Feb 2021 07:32:18 +0000
-Subject: [PATCH] nsswitch: return result when nss database is locked [BZ
- #27343]
-
-Before the change nss_database_check_reload_and_get() did not populate
-the '*result' value when it returned success in a case of chroot
-detection. This caused initgroups() to use garage pointer in the
-following test (extracted from unbound):
-
-```
-
-int main() {
-    // load some NSS modules
-    struct passwd * pw = getpwnam("root");
-
-    chdir("/tmp");
-    chroot("/tmp");
-    chdir("/");
-    // access nsswitch.conf in a chroot
-    initgroups("root", 0);
-}
-```
-
-Reviewed-by: DJ Delorie <dj at redhat.com>
----
- nss/nss_database.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/nss/nss_database.c b/nss/nss_database.c
-index cf0306adc4..e1bef6bd75 100644
---- a/nss/nss_database.c
-+++ b/nss/nss_database.c
-@@ -398,8 +398,9 @@ nss_database_check_reload_and_get (struct nss_database_state *local,
- 	  && (str.st_ino != local->root_ino
- 	      ||  str.st_dev != local->root_dev)))
-     {
--      /* Change detected; disable reloading.  */
-+      /* Change detected; disable reloading and return current state.  */
-       atomic_store_release (&local->data.reload_disabled, 1);
-+      *result = local->data.services[database_index];
-       __libc_lock_unlock (local->lock);
-       __nss_module_disable_loading ();
-       return true;
--- 
-2.27.0
-

Copied: glibc/repos/staging-x86_64/bz27343.patch (from rev 436749, glibc/trunk/bz27343.patch)
===================================================================
--- bz27343.patch	                        (rev 0)
+++ bz27343.patch	2022-02-09 17:48:32 UTC (rev 436750)
@@ -0,0 +1,48 @@
+From c3479fb7939898ec22c655c383454d6e8b982a67 Mon Sep 17 00:00:00 2001
+From: Sergei Trofimovich <slyfox at gentoo.org>
+Date: Fri, 5 Feb 2021 07:32:18 +0000
+Subject: [PATCH] nsswitch: return result when nss database is locked [BZ
+ #27343]
+
+Before the change nss_database_check_reload_and_get() did not populate
+the '*result' value when it returned success in a case of chroot
+detection. This caused initgroups() to use garage pointer in the
+following test (extracted from unbound):
+
+```
+
+int main() {
+    // load some NSS modules
+    struct passwd * pw = getpwnam("root");
+
+    chdir("/tmp");
+    chroot("/tmp");
+    chdir("/");
+    // access nsswitch.conf in a chroot
+    initgroups("root", 0);
+}
+```
+
+Reviewed-by: DJ Delorie <dj at redhat.com>
+---
+ nss/nss_database.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/nss/nss_database.c b/nss/nss_database.c
+index cf0306adc4..e1bef6bd75 100644
+--- a/nss/nss_database.c
++++ b/nss/nss_database.c
+@@ -398,8 +398,9 @@ nss_database_check_reload_and_get (struct nss_database_state *local,
+ 	  && (str.st_ino != local->root_ino
+ 	      ||  str.st_dev != local->root_dev)))
+     {
+-      /* Change detected; disable reloading.  */
++      /* Change detected; disable reloading and return current state.  */
+       atomic_store_release (&local->data.reload_disabled, 1);
++      *result = local->data.services[database_index];
+       __libc_lock_unlock (local->lock);
+       __nss_module_disable_loading ();
+       return true;
+-- 
+2.27.0
+

Deleted: glibc.install
===================================================================
--- glibc.install	2022-02-09 17:44:01 UTC (rev 436749)
+++ glibc.install	2022-02-09 17:48:32 UTC (rev 436750)
@@ -1,5 +0,0 @@
-post_upgrade() {
-  locale-gen
-
-  ldconfig -r .
-}

Copied: glibc/repos/staging-x86_64/glibc.install (from rev 436749, glibc/trunk/glibc.install)
===================================================================
--- glibc.install	                        (rev 0)
+++ glibc.install	2022-02-09 17:48:32 UTC (rev 436750)
@@ -0,0 +1,5 @@
+post_upgrade() {
+  locale-gen
+
+  ldconfig -r .
+}

Deleted: lib32-glibc.conf
===================================================================
--- lib32-glibc.conf	2022-02-09 17:44:01 UTC (rev 436749)
+++ lib32-glibc.conf	2022-02-09 17:48:32 UTC (rev 436750)
@@ -1 +0,0 @@
-/usr/lib32

Copied: glibc/repos/staging-x86_64/lib32-glibc.conf (from rev 436749, glibc/trunk/lib32-glibc.conf)
===================================================================
--- lib32-glibc.conf	                        (rev 0)
+++ lib32-glibc.conf	2022-02-09 17:48:32 UTC (rev 436750)
@@ -0,0 +1 @@
+/usr/lib32

Deleted: locale-gen
===================================================================
--- locale-gen	2022-02-09 17:44:01 UTC (rev 436749)
+++ locale-gen	2022-02-09 17:48:32 UTC (rev 436750)
@@ -1,42 +0,0 @@
-#!/bin/sh
-
-set -e
-
-LOCALEGEN=/etc/locale.gen
-LOCALES=/usr/share/i18n/locales
-if [ -n "$POSIXLY_CORRECT" ]; then
-  unset POSIXLY_CORRECT
-fi
-
-
-[ -f $LOCALEGEN -a -s $LOCALEGEN ] || exit 0;
-
-# Remove all old locale dir and locale-archive before generating new
-# locale data.
-rm -rf /usr/lib/locale/* || true
-
-umask 022
-
-is_entry_ok() {
-  if [ -n "$locale" -a -n "$charset" ] ; then
-    true
-  else
-    echo "error: Bad entry '$locale $charset'"
-    false
-  fi
-}
-
-echo "Generating locales..."
-while read locale charset; do \
-	case $locale in \#*) continue;; "") continue;; esac; \
-	is_entry_ok || continue
-	echo -n "  `echo $locale | sed 's/\([^.\@]*\).*/\1/'`"; \
-	echo -n ".$charset"; \
-	echo -n `echo $locale | sed 's/\([^\@]*\)\(\@.*\)*/\2/'`; \
-	echo -n '...'; \
-        if [ -f $LOCALES/$locale ]; then input=$locale; else \
-        input=`echo $locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'`; fi; \
-	localedef -i $input -c -f $charset -A /usr/share/locale/locale.alias $locale; \
-	echo ' done'; \
-done < $LOCALEGEN
-echo "Generation complete."

Copied: glibc/repos/staging-x86_64/locale-gen (from rev 436749, glibc/trunk/locale-gen)
===================================================================
--- locale-gen	                        (rev 0)
+++ locale-gen	2022-02-09 17:48:32 UTC (rev 436750)
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+set -e
+
+LOCALEGEN=/etc/locale.gen
+LOCALES=/usr/share/i18n/locales
+if [ -n "$POSIXLY_CORRECT" ]; then
+  unset POSIXLY_CORRECT
+fi
+
+
+[ -f $LOCALEGEN -a -s $LOCALEGEN ] || exit 0;
+
+# Remove all old locale dir and locale-archive before generating new
+# locale data.
+rm -rf /usr/lib/locale/* || true
+
+umask 022
+
+is_entry_ok() {
+  if [ -n "$locale" -a -n "$charset" ] ; then
+    true
+  else
+    echo "error: Bad entry '$locale $charset'"
+    false
+  fi
+}
+
+echo "Generating locales..."
+while read locale charset; do \
+	case $locale in \#*) continue;; "") continue;; esac; \
+	is_entry_ok || continue
+	echo -n "  `echo $locale | sed 's/\([^.\@]*\).*/\1/'`"; \
+	echo -n ".$charset"; \
+	echo -n `echo $locale | sed 's/\([^\@]*\)\(\@.*\)*/\2/'`; \
+	echo -n '...'; \
+        if [ -f $LOCALES/$locale ]; then input=$locale; else \
+        input=`echo $locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'`; fi; \
+	localedef -i $input -c -f $charset -A /usr/share/locale/locale.alias $locale; \
+	echo ' done'; \
+done < $LOCALEGEN
+echo "Generation complete."

Deleted: locale.gen.txt
===================================================================
--- locale.gen.txt	2022-02-09 17:44:01 UTC (rev 436749)
+++ locale.gen.txt	2022-02-09 17:48:32 UTC (rev 436750)
@@ -1,23 +0,0 @@
-# Configuration file for locale-gen
-#
-# lists of locales that are to be generated by the locale-gen command.
-#
-# Each line is of the form:
-#
-#     <locale> <charset>
-#
-#  where <locale> is one of the locales given in /usr/share/i18n/locales
-#  and <charset> is one of the character sets listed in /usr/share/i18n/charmaps
-#
-#  Examples:
-#  en_US ISO-8859-1
-#  en_US.UTF-8 UTF-8
-#  de_DE ISO-8859-1
-#  de_DE at euro ISO-8859-15
-#
-#  The locale-gen command will generate all the locales,
-#  placing them in /usr/lib/locale.
-#
-#  A list of supported locales is included in this file.
-#  Uncomment the ones you need.
-#

Copied: glibc/repos/staging-x86_64/locale.gen.txt (from rev 436749, glibc/trunk/locale.gen.txt)
===================================================================
--- locale.gen.txt	                        (rev 0)
+++ locale.gen.txt	2022-02-09 17:48:32 UTC (rev 436750)
@@ -0,0 +1,23 @@
+# Configuration file for locale-gen
+#
+# lists of locales that are to be generated by the locale-gen command.
+#
+# Each line is of the form:
+#
+#     <locale> <charset>
+#
+#  where <locale> is one of the locales given in /usr/share/i18n/locales
+#  and <charset> is one of the character sets listed in /usr/share/i18n/charmaps
+#
+#  Examples:
+#  en_US ISO-8859-1
+#  en_US.UTF-8 UTF-8
+#  de_DE ISO-8859-1
+#  de_DE at euro ISO-8859-15
+#
+#  The locale-gen command will generate all the locales,
+#  placing them in /usr/lib/locale.
+#
+#  A list of supported locales is included in this file.
+#  Uncomment the ones you need.
+#

Deleted: sdt-config.h
===================================================================
--- sdt-config.h	2022-02-09 17:44:01 UTC (rev 436749)
+++ sdt-config.h	2022-02-09 17:48:32 UTC (rev 436750)
@@ -1,6 +0,0 @@
-/* includes/sys/sdt-config.h.  Generated from sdt-config.h.in by configure.
-
-   This file just defines _SDT_ASM_SECTION_AUTOGROUP_SUPPORT to 0 or 1 to
-   indicate whether the assembler supports "?" in .pushsection directives.  */
-
-#define _SDT_ASM_SECTION_AUTOGROUP_SUPPORT 1

Copied: glibc/repos/staging-x86_64/sdt-config.h (from rev 436749, glibc/trunk/sdt-config.h)
===================================================================
--- sdt-config.h	                        (rev 0)
+++ sdt-config.h	2022-02-09 17:48:32 UTC (rev 436750)
@@ -0,0 +1,6 @@
+/* includes/sys/sdt-config.h.  Generated from sdt-config.h.in by configure.
+
+   This file just defines _SDT_ASM_SECTION_AUTOGROUP_SUPPORT to 0 or 1 to
+   indicate whether the assembler supports "?" in .pushsection directives.  */
+
+#define _SDT_ASM_SECTION_AUTOGROUP_SUPPORT 1

Deleted: sdt.h
===================================================================
--- sdt.h	2022-02-09 17:44:01 UTC (rev 436749)
+++ sdt.h	2022-02-09 17:48:32 UTC (rev 436750)
@@ -1,430 +0,0 @@
-/* <sys/sdt.h> - Systemtap static probe definition macros.
-
-   This file is dedicated to the public domain, pursuant to CC0
-   (https://creativecommons.org/publicdomain/zero/1.0/)
-*/
-
-#ifndef _SYS_SDT_H
-#define _SYS_SDT_H    1
-
-/*
-  This file defines a family of macros
-
-       STAP_PROBEn(op1, ..., opn)
-
-  that emit a nop into the instruction stream, and some data into an auxiliary
-  note section.  The data in the note section describes the operands, in terms
-  of size and location.  Each location is encoded as assembler operand string.
-  Consumer tools such as gdb or systemtap insert breakpoints on top of
-  the nop, and decode the location operand-strings, like an assembler,
-  to find the values being passed.
-
-  The operand strings are selected by the compiler for each operand.
-  They are constrained by gcc inline-assembler codes.  The default is:
-
-  #define STAP_SDT_ARG_CONSTRAINT nor
-
-  This is a good default if the operands tend to be integral and
-  moderate in number (smaller than number of registers).  In other
-  cases, the compiler may report "'asm' requires impossible reload" or
-  similar.  In this case, consider simplifying the macro call (fewer
-  and simpler operands), reduce optimization, or override the default
-  constraints string via:
-
-  #define STAP_SDT_ARG_CONSTRAINT g
-  #include <sys/sdt.h>
-
-  See also:
-  https://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation
-  https://gcc.gnu.org/onlinedocs/gcc/Constraints.html
- */
-
-
-
-#ifdef __ASSEMBLER__
-# define _SDT_PROBE(provider, name, n, arglist)	\
-  _SDT_ASM_BODY(provider, name, _SDT_ASM_STRING_1, (_SDT_DEPAREN_##n arglist)) \
-  _SDT_ASM_BASE
-# define _SDT_ASM_1(x)			x;
-# define _SDT_ASM_2(a, b)		a,b;
-# define _SDT_ASM_3(a, b, c)		a,b,c;
-# define _SDT_ASM_5(a, b, c, d, e)	a,b,c,d,e;
-# define _SDT_ASM_STRING_1(x)		.asciz #x;
-# define _SDT_DEPAREN_0()				/* empty */
-# define _SDT_DEPAREN_1(a)				a
-# define _SDT_DEPAREN_2(a,b)				a b
-# define _SDT_DEPAREN_3(a,b,c)				a b c
-# define _SDT_DEPAREN_4(a,b,c,d)			a b c d
-# define _SDT_DEPAREN_5(a,b,c,d,e)			a b c d e
-# define _SDT_DEPAREN_6(a,b,c,d,e,f)			a b c d e f
-# define _SDT_DEPAREN_7(a,b,c,d,e,f,g)			a b c d e f g
-# define _SDT_DEPAREN_8(a,b,c,d,e,f,g,h)		a b c d e f g h
-# define _SDT_DEPAREN_9(a,b,c,d,e,f,g,h,i)		a b c d e f g h i
-# define _SDT_DEPAREN_10(a,b,c,d,e,f,g,h,i,j)		a b c d e f g h i j
-# define _SDT_DEPAREN_11(a,b,c,d,e,f,g,h,i,j,k)		a b c d e f g h i j k
-# define _SDT_DEPAREN_12(a,b,c,d,e,f,g,h,i,j,k,l)	a b c d e f g h i j k l
-#else
-# define _SDT_PROBE(provider, name, n, arglist) \
-  do {									    \
-    __asm__ __volatile__ (_SDT_ASM_BODY(provider, name, _SDT_ASM_ARGS, (n)) \
-			  :: _SDT_ASM_OPERANDS_##n arglist);		    \
-    __asm__ __volatile__ (_SDT_ASM_BASE);				    \
-  } while (0)
-# define _SDT_S(x)			#x
-# define _SDT_ASM_1(x)			_SDT_S(x) "\n"
-# define _SDT_ASM_2(a, b)		_SDT_S(a) "," _SDT_S(b) "\n"
-# define _SDT_ASM_3(a, b, c)		_SDT_S(a) "," _SDT_S(b) "," \
-					_SDT_S(c) "\n"
-# define _SDT_ASM_5(a, b, c, d, e)	_SDT_S(a) "," _SDT_S(b) "," \
-					_SDT_S(c) "," _SDT_S(d) "," \
-					_SDT_S(e) "\n"
-# define _SDT_ASM_ARGS(n)		_SDT_ASM_STRING(_SDT_ASM_TEMPLATE_##n)
-# define _SDT_ASM_STRING_1(x)		_SDT_ASM_1(.asciz #x)
-
-# define _SDT_ARGFMT(no)		%n[_SDT_S##no]@_SDT_ARGTMPL(_SDT_A##no)
-
-# ifndef STAP_SDT_ARG_CONSTRAINT
-# if defined __powerpc__
-# define STAP_SDT_ARG_CONSTRAINT        nZr
-# else
-# define STAP_SDT_ARG_CONSTRAINT        nor
-# endif
-# endif
-
-# define _SDT_STRINGIFY(x)              #x
-# define _SDT_ARG_CONSTRAINT_STRING(x)  _SDT_STRINGIFY(x)
-# define _SDT_ARG(n, x)			\
-  [_SDT_S##n] "n" ((_SDT_ARGSIGNED (x) ? 1 : -1) * (int) _SDT_ARGSIZE (x)), \
-  [_SDT_A##n] _SDT_ARG_CONSTRAINT_STRING (STAP_SDT_ARG_CONSTRAINT) (_SDT_ARGVAL (x))
-#endif
-#define _SDT_ASM_STRING(x)		_SDT_ASM_STRING_1(x)
-
-#define _SDT_ARGARRAY(x)	(__builtin_classify_type (x) == 14	\
-				 || __builtin_classify_type (x) == 5)
-
-#ifdef __cplusplus
-# define _SDT_ARGSIGNED(x)	(!_SDT_ARGARRAY (x) \
-				 && __sdt_type<__typeof (x)>::__sdt_signed)
-# define _SDT_ARGSIZE(x)	(_SDT_ARGARRAY (x) \
-				 ? sizeof (void *) : sizeof (x))
-# define _SDT_ARGVAL(x)		(x)
-
-# include <cstddef>
-
-template<typename __sdt_T>
-struct __sdt_type
-{
-  static const bool __sdt_signed = false;
-};
-  
-#define __SDT_ALWAYS_SIGNED(T) \
-template<> struct __sdt_type<T> { static const bool __sdt_signed = true; };
-#define __SDT_COND_SIGNED(T,CT)						\
-template<> struct __sdt_type<T> { static const bool __sdt_signed = ((CT)(-1) < 1); };
-__SDT_ALWAYS_SIGNED(signed char)
-__SDT_ALWAYS_SIGNED(short)
-__SDT_ALWAYS_SIGNED(int)
-__SDT_ALWAYS_SIGNED(long)
-__SDT_ALWAYS_SIGNED(long long)
-__SDT_ALWAYS_SIGNED(volatile signed char)
-__SDT_ALWAYS_SIGNED(volatile short)
-__SDT_ALWAYS_SIGNED(volatile int)
-__SDT_ALWAYS_SIGNED(volatile long)
-__SDT_ALWAYS_SIGNED(volatile long long)
-__SDT_ALWAYS_SIGNED(const signed char)
-__SDT_ALWAYS_SIGNED(const short)
-__SDT_ALWAYS_SIGNED(const int)
-__SDT_ALWAYS_SIGNED(const long)
-__SDT_ALWAYS_SIGNED(const long long)
-__SDT_ALWAYS_SIGNED(const volatile signed char)
-__SDT_ALWAYS_SIGNED(const volatile short)
-__SDT_ALWAYS_SIGNED(const volatile int)
-__SDT_ALWAYS_SIGNED(const volatile long)
-__SDT_ALWAYS_SIGNED(const volatile long long)
-__SDT_COND_SIGNED(char, char)
-__SDT_COND_SIGNED(wchar_t, wchar_t)
-__SDT_COND_SIGNED(volatile char, char)
-__SDT_COND_SIGNED(volatile wchar_t, wchar_t)
-__SDT_COND_SIGNED(const char, char)
-__SDT_COND_SIGNED(const wchar_t, wchar_t)
-__SDT_COND_SIGNED(const volatile char, char)
-__SDT_COND_SIGNED(const volatile wchar_t, wchar_t)
-#if defined (__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
-/* __SDT_COND_SIGNED(char16_t) */
-/* __SDT_COND_SIGNED(char32_t) */
-#endif
-
-template<typename __sdt_E>
-struct __sdt_type<__sdt_E[]> : public __sdt_type<__sdt_E *> {};
-
-template<typename __sdt_E, size_t __sdt_N>
-struct __sdt_type<__sdt_E[__sdt_N]> : public __sdt_type<__sdt_E *> {};
-
-#elif !defined(__ASSEMBLER__)
-__extension__ extern unsigned long long __sdt_unsp;
-# define _SDT_ARGINTTYPE(x)						\
-  __typeof (__builtin_choose_expr (((__builtin_classify_type (x)	\
-				     + 3) & -4) == 4, (x), 0U))
-# define _SDT_ARGSIGNED(x)						\
-  (!__extension__							\
-   (__builtin_constant_p ((((unsigned long long)			\
-			    (_SDT_ARGINTTYPE (x)) __sdt_unsp)		\
-			   & ((unsigned long long)1 << (sizeof (unsigned long long)	\
-				       * __CHAR_BIT__ - 1))) == 0)	\
-    || (_SDT_ARGINTTYPE (x)) -1 > (_SDT_ARGINTTYPE (x)) 0))
-# define _SDT_ARGSIZE(x)	\
-  (_SDT_ARGARRAY (x) ? sizeof (void *) : sizeof (x))
-# define _SDT_ARGVAL(x)		(x)
-#endif
-
-#if defined __powerpc__ || defined __powerpc64__
-# define _SDT_ARGTMPL(id)	%I[id]%[id]
-#elif defined __i386__
-# define _SDT_ARGTMPL(id)	%w[id]  /* gcc.gnu.org/PR80115 */
-#else
-# define _SDT_ARGTMPL(id)	%[id]
-#endif
-
-#ifdef __LP64__
-# define _SDT_ASM_ADDR	.8byte
-#else
-# define _SDT_ASM_ADDR	.4byte
-#endif
-
-/* The ia64 and s390 nop instructions take an argument. */
-#if defined(__ia64__) || defined(__s390__) || defined(__s390x__)
-#define _SDT_NOP	nop 0
-#else
-#define _SDT_NOP	nop
-#endif
-
-#define _SDT_NOTE_NAME	"stapsdt"
-#define _SDT_NOTE_TYPE	3
-
-/* If the assembler supports the necessary feature, then we can play
-   nice with code in COMDAT sections, which comes up in C++ code.
-   Without that assembler support, some combinations of probe placements
-   in certain kinds of C++ code may produce link-time errors.  */
-#include "sdt-config.h"
-#if _SDT_ASM_SECTION_AUTOGROUP_SUPPORT
-# define _SDT_ASM_AUTOGROUP "?"
-#else
-# define _SDT_ASM_AUTOGROUP ""
-#endif
-
-#define _SDT_ASM_BODY(provider, name, pack_args, args)			      \
-  _SDT_ASM_1(990:	_SDT_NOP)					      \
-  _SDT_ASM_3(		.pushsection .note.stapsdt,_SDT_ASM_AUTOGROUP,"note") \
-  _SDT_ASM_1(		.balign 4)					      \
-  _SDT_ASM_3(		.4byte 992f-991f, 994f-993f, _SDT_NOTE_TYPE)	      \
-  _SDT_ASM_1(991:	.asciz _SDT_NOTE_NAME)				      \
-  _SDT_ASM_1(992:	.balign 4)					      \
-  _SDT_ASM_1(993:	_SDT_ASM_ADDR 990b)				      \
-  _SDT_ASM_1(		_SDT_ASM_ADDR _.stapsdt.base)			      \
-  _SDT_SEMAPHORE(provider,name)						      \
-  _SDT_ASM_STRING(provider)						      \
-  _SDT_ASM_STRING(name)							      \
-  pack_args args							      \
-  _SDT_ASM_1(994:	.balign 4)					      \
-  _SDT_ASM_1(		.popsection)
-
-#define _SDT_ASM_BASE							      \
-  _SDT_ASM_1(.ifndef _.stapsdt.base)					      \
-  _SDT_ASM_5(		.pushsection .stapsdt.base,"aG","progbits",	      \
-							.stapsdt.base,comdat) \
-  _SDT_ASM_1(		.weak _.stapsdt.base)				      \
-  _SDT_ASM_1(		.hidden _.stapsdt.base)				      \
-  _SDT_ASM_1(	_.stapsdt.base: .space 1)				      \
-  _SDT_ASM_2(		.size _.stapsdt.base, 1)			      \
-  _SDT_ASM_1(		.popsection)					      \
-  _SDT_ASM_1(.endif)
-
-#if defined _SDT_HAS_SEMAPHORES
-#define _SDT_SEMAPHORE(p,n) _SDT_ASM_1(		_SDT_ASM_ADDR p##_##n##_semaphore)
-#else
-#define _SDT_SEMAPHORE(p,n) _SDT_ASM_1(		_SDT_ASM_ADDR 0)
-#endif
-
-#define _SDT_ASM_TEMPLATE_0		/* no arguments */
-#define _SDT_ASM_TEMPLATE_1		_SDT_ARGFMT(1)
-#define _SDT_ASM_TEMPLATE_2		_SDT_ASM_TEMPLATE_1 _SDT_ARGFMT(2)
-#define _SDT_ASM_TEMPLATE_3		_SDT_ASM_TEMPLATE_2 _SDT_ARGFMT(3)
-#define _SDT_ASM_TEMPLATE_4		_SDT_ASM_TEMPLATE_3 _SDT_ARGFMT(4)
-#define _SDT_ASM_TEMPLATE_5		_SDT_ASM_TEMPLATE_4 _SDT_ARGFMT(5)
-#define _SDT_ASM_TEMPLATE_6		_SDT_ASM_TEMPLATE_5 _SDT_ARGFMT(6)
-#define _SDT_ASM_TEMPLATE_7		_SDT_ASM_TEMPLATE_6 _SDT_ARGFMT(7)
-#define _SDT_ASM_TEMPLATE_8		_SDT_ASM_TEMPLATE_7 _SDT_ARGFMT(8)
-#define _SDT_ASM_TEMPLATE_9		_SDT_ASM_TEMPLATE_8 _SDT_ARGFMT(9)
-#define _SDT_ASM_TEMPLATE_10		_SDT_ASM_TEMPLATE_9 _SDT_ARGFMT(10)
-#define _SDT_ASM_TEMPLATE_11		_SDT_ASM_TEMPLATE_10 _SDT_ARGFMT(11)
-#define _SDT_ASM_TEMPLATE_12		_SDT_ASM_TEMPLATE_11 _SDT_ARGFMT(12)
-#define _SDT_ASM_OPERANDS_0()		[__sdt_dummy] "g" (0)
-#define _SDT_ASM_OPERANDS_1(arg1)	_SDT_ARG(1, arg1)
-#define _SDT_ASM_OPERANDS_2(arg1, arg2) \
-  _SDT_ASM_OPERANDS_1(arg1), _SDT_ARG(2, arg2)
-#define _SDT_ASM_OPERANDS_3(arg1, arg2, arg3) \
-  _SDT_ASM_OPERANDS_2(arg1, arg2), _SDT_ARG(3, arg3)
-#define _SDT_ASM_OPERANDS_4(arg1, arg2, arg3, arg4) \
-  _SDT_ASM_OPERANDS_3(arg1, arg2, arg3), _SDT_ARG(4, arg4)
-#define _SDT_ASM_OPERANDS_5(arg1, arg2, arg3, arg4, arg5) \
-  _SDT_ASM_OPERANDS_4(arg1, arg2, arg3, arg4), _SDT_ARG(5, arg5)
-#define _SDT_ASM_OPERANDS_6(arg1, arg2, arg3, arg4, arg5, arg6) \
-  _SDT_ASM_OPERANDS_5(arg1, arg2, arg3, arg4, arg5), _SDT_ARG(6, arg6)
-#define _SDT_ASM_OPERANDS_7(arg1, arg2, arg3, arg4, arg5, arg6, arg7) \
-  _SDT_ASM_OPERANDS_6(arg1, arg2, arg3, arg4, arg5, arg6), _SDT_ARG(7, arg7)
-#define _SDT_ASM_OPERANDS_8(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \
-  _SDT_ASM_OPERANDS_7(arg1, arg2, arg3, arg4, arg5, arg6, arg7), \
-    _SDT_ARG(8, arg8)
-#define _SDT_ASM_OPERANDS_9(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9) \
-  _SDT_ASM_OPERANDS_8(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8), \
-    _SDT_ARG(9, arg9)
-#define _SDT_ASM_OPERANDS_10(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10) \
-  _SDT_ASM_OPERANDS_9(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9), \
-    _SDT_ARG(10, arg10)
-#define _SDT_ASM_OPERANDS_11(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11) \
-  _SDT_ASM_OPERANDS_10(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10), \
-    _SDT_ARG(11, arg11)
-#define _SDT_ASM_OPERANDS_12(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12) \
-  _SDT_ASM_OPERANDS_11(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11), \
-    _SDT_ARG(12, arg12)
-
-/* These macros can be used in C, C++, or assembly code.
-   In assembly code the arguments should use normal assembly operand syntax.  */
-
-#define STAP_PROBE(provider, name) \
-  _SDT_PROBE(provider, name, 0, ())
-#define STAP_PROBE1(provider, name, arg1) \
-  _SDT_PROBE(provider, name, 1, (arg1))
-#define STAP_PROBE2(provider, name, arg1, arg2) \
-  _SDT_PROBE(provider, name, 2, (arg1, arg2))
-#define STAP_PROBE3(provider, name, arg1, arg2, arg3) \
-  _SDT_PROBE(provider, name, 3, (arg1, arg2, arg3))
-#define STAP_PROBE4(provider, name, arg1, arg2, arg3, arg4) \
-  _SDT_PROBE(provider, name, 4, (arg1, arg2, arg3, arg4))
-#define STAP_PROBE5(provider, name, arg1, arg2, arg3, arg4, arg5) \
-  _SDT_PROBE(provider, name, 5, (arg1, arg2, arg3, arg4, arg5))
-#define STAP_PROBE6(provider, name, arg1, arg2, arg3, arg4, arg5, arg6)	\
-  _SDT_PROBE(provider, name, 6, (arg1, arg2, arg3, arg4, arg5, arg6))
-#define STAP_PROBE7(provider, name, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \
-  _SDT_PROBE(provider, name, 7, (arg1, arg2, arg3, arg4, arg5, arg6, arg7))
-#define STAP_PROBE8(provider,name,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) \
-  _SDT_PROBE(provider, name, 8, (arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8))
-#define STAP_PROBE9(provider,name,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9)\
-  _SDT_PROBE(provider, name, 9, (arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9))
-#define STAP_PROBE10(provider,name,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10) \
-  _SDT_PROBE(provider, name, 10, \
-	     (arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10))
-#define STAP_PROBE11(provider,name,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11) \
-  _SDT_PROBE(provider, name, 11, \
-	     (arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11))
-#define STAP_PROBE12(provider,name,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12) \
-  _SDT_PROBE(provider, name, 12, \
-	     (arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12))
-
-/* This STAP_PROBEV macro can be used in variadic scenarios, where the
-   number of probe arguments is not known until compile time.  Since
-   variadic macro support may vary with compiler options, you must
-   pre-#define SDT_USE_VARIADIC to enable this type of probe.
-
-   The trick to count __VA_ARGS__ was inspired by this post by
-   Laurent Deniau <laurent.deniau at cern.ch>:
-       http://groups.google.com/group/comp.std.c/msg/346fc464319b1ee5
-
-   Note that our _SDT_NARG is called with an extra 0 arg that's not
-   counted, so we don't have to worry about the behavior of macros
-   called without any arguments.  */
-
-#ifdef SDT_USE_VARIADIC
-#define _SDT_NARG(...) __SDT_NARG(__VA_ARGS__, 12,11,10,9,8,7,6,5,4,3,2,1,0)
-#define __SDT_NARG(_0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12, N, ...) N
-#define _SDT_PROBE_N(provider, name, N, ...) \
-  _SDT_PROBE(provider, name, N, (__VA_ARGS__))
-#define STAP_PROBEV(provider, name, ...) \
-  _SDT_PROBE_N(provider, name, _SDT_NARG(0, ##__VA_ARGS__), ##__VA_ARGS__)
-#endif
-
-/* These macros are for use in asm statements.  You must compile
-   with -std=gnu99 or -std=c99 to use the STAP_PROBE_ASM macro.
-
-   The STAP_PROBE_ASM macro generates a quoted string to be used in the
-   template portion of the asm statement, concatenated with strings that
-   contain the actual assembly code around the probe site.
-
-   For example:
-
-	asm ("before\n"
-	     STAP_PROBE_ASM(provider, fooprobe, %eax 4(%esi))
-	     "after");
-
-   emits the assembly code for "before\nafter", with a probe in between.
-   The probe arguments are the %eax register, and the value of the memory
-   word located 4 bytes past the address in the %esi register.  Note that
-   because this is a simple asm, not a GNU C extended asm statement, these
-   % characters do not need to be doubled to generate literal %reg names.
-
-   In a GNU C extended asm statement, the probe arguments can be specified
-   using the macro STAP_PROBE_ASM_TEMPLATE(n) for n arguments.  The paired
-   macro STAP_PROBE_ASM_OPERANDS gives the C values of these probe arguments,
-   and appears in the input operand list of the asm statement.  For example:
-
-	asm ("someinsn %0,%1\n" // %0 is output operand, %1 is input operand
-	     STAP_PROBE_ASM(provider, fooprobe, STAP_PROBE_ASM_TEMPLATE(3))
-	     "otherinsn %[namedarg]"
-	     : "r" (outvar)
-	     : "g" (some_value), [namedarg] "i" (1234),
-	       STAP_PROBE_ASM_OPERANDS(3, some_value, some_ptr->field, 1234));
-
-    This is just like writing:
-
-	STAP_PROBE3(provider, fooprobe, some_value, some_ptr->field, 1234));
-
-    but the probe site is right between "someinsn" and "otherinsn".
-
-    The probe arguments in STAP_PROBE_ASM can be given as assembly
-    operands instead, even inside a GNU C extended asm statement.
-    Note that these can use operand templates like %0 or %[name],
-    and likewise they must write %%reg for a literal operand of %reg.  */
-
-#if __STDC_VERSION__ >= 199901L
-# define STAP_PROBE_ASM(provider, name, ...)		\
-  _SDT_ASM_BODY(provider, name, _SDT_ASM_STRING, (__VA_ARGS__)) \
-  _SDT_ASM_BASE
-# define STAP_PROBE_ASM_OPERANDS(n, ...) _SDT_ASM_OPERANDS_##n(__VA_ARGS__)
-#else
-# define STAP_PROBE_ASM(provider, name, args)	\
-  _SDT_ASM_BODY(provider, name, _SDT_ASM_STRING, (args)) \
-  _SDT_ASM_BASE
-#endif
-#define STAP_PROBE_ASM_TEMPLATE(n)	_SDT_ASM_TEMPLATE_##n
-
-
-/* DTrace compatible macro names.  */
-#define DTRACE_PROBE(provider,probe)		\
-  STAP_PROBE(provider,probe)
-#define DTRACE_PROBE1(provider,probe,parm1)	\
-  STAP_PROBE1(provider,probe,parm1)
-#define DTRACE_PROBE2(provider,probe,parm1,parm2)	\
-  STAP_PROBE2(provider,probe,parm1,parm2)
-#define DTRACE_PROBE3(provider,probe,parm1,parm2,parm3) \
-  STAP_PROBE3(provider,probe,parm1,parm2,parm3)
-#define DTRACE_PROBE4(provider,probe,parm1,parm2,parm3,parm4)	\
-  STAP_PROBE4(provider,probe,parm1,parm2,parm3,parm4)
-#define DTRACE_PROBE5(provider,probe,parm1,parm2,parm3,parm4,parm5)	\
-  STAP_PROBE5(provider,probe,parm1,parm2,parm3,parm4,parm5)
-#define DTRACE_PROBE6(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6) \
-  STAP_PROBE6(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6)
-#define DTRACE_PROBE7(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7) \
-  STAP_PROBE7(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7)
-#define DTRACE_PROBE8(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8) \
-  STAP_PROBE8(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8)
-#define DTRACE_PROBE9(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9) \
-  STAP_PROBE9(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9)
-#define DTRACE_PROBE10(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9,parm10) \
-  STAP_PROBE10(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9,parm10)
-#define DTRACE_PROBE11(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9,parm10,parm11) \
-  STAP_PROBE11(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9,parm10,parm11)
-#define DTRACE_PROBE12(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9,parm10,parm11,parm12) \
-  STAP_PROBE12(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9,parm10,parm11,parm12)
-
-
-#endif /* sys/sdt.h */

Copied: glibc/repos/staging-x86_64/sdt.h (from rev 436749, glibc/trunk/sdt.h)
===================================================================
--- sdt.h	                        (rev 0)
+++ sdt.h	2022-02-09 17:48:32 UTC (rev 436750)
@@ -0,0 +1,430 @@
+/* <sys/sdt.h> - Systemtap static probe definition macros.
+
+   This file is dedicated to the public domain, pursuant to CC0
+   (https://creativecommons.org/publicdomain/zero/1.0/)
+*/
+
+#ifndef _SYS_SDT_H
+#define _SYS_SDT_H    1
+
+/*
+  This file defines a family of macros
+
+       STAP_PROBEn(op1, ..., opn)
+
+  that emit a nop into the instruction stream, and some data into an auxiliary
+  note section.  The data in the note section describes the operands, in terms
+  of size and location.  Each location is encoded as assembler operand string.
+  Consumer tools such as gdb or systemtap insert breakpoints on top of
+  the nop, and decode the location operand-strings, like an assembler,
+  to find the values being passed.
+
+  The operand strings are selected by the compiler for each operand.
+  They are constrained by gcc inline-assembler codes.  The default is:
+
+  #define STAP_SDT_ARG_CONSTRAINT nor
+
+  This is a good default if the operands tend to be integral and
+  moderate in number (smaller than number of registers).  In other
+  cases, the compiler may report "'asm' requires impossible reload" or
+  similar.  In this case, consider simplifying the macro call (fewer
+  and simpler operands), reduce optimization, or override the default
+  constraints string via:
+
+  #define STAP_SDT_ARG_CONSTRAINT g
+  #include <sys/sdt.h>
+
+  See also:
+  https://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation
+  https://gcc.gnu.org/onlinedocs/gcc/Constraints.html
+ */
+
+
+
+#ifdef __ASSEMBLER__
+# define _SDT_PROBE(provider, name, n, arglist)	\
+  _SDT_ASM_BODY(provider, name, _SDT_ASM_STRING_1, (_SDT_DEPAREN_##n arglist)) \
+  _SDT_ASM_BASE
+# define _SDT_ASM_1(x)			x;
+# define _SDT_ASM_2(a, b)		a,b;
+# define _SDT_ASM_3(a, b, c)		a,b,c;
+# define _SDT_ASM_5(a, b, c, d, e)	a,b,c,d,e;
+# define _SDT_ASM_STRING_1(x)		.asciz #x;
+# define _SDT_DEPAREN_0()				/* empty */
+# define _SDT_DEPAREN_1(a)				a
+# define _SDT_DEPAREN_2(a,b)				a b
+# define _SDT_DEPAREN_3(a,b,c)				a b c
+# define _SDT_DEPAREN_4(a,b,c,d)			a b c d
+# define _SDT_DEPAREN_5(a,b,c,d,e)			a b c d e
+# define _SDT_DEPAREN_6(a,b,c,d,e,f)			a b c d e f
+# define _SDT_DEPAREN_7(a,b,c,d,e,f,g)			a b c d e f g
+# define _SDT_DEPAREN_8(a,b,c,d,e,f,g,h)		a b c d e f g h
+# define _SDT_DEPAREN_9(a,b,c,d,e,f,g,h,i)		a b c d e f g h i
+# define _SDT_DEPAREN_10(a,b,c,d,e,f,g,h,i,j)		a b c d e f g h i j
+# define _SDT_DEPAREN_11(a,b,c,d,e,f,g,h,i,j,k)		a b c d e f g h i j k
+# define _SDT_DEPAREN_12(a,b,c,d,e,f,g,h,i,j,k,l)	a b c d e f g h i j k l
+#else
+# define _SDT_PROBE(provider, name, n, arglist) \
+  do {									    \
+    __asm__ __volatile__ (_SDT_ASM_BODY(provider, name, _SDT_ASM_ARGS, (n)) \
+			  :: _SDT_ASM_OPERANDS_##n arglist);		    \
+    __asm__ __volatile__ (_SDT_ASM_BASE);				    \
+  } while (0)
+# define _SDT_S(x)			#x
+# define _SDT_ASM_1(x)			_SDT_S(x) "\n"
+# define _SDT_ASM_2(a, b)		_SDT_S(a) "," _SDT_S(b) "\n"
+# define _SDT_ASM_3(a, b, c)		_SDT_S(a) "," _SDT_S(b) "," \
+					_SDT_S(c) "\n"
+# define _SDT_ASM_5(a, b, c, d, e)	_SDT_S(a) "," _SDT_S(b) "," \
+					_SDT_S(c) "," _SDT_S(d) "," \
+					_SDT_S(e) "\n"
+# define _SDT_ASM_ARGS(n)		_SDT_ASM_STRING(_SDT_ASM_TEMPLATE_##n)
+# define _SDT_ASM_STRING_1(x)		_SDT_ASM_1(.asciz #x)
+
+# define _SDT_ARGFMT(no)		%n[_SDT_S##no]@_SDT_ARGTMPL(_SDT_A##no)
+
+# ifndef STAP_SDT_ARG_CONSTRAINT
+# if defined __powerpc__
+# define STAP_SDT_ARG_CONSTRAINT        nZr
+# else
+# define STAP_SDT_ARG_CONSTRAINT        nor
+# endif
+# endif
+
+# define _SDT_STRINGIFY(x)              #x
+# define _SDT_ARG_CONSTRAINT_STRING(x)  _SDT_STRINGIFY(x)
+# define _SDT_ARG(n, x)			\
+  [_SDT_S##n] "n" ((_SDT_ARGSIGNED (x) ? 1 : -1) * (int) _SDT_ARGSIZE (x)), \
+  [_SDT_A##n] _SDT_ARG_CONSTRAINT_STRING (STAP_SDT_ARG_CONSTRAINT) (_SDT_ARGVAL (x))
+#endif
+#define _SDT_ASM_STRING(x)		_SDT_ASM_STRING_1(x)
+
+#define _SDT_ARGARRAY(x)	(__builtin_classify_type (x) == 14	\
+				 || __builtin_classify_type (x) == 5)
+
+#ifdef __cplusplus
+# define _SDT_ARGSIGNED(x)	(!_SDT_ARGARRAY (x) \
+				 && __sdt_type<__typeof (x)>::__sdt_signed)
+# define _SDT_ARGSIZE(x)	(_SDT_ARGARRAY (x) \
+				 ? sizeof (void *) : sizeof (x))
+# define _SDT_ARGVAL(x)		(x)
+
+# include <cstddef>
+
+template<typename __sdt_T>
+struct __sdt_type
+{
+  static const bool __sdt_signed = false;
+};
+  
+#define __SDT_ALWAYS_SIGNED(T) \
+template<> struct __sdt_type<T> { static const bool __sdt_signed = true; };
+#define __SDT_COND_SIGNED(T,CT)						\
+template<> struct __sdt_type<T> { static const bool __sdt_signed = ((CT)(-1) < 1); };
+__SDT_ALWAYS_SIGNED(signed char)
+__SDT_ALWAYS_SIGNED(short)
+__SDT_ALWAYS_SIGNED(int)
+__SDT_ALWAYS_SIGNED(long)
+__SDT_ALWAYS_SIGNED(long long)
+__SDT_ALWAYS_SIGNED(volatile signed char)
+__SDT_ALWAYS_SIGNED(volatile short)
+__SDT_ALWAYS_SIGNED(volatile int)
+__SDT_ALWAYS_SIGNED(volatile long)
+__SDT_ALWAYS_SIGNED(volatile long long)
+__SDT_ALWAYS_SIGNED(const signed char)
+__SDT_ALWAYS_SIGNED(const short)
+__SDT_ALWAYS_SIGNED(const int)
+__SDT_ALWAYS_SIGNED(const long)
+__SDT_ALWAYS_SIGNED(const long long)
+__SDT_ALWAYS_SIGNED(const volatile signed char)
+__SDT_ALWAYS_SIGNED(const volatile short)
+__SDT_ALWAYS_SIGNED(const volatile int)
+__SDT_ALWAYS_SIGNED(const volatile long)
+__SDT_ALWAYS_SIGNED(const volatile long long)
+__SDT_COND_SIGNED(char, char)
+__SDT_COND_SIGNED(wchar_t, wchar_t)
+__SDT_COND_SIGNED(volatile char, char)
+__SDT_COND_SIGNED(volatile wchar_t, wchar_t)
+__SDT_COND_SIGNED(const char, char)
+__SDT_COND_SIGNED(const wchar_t, wchar_t)
+__SDT_COND_SIGNED(const volatile char, char)
+__SDT_COND_SIGNED(const volatile wchar_t, wchar_t)
+#if defined (__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
+/* __SDT_COND_SIGNED(char16_t) */
+/* __SDT_COND_SIGNED(char32_t) */
+#endif
+
+template<typename __sdt_E>
+struct __sdt_type<__sdt_E[]> : public __sdt_type<__sdt_E *> {};
+
+template<typename __sdt_E, size_t __sdt_N>
+struct __sdt_type<__sdt_E[__sdt_N]> : public __sdt_type<__sdt_E *> {};
+
+#elif !defined(__ASSEMBLER__)
+__extension__ extern unsigned long long __sdt_unsp;
+# define _SDT_ARGINTTYPE(x)						\
+  __typeof (__builtin_choose_expr (((__builtin_classify_type (x)	\
+				     + 3) & -4) == 4, (x), 0U))
+# define _SDT_ARGSIGNED(x)						\
+  (!__extension__							\
+   (__builtin_constant_p ((((unsigned long long)			\
+			    (_SDT_ARGINTTYPE (x)) __sdt_unsp)		\
+			   & ((unsigned long long)1 << (sizeof (unsigned long long)	\
+				       * __CHAR_BIT__ - 1))) == 0)	\
+    || (_SDT_ARGINTTYPE (x)) -1 > (_SDT_ARGINTTYPE (x)) 0))
+# define _SDT_ARGSIZE(x)	\
+  (_SDT_ARGARRAY (x) ? sizeof (void *) : sizeof (x))
+# define _SDT_ARGVAL(x)		(x)
+#endif
+
+#if defined __powerpc__ || defined __powerpc64__
+# define _SDT_ARGTMPL(id)	%I[id]%[id]
+#elif defined __i386__
+# define _SDT_ARGTMPL(id)	%w[id]  /* gcc.gnu.org/PR80115 */
+#else
+# define _SDT_ARGTMPL(id)	%[id]
+#endif
+
+#ifdef __LP64__
+# define _SDT_ASM_ADDR	.8byte
+#else
+# define _SDT_ASM_ADDR	.4byte
+#endif
+
+/* The ia64 and s390 nop instructions take an argument. */
+#if defined(__ia64__) || defined(__s390__) || defined(__s390x__)
+#define _SDT_NOP	nop 0
+#else
+#define _SDT_NOP	nop
+#endif
+
+#define _SDT_NOTE_NAME	"stapsdt"
+#define _SDT_NOTE_TYPE	3
+
+/* If the assembler supports the necessary feature, then we can play
+   nice with code in COMDAT sections, which comes up in C++ code.
+   Without that assembler support, some combinations of probe placements
+   in certain kinds of C++ code may produce link-time errors.  */
+#include "sdt-config.h"
+#if _SDT_ASM_SECTION_AUTOGROUP_SUPPORT
+# define _SDT_ASM_AUTOGROUP "?"
+#else
+# define _SDT_ASM_AUTOGROUP ""
+#endif
+
+#define _SDT_ASM_BODY(provider, name, pack_args, args)			      \
+  _SDT_ASM_1(990:	_SDT_NOP)					      \
+  _SDT_ASM_3(		.pushsection .note.stapsdt,_SDT_ASM_AUTOGROUP,"note") \
+  _SDT_ASM_1(		.balign 4)					      \
+  _SDT_ASM_3(		.4byte 992f-991f, 994f-993f, _SDT_NOTE_TYPE)	      \
+  _SDT_ASM_1(991:	.asciz _SDT_NOTE_NAME)				      \
+  _SDT_ASM_1(992:	.balign 4)					      \
+  _SDT_ASM_1(993:	_SDT_ASM_ADDR 990b)				      \
+  _SDT_ASM_1(		_SDT_ASM_ADDR _.stapsdt.base)			      \
+  _SDT_SEMAPHORE(provider,name)						      \
+  _SDT_ASM_STRING(provider)						      \
+  _SDT_ASM_STRING(name)							      \
+  pack_args args							      \
+  _SDT_ASM_1(994:	.balign 4)					      \
+  _SDT_ASM_1(		.popsection)
+
+#define _SDT_ASM_BASE							      \
+  _SDT_ASM_1(.ifndef _.stapsdt.base)					      \
+  _SDT_ASM_5(		.pushsection .stapsdt.base,"aG","progbits",	      \
+							.stapsdt.base,comdat) \
+  _SDT_ASM_1(		.weak _.stapsdt.base)				      \
+  _SDT_ASM_1(		.hidden _.stapsdt.base)				      \
+  _SDT_ASM_1(	_.stapsdt.base: .space 1)				      \
+  _SDT_ASM_2(		.size _.stapsdt.base, 1)			      \
+  _SDT_ASM_1(		.popsection)					      \
+  _SDT_ASM_1(.endif)
+
+#if defined _SDT_HAS_SEMAPHORES
+#define _SDT_SEMAPHORE(p,n) _SDT_ASM_1(		_SDT_ASM_ADDR p##_##n##_semaphore)
+#else
+#define _SDT_SEMAPHORE(p,n) _SDT_ASM_1(		_SDT_ASM_ADDR 0)
+#endif
+
+#define _SDT_ASM_TEMPLATE_0		/* no arguments */
+#define _SDT_ASM_TEMPLATE_1		_SDT_ARGFMT(1)
+#define _SDT_ASM_TEMPLATE_2		_SDT_ASM_TEMPLATE_1 _SDT_ARGFMT(2)
+#define _SDT_ASM_TEMPLATE_3		_SDT_ASM_TEMPLATE_2 _SDT_ARGFMT(3)
+#define _SDT_ASM_TEMPLATE_4		_SDT_ASM_TEMPLATE_3 _SDT_ARGFMT(4)
+#define _SDT_ASM_TEMPLATE_5		_SDT_ASM_TEMPLATE_4 _SDT_ARGFMT(5)
+#define _SDT_ASM_TEMPLATE_6		_SDT_ASM_TEMPLATE_5 _SDT_ARGFMT(6)
+#define _SDT_ASM_TEMPLATE_7		_SDT_ASM_TEMPLATE_6 _SDT_ARGFMT(7)
+#define _SDT_ASM_TEMPLATE_8		_SDT_ASM_TEMPLATE_7 _SDT_ARGFMT(8)
+#define _SDT_ASM_TEMPLATE_9		_SDT_ASM_TEMPLATE_8 _SDT_ARGFMT(9)
+#define _SDT_ASM_TEMPLATE_10		_SDT_ASM_TEMPLATE_9 _SDT_ARGFMT(10)
+#define _SDT_ASM_TEMPLATE_11		_SDT_ASM_TEMPLATE_10 _SDT_ARGFMT(11)
+#define _SDT_ASM_TEMPLATE_12		_SDT_ASM_TEMPLATE_11 _SDT_ARGFMT(12)
+#define _SDT_ASM_OPERANDS_0()		[__sdt_dummy] "g" (0)
+#define _SDT_ASM_OPERANDS_1(arg1)	_SDT_ARG(1, arg1)
+#define _SDT_ASM_OPERANDS_2(arg1, arg2) \
+  _SDT_ASM_OPERANDS_1(arg1), _SDT_ARG(2, arg2)
+#define _SDT_ASM_OPERANDS_3(arg1, arg2, arg3) \
+  _SDT_ASM_OPERANDS_2(arg1, arg2), _SDT_ARG(3, arg3)
+#define _SDT_ASM_OPERANDS_4(arg1, arg2, arg3, arg4) \
+  _SDT_ASM_OPERANDS_3(arg1, arg2, arg3), _SDT_ARG(4, arg4)
+#define _SDT_ASM_OPERANDS_5(arg1, arg2, arg3, arg4, arg5) \
+  _SDT_ASM_OPERANDS_4(arg1, arg2, arg3, arg4), _SDT_ARG(5, arg5)
+#define _SDT_ASM_OPERANDS_6(arg1, arg2, arg3, arg4, arg5, arg6) \
+  _SDT_ASM_OPERANDS_5(arg1, arg2, arg3, arg4, arg5), _SDT_ARG(6, arg6)
+#define _SDT_ASM_OPERANDS_7(arg1, arg2, arg3, arg4, arg5, arg6, arg7) \
+  _SDT_ASM_OPERANDS_6(arg1, arg2, arg3, arg4, arg5, arg6), _SDT_ARG(7, arg7)
+#define _SDT_ASM_OPERANDS_8(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \
+  _SDT_ASM_OPERANDS_7(arg1, arg2, arg3, arg4, arg5, arg6, arg7), \
+    _SDT_ARG(8, arg8)
+#define _SDT_ASM_OPERANDS_9(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9) \
+  _SDT_ASM_OPERANDS_8(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8), \
+    _SDT_ARG(9, arg9)
+#define _SDT_ASM_OPERANDS_10(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10) \
+  _SDT_ASM_OPERANDS_9(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9), \
+    _SDT_ARG(10, arg10)
+#define _SDT_ASM_OPERANDS_11(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11) \
+  _SDT_ASM_OPERANDS_10(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10), \
+    _SDT_ARG(11, arg11)
+#define _SDT_ASM_OPERANDS_12(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12) \
+  _SDT_ASM_OPERANDS_11(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11), \
+    _SDT_ARG(12, arg12)
+
+/* These macros can be used in C, C++, or assembly code.
+   In assembly code the arguments should use normal assembly operand syntax.  */
+
+#define STAP_PROBE(provider, name) \
+  _SDT_PROBE(provider, name, 0, ())
+#define STAP_PROBE1(provider, name, arg1) \
+  _SDT_PROBE(provider, name, 1, (arg1))
+#define STAP_PROBE2(provider, name, arg1, arg2) \
+  _SDT_PROBE(provider, name, 2, (arg1, arg2))
+#define STAP_PROBE3(provider, name, arg1, arg2, arg3) \
+  _SDT_PROBE(provider, name, 3, (arg1, arg2, arg3))
+#define STAP_PROBE4(provider, name, arg1, arg2, arg3, arg4) \
+  _SDT_PROBE(provider, name, 4, (arg1, arg2, arg3, arg4))
+#define STAP_PROBE5(provider, name, arg1, arg2, arg3, arg4, arg5) \
+  _SDT_PROBE(provider, name, 5, (arg1, arg2, arg3, arg4, arg5))
+#define STAP_PROBE6(provider, name, arg1, arg2, arg3, arg4, arg5, arg6)	\
+  _SDT_PROBE(provider, name, 6, (arg1, arg2, arg3, arg4, arg5, arg6))
+#define STAP_PROBE7(provider, name, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \
+  _SDT_PROBE(provider, name, 7, (arg1, arg2, arg3, arg4, arg5, arg6, arg7))
+#define STAP_PROBE8(provider,name,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) \
+  _SDT_PROBE(provider, name, 8, (arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8))
+#define STAP_PROBE9(provider,name,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9)\
+  _SDT_PROBE(provider, name, 9, (arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9))
+#define STAP_PROBE10(provider,name,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10) \
+  _SDT_PROBE(provider, name, 10, \
+	     (arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10))
+#define STAP_PROBE11(provider,name,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11) \
+  _SDT_PROBE(provider, name, 11, \
+	     (arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11))
+#define STAP_PROBE12(provider,name,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12) \
+  _SDT_PROBE(provider, name, 12, \
+	     (arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12))
+
+/* This STAP_PROBEV macro can be used in variadic scenarios, where the
+   number of probe arguments is not known until compile time.  Since
+   variadic macro support may vary with compiler options, you must
+   pre-#define SDT_USE_VARIADIC to enable this type of probe.
+
+   The trick to count __VA_ARGS__ was inspired by this post by
+   Laurent Deniau <laurent.deniau at cern.ch>:
+       http://groups.google.com/group/comp.std.c/msg/346fc464319b1ee5
+
+   Note that our _SDT_NARG is called with an extra 0 arg that's not
+   counted, so we don't have to worry about the behavior of macros
+   called without any arguments.  */
+
+#ifdef SDT_USE_VARIADIC
+#define _SDT_NARG(...) __SDT_NARG(__VA_ARGS__, 12,11,10,9,8,7,6,5,4,3,2,1,0)
+#define __SDT_NARG(_0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12, N, ...) N
+#define _SDT_PROBE_N(provider, name, N, ...) \
+  _SDT_PROBE(provider, name, N, (__VA_ARGS__))
+#define STAP_PROBEV(provider, name, ...) \
+  _SDT_PROBE_N(provider, name, _SDT_NARG(0, ##__VA_ARGS__), ##__VA_ARGS__)
+#endif
+
+/* These macros are for use in asm statements.  You must compile
+   with -std=gnu99 or -std=c99 to use the STAP_PROBE_ASM macro.
+
+   The STAP_PROBE_ASM macro generates a quoted string to be used in the
+   template portion of the asm statement, concatenated with strings that
+   contain the actual assembly code around the probe site.
+
+   For example:
+
+	asm ("before\n"
+	     STAP_PROBE_ASM(provider, fooprobe, %eax 4(%esi))
+	     "after");
+
+   emits the assembly code for "before\nafter", with a probe in between.
+   The probe arguments are the %eax register, and the value of the memory
+   word located 4 bytes past the address in the %esi register.  Note that
+   because this is a simple asm, not a GNU C extended asm statement, these
+   % characters do not need to be doubled to generate literal %reg names.
+
+   In a GNU C extended asm statement, the probe arguments can be specified
+   using the macro STAP_PROBE_ASM_TEMPLATE(n) for n arguments.  The paired
+   macro STAP_PROBE_ASM_OPERANDS gives the C values of these probe arguments,
+   and appears in the input operand list of the asm statement.  For example:
+
+	asm ("someinsn %0,%1\n" // %0 is output operand, %1 is input operand
+	     STAP_PROBE_ASM(provider, fooprobe, STAP_PROBE_ASM_TEMPLATE(3))
+	     "otherinsn %[namedarg]"
+	     : "r" (outvar)
+	     : "g" (some_value), [namedarg] "i" (1234),
+	       STAP_PROBE_ASM_OPERANDS(3, some_value, some_ptr->field, 1234));
+
+    This is just like writing:
+
+	STAP_PROBE3(provider, fooprobe, some_value, some_ptr->field, 1234));
+
+    but the probe site is right between "someinsn" and "otherinsn".
+
+    The probe arguments in STAP_PROBE_ASM can be given as assembly
+    operands instead, even inside a GNU C extended asm statement.
+    Note that these can use operand templates like %0 or %[name],
+    and likewise they must write %%reg for a literal operand of %reg.  */
+
+#if __STDC_VERSION__ >= 199901L
+# define STAP_PROBE_ASM(provider, name, ...)		\
+  _SDT_ASM_BODY(provider, name, _SDT_ASM_STRING, (__VA_ARGS__)) \
+  _SDT_ASM_BASE
+# define STAP_PROBE_ASM_OPERANDS(n, ...) _SDT_ASM_OPERANDS_##n(__VA_ARGS__)
+#else
+# define STAP_PROBE_ASM(provider, name, args)	\
+  _SDT_ASM_BODY(provider, name, _SDT_ASM_STRING, (args)) \
+  _SDT_ASM_BASE
+#endif
+#define STAP_PROBE_ASM_TEMPLATE(n)	_SDT_ASM_TEMPLATE_##n
+
+
+/* DTrace compatible macro names.  */
+#define DTRACE_PROBE(provider,probe)		\
+  STAP_PROBE(provider,probe)
+#define DTRACE_PROBE1(provider,probe,parm1)	\
+  STAP_PROBE1(provider,probe,parm1)
+#define DTRACE_PROBE2(provider,probe,parm1,parm2)	\
+  STAP_PROBE2(provider,probe,parm1,parm2)
+#define DTRACE_PROBE3(provider,probe,parm1,parm2,parm3) \
+  STAP_PROBE3(provider,probe,parm1,parm2,parm3)
+#define DTRACE_PROBE4(provider,probe,parm1,parm2,parm3,parm4)	\
+  STAP_PROBE4(provider,probe,parm1,parm2,parm3,parm4)
+#define DTRACE_PROBE5(provider,probe,parm1,parm2,parm3,parm4,parm5)	\
+  STAP_PROBE5(provider,probe,parm1,parm2,parm3,parm4,parm5)
+#define DTRACE_PROBE6(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6) \
+  STAP_PROBE6(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6)
+#define DTRACE_PROBE7(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7) \
+  STAP_PROBE7(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7)
+#define DTRACE_PROBE8(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8) \
+  STAP_PROBE8(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8)
+#define DTRACE_PROBE9(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9) \
+  STAP_PROBE9(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9)
+#define DTRACE_PROBE10(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9,parm10) \
+  STAP_PROBE10(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9,parm10)
+#define DTRACE_PROBE11(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9,parm10,parm11) \
+  STAP_PROBE11(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9,parm10,parm11)
+#define DTRACE_PROBE12(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9,parm10,parm11,parm12) \
+  STAP_PROBE12(provider,probe,parm1,parm2,parm3,parm4,parm5,parm6,parm7,parm8,parm9,parm10,parm11,parm12)
+
+
+#endif /* sys/sdt.h */



More information about the arch-commits mailing list