public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/5] Architecture code cleanup
@ 2021-12-16 19:42 Adhemerval Zanella
  2021-12-16 19:42 ` [PATCH 1/5] Remove ununsed tcb-offset Adhemerval Zanella
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Adhemerval Zanella @ 2021-12-16 19:42 UTC (permalink / raw)
  To: libc-alpha, Stafford Horne

These cleanups come from reviewing the OpenRISC submission.  The
tcb-offset.h is used mostly on setjmp/longjmp implementation to
provide pointer mangle/demangle, but most ports do not use its
definition (it should speed up a bit the build process).

The libmemusage requires duplicate definition and adds a lot of
boilerplate code: its internal atomics can be replaces by
C11 atomics, which allows remove a lof of atomic-machine.h
internal types; the internal time can be replaced with hp-timing.h,
and for stack pointer information we can use either the
__thread_stack_pointer (hurd) or CURRENT_STACK_FRAME (Linux).

Adhemerval Zanella (5):
  Remove ununsed tcb-offset
  malloc: Use C11 atomics on libmemusage
  Remove atomic-machine.h boilerplates definition
  malloc: Use hp-timing on libmemusage
  malloc: Remove memusage.h

 malloc/memusage.c                             | 65 +++++++++++--------
 sysdeps/aarch64/atomic-machine.h              | 17 -----
 sysdeps/aarch64/memusage.h                    | 21 ------
 sysdeps/aarch64/nptl/Makefile                 | 21 ------
 sysdeps/aarch64/nptl/tcb-offsets.sym          |  6 --
 sysdeps/aarch64/nptl/tls.h                    |  3 -
 sysdeps/alpha/atomic-machine.h                | 27 +-------
 sysdeps/alpha/memusage.h                      | 20 ------
 sysdeps/alpha/nptl/Makefile                   | 20 ------
 sysdeps/alpha/nptl/tcb-offsets.sym            | 13 ----
 sysdeps/alpha/nptl/tls.h                      |  2 -
 sysdeps/arc/atomic-machine.h                  | 12 ----
 sysdeps/arc/memusage.h                        | 23 -------
 sysdeps/arc/nptl/Makefile                     | 22 -------
 sysdeps/arc/nptl/tcb-offsets.sym              | 11 ----
 sysdeps/arm/atomic-machine.h                  | 17 -----
 sysdeps/arm/memusage.h                        | 20 ------
 sysdeps/arm/nptl/Makefile                     |  4 --
 sysdeps/arm/nptl/tcb-offsets.sym              | 10 ---
 sysdeps/arm/nptl/tls.h                        |  3 -
 sysdeps/csky/Makefile                         |  4 --
 sysdeps/csky/atomic-machine.h                 | 10 ---
 sysdeps/csky/memusage.h                       | 21 ------
 sysdeps/csky/nptl/Makefile                    | 20 ------
 sysdeps/csky/nptl/tcb-offsets.sym             | 10 ---
 sysdeps/csky/nptl/tls.h                       |  1 -
 sysdeps/generic/memusage.h                    | 51 ---------------
 sysdeps/hppa/memusage.h                       | 21 ------
 sysdeps/hppa/nptl/Makefile                    | 20 ------
 sysdeps/hppa/nptl/tcb-offsets.sym             | 17 -----
 sysdeps/hppa/nptl/tls.h                       |  3 -
 sysdeps/i386/htl/machine-sp.h                 |  2 +-
 sysdeps/i386/i586/memusage.h                  |  1 -
 sysdeps/i386/memusage.h                       | 20 ------
 sysdeps/ia64/atomic-machine.h                 | 26 --------
 sysdeps/ia64/memusage.h                       | 29 ---------
 sysdeps/m68k/coldfire/atomic-machine.h        | 31 ---------
 sysdeps/m68k/m680x0/m68020/atomic-machine.h   | 28 --------
 sysdeps/m68k/memusage.h                       | 21 ------
 sysdeps/m68k/nptl/Makefile                    | 20 ------
 sysdeps/m68k/nptl/tcb-offsets.sym             | 10 ---
 sysdeps/m68k/nptl/tls.h                       |  3 -
 sysdeps/mach/hurd/i386/tls.h                  |  1 -
 sysdeps/mach/i386/machine-sp.h                |  2 +-
 sysdeps/microblaze/atomic-machine.h           | 17 -----
 sysdeps/microblaze/memusage.h                 | 21 ------
 sysdeps/microblaze/nptl/Makefile              | 21 ------
 sysdeps/microblaze/nptl/tcb-offsets.sym       | 10 ---
 sysdeps/microblaze/nptl/tls.h                 |  3 -
 sysdeps/mips/atomic-machine.h                 | 17 -----
 sysdeps/mips/memusage.h                       | 20 ------
 sysdeps/mips/nptl/Makefile                    | 20 ------
 sysdeps/mips/nptl/tcb-offsets.sym             | 10 ---
 sysdeps/mips/nptl/tls.h                       |  2 -
 sysdeps/nios2/Makefile                        |  4 --
 sysdeps/nios2/memusage.h                      | 23 -------
 sysdeps/powerpc/atomic-machine.h              | 17 -----
 sysdeps/powerpc/memusage.h                    | 20 ------
 sysdeps/riscv/memusage.h                      | 21 ------
 sysdeps/riscv/nptl/Makefile                   | 21 ------
 sysdeps/riscv/nptl/tcb-offsets.sym            |  6 --
 sysdeps/s390/atomic-machine.h                 | 27 --------
 sysdeps/s390/memusage.h                       | 20 ------
 sysdeps/sh/memusage.h                         | 20 ------
 sysdeps/sparc/atomic-machine.h                | 27 --------
 sysdeps/sparc/memusage.h                      | 20 ------
 sysdeps/unix/sysv/linux/hppa/atomic-machine.h | 17 -----
 .../sysv/linux/m68k/coldfire/atomic-machine.h | 11 ----
 .../sysv/linux/machine-sp.h}                  | 16 +++--
 .../unix/sysv/linux/nios2/atomic-machine.h    | 12 ----
 .../unix/sysv/linux/riscv/atomic-machine.h    | 13 ----
 sysdeps/unix/sysv/linux/sh/atomic-machine.h   | 28 --------
 sysdeps/x86/atomic-machine.h                  | 40 ++----------
 sysdeps/x86_64/memusage.h                     | 21 ------
 74 files changed, 60 insertions(+), 1174 deletions(-)
 delete mode 100644 sysdeps/aarch64/memusage.h
 delete mode 100644 sysdeps/aarch64/nptl/Makefile
 delete mode 100644 sysdeps/aarch64/nptl/tcb-offsets.sym
 delete mode 100644 sysdeps/alpha/memusage.h
 delete mode 100644 sysdeps/alpha/nptl/Makefile
 delete mode 100644 sysdeps/alpha/nptl/tcb-offsets.sym
 delete mode 100644 sysdeps/arc/memusage.h
 delete mode 100644 sysdeps/arc/nptl/Makefile
 delete mode 100644 sysdeps/arc/nptl/tcb-offsets.sym
 delete mode 100644 sysdeps/arm/memusage.h
 delete mode 100644 sysdeps/arm/nptl/tcb-offsets.sym
 delete mode 100644 sysdeps/csky/memusage.h
 delete mode 100644 sysdeps/csky/nptl/Makefile
 delete mode 100644 sysdeps/csky/nptl/tcb-offsets.sym
 delete mode 100644 sysdeps/generic/memusage.h
 delete mode 100644 sysdeps/hppa/memusage.h
 delete mode 100644 sysdeps/hppa/nptl/Makefile
 delete mode 100644 sysdeps/hppa/nptl/tcb-offsets.sym
 delete mode 100644 sysdeps/i386/i586/memusage.h
 delete mode 100644 sysdeps/i386/memusage.h
 delete mode 100644 sysdeps/ia64/memusage.h
 delete mode 100644 sysdeps/m68k/memusage.h
 delete mode 100644 sysdeps/m68k/nptl/Makefile
 delete mode 100644 sysdeps/m68k/nptl/tcb-offsets.sym
 delete mode 100644 sysdeps/microblaze/memusage.h
 delete mode 100644 sysdeps/microblaze/nptl/Makefile
 delete mode 100644 sysdeps/microblaze/nptl/tcb-offsets.sym
 delete mode 100644 sysdeps/mips/memusage.h
 delete mode 100644 sysdeps/mips/nptl/Makefile
 delete mode 100644 sysdeps/mips/nptl/tcb-offsets.sym
 delete mode 100644 sysdeps/nios2/memusage.h
 delete mode 100644 sysdeps/powerpc/memusage.h
 delete mode 100644 sysdeps/riscv/memusage.h
 delete mode 100644 sysdeps/riscv/nptl/Makefile
 delete mode 100644 sysdeps/riscv/nptl/tcb-offsets.sym
 delete mode 100644 sysdeps/s390/memusage.h
 delete mode 100644 sysdeps/sh/memusage.h
 delete mode 100644 sysdeps/sparc/memusage.h
 rename sysdeps/{i386/i686/memusage.h => unix/sysv/linux/machine-sp.h} (68%)
 delete mode 100644 sysdeps/x86_64/memusage.h

-- 
2.32.0


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/5] Remove ununsed tcb-offset
  2021-12-16 19:42 [PATCH 0/5] Architecture code cleanup Adhemerval Zanella
@ 2021-12-16 19:42 ` Adhemerval Zanella
  2021-12-17 19:26   ` Adhemerval Zanella
  2021-12-16 19:42 ` [PATCH 2/5] malloc: Use C11 atomics on libmemusage Adhemerval Zanella
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 12+ messages in thread
From: Adhemerval Zanella @ 2021-12-16 19:42 UTC (permalink / raw)
  To: libc-alpha, Stafford Horne

Some architectures do not use the auto-generated tcb-offsets.h.
---
 sysdeps/aarch64/nptl/Makefile           | 21 ---------------------
 sysdeps/aarch64/nptl/tcb-offsets.sym    |  6 ------
 sysdeps/aarch64/nptl/tls.h              |  3 ---
 sysdeps/alpha/nptl/Makefile             | 20 --------------------
 sysdeps/alpha/nptl/tcb-offsets.sym      | 13 -------------
 sysdeps/alpha/nptl/tls.h                |  2 --
 sysdeps/arc/nptl/Makefile               | 22 ----------------------
 sysdeps/arc/nptl/tcb-offsets.sym        | 11 -----------
 sysdeps/arm/nptl/Makefile               |  4 ----
 sysdeps/arm/nptl/tcb-offsets.sym        | 10 ----------
 sysdeps/arm/nptl/tls.h                  |  3 ---
 sysdeps/csky/Makefile                   |  4 ----
 sysdeps/csky/nptl/Makefile              | 20 --------------------
 sysdeps/csky/nptl/tcb-offsets.sym       | 10 ----------
 sysdeps/csky/nptl/tls.h                 |  1 -
 sysdeps/hppa/nptl/Makefile              | 20 --------------------
 sysdeps/hppa/nptl/tcb-offsets.sym       | 17 -----------------
 sysdeps/hppa/nptl/tls.h                 |  3 ---
 sysdeps/m68k/nptl/Makefile              | 20 --------------------
 sysdeps/m68k/nptl/tcb-offsets.sym       | 10 ----------
 sysdeps/m68k/nptl/tls.h                 |  3 ---
 sysdeps/microblaze/nptl/Makefile        | 21 ---------------------
 sysdeps/microblaze/nptl/tcb-offsets.sym | 10 ----------
 sysdeps/microblaze/nptl/tls.h           |  3 ---
 sysdeps/mips/nptl/Makefile              | 20 --------------------
 sysdeps/mips/nptl/tcb-offsets.sym       | 10 ----------
 sysdeps/mips/nptl/tls.h                 |  2 --
 sysdeps/nios2/Makefile                  |  4 ----
 sysdeps/riscv/nptl/Makefile             | 21 ---------------------
 sysdeps/riscv/nptl/tcb-offsets.sym      |  6 ------
 30 files changed, 320 deletions(-)
 delete mode 100644 sysdeps/aarch64/nptl/Makefile
 delete mode 100644 sysdeps/aarch64/nptl/tcb-offsets.sym
 delete mode 100644 sysdeps/alpha/nptl/Makefile
 delete mode 100644 sysdeps/alpha/nptl/tcb-offsets.sym
 delete mode 100644 sysdeps/arc/nptl/Makefile
 delete mode 100644 sysdeps/arc/nptl/tcb-offsets.sym
 delete mode 100644 sysdeps/arm/nptl/tcb-offsets.sym
 delete mode 100644 sysdeps/csky/nptl/Makefile
 delete mode 100644 sysdeps/csky/nptl/tcb-offsets.sym
 delete mode 100644 sysdeps/hppa/nptl/Makefile
 delete mode 100644 sysdeps/hppa/nptl/tcb-offsets.sym
 delete mode 100644 sysdeps/m68k/nptl/Makefile
 delete mode 100644 sysdeps/m68k/nptl/tcb-offsets.sym
 delete mode 100644 sysdeps/microblaze/nptl/Makefile
 delete mode 100644 sysdeps/microblaze/nptl/tcb-offsets.sym
 delete mode 100644 sysdeps/mips/nptl/Makefile
 delete mode 100644 sysdeps/mips/nptl/tcb-offsets.sym
 delete mode 100644 sysdeps/riscv/nptl/Makefile
 delete mode 100644 sysdeps/riscv/nptl/tcb-offsets.sym

diff --git a/sysdeps/aarch64/nptl/Makefile b/sysdeps/aarch64/nptl/Makefile
deleted file mode 100644
index 6d23959e30..0000000000
--- a/sysdeps/aarch64/nptl/Makefile
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright (C) 2005-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/>.
-
-ifeq ($(subdir),csu)
-gen-as-const-headers += tcb-offsets.sym
-endif
diff --git a/sysdeps/aarch64/nptl/tcb-offsets.sym b/sysdeps/aarch64/nptl/tcb-offsets.sym
deleted file mode 100644
index 238647dd47..0000000000
--- a/sysdeps/aarch64/nptl/tcb-offsets.sym
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <sysdep.h>
-#include <tls.h>
-
-PTHREAD_MULTIPLE_THREADS_OFFSET		offsetof (struct pthread, header.multiple_threads)
-PTHREAD_TID_OFFSET			offsetof (struct pthread, tid)
-PTHREAD_SIZEOF				sizeof (struct pthread)
diff --git a/sysdeps/aarch64/nptl/tls.h b/sysdeps/aarch64/nptl/tls.h
index 860776bb4b..84916f36b7 100644
--- a/sysdeps/aarch64/nptl/tls.h
+++ b/sysdeps/aarch64/nptl/tls.h
@@ -26,9 +26,6 @@
 # include <stddef.h>
 # include <stdint.h>
 # include <dl-dtv.h>
-
-#else /* __ASSEMBLER__ */
-# include <tcb-offsets.h>
 #endif /* __ASSEMBLER__ */
 
 #ifndef __ASSEMBLER__
diff --git a/sysdeps/alpha/nptl/Makefile b/sysdeps/alpha/nptl/Makefile
deleted file mode 100644
index fc5567ee55..0000000000
--- a/sysdeps/alpha/nptl/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright (C) 2003-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/>.
-
-ifeq ($(subdir),csu)
-gen-as-const-headers += tcb-offsets.sym
-endif
diff --git a/sysdeps/alpha/nptl/tcb-offsets.sym b/sysdeps/alpha/nptl/tcb-offsets.sym
deleted file mode 100644
index 1005621b37..0000000000
--- a/sysdeps/alpha/nptl/tcb-offsets.sym
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <sysdep.h>
-#include <tls.h>
-
---
-
--- Abuse tls.h macros to derive offsets relative to the thread register.
--- # define __builtin_thread_pointer()  ((void *) 0)
--- # define thread_offsetof(mem)     ((void *) &THREAD_SELF->mem - (void *) 0)
--- Ho hum, this doesn't work in gcc4, so Know Things about THREAD_SELF
-#define thread_offsetof(mem)	(long)(offsetof(struct pthread, mem) - sizeof(struct pthread))
-
-MULTIPLE_THREADS_OFFSET		thread_offsetof (header.multiple_threads)
-TID_OFFSET			thread_offsetof (tid)
diff --git a/sysdeps/alpha/nptl/tls.h b/sysdeps/alpha/nptl/tls.h
index 860cc46d88..c260078c86 100644
--- a/sysdeps/alpha/nptl/tls.h
+++ b/sysdeps/alpha/nptl/tls.h
@@ -109,8 +109,6 @@ typedef struct
     }									     \
   while (0)
 
-#else /* __ASSEMBLER__ */
-# include <tcb-offsets.h>
 #endif /* __ASSEMBLER__ */
 
 #endif	/* tls.h */
diff --git a/sysdeps/arc/nptl/Makefile b/sysdeps/arc/nptl/Makefile
deleted file mode 100644
index d85b47416a..0000000000
--- a/sysdeps/arc/nptl/Makefile
+++ /dev/null
@@ -1,22 +0,0 @@
-# NPTL makefile fragment for ARC.
-# Copyright (C) 2020-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/>.
-
-ifeq ($(subdir),csu)
-gen-as-const-headers += tcb-offsets.sym
-endif
diff --git a/sysdeps/arc/nptl/tcb-offsets.sym b/sysdeps/arc/nptl/tcb-offsets.sym
deleted file mode 100644
index 64c432c22e..0000000000
--- a/sysdeps/arc/nptl/tcb-offsets.sym
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <sysdep.h>
-#include <tls.h>
-
--- Derive offsets relative to the thread register.
-#define thread_offsetof(mem)	(long)(offsetof (struct pthread, mem) - sizeof (struct pthread))
-
-MULTIPLE_THREADS_OFFSET		offsetof (struct pthread, header.multiple_threads)
-TLS_PRE_TCB_SIZE		sizeof (struct pthread)
-TLS_TCB_SIZE            	sizeof (tcbhead_t)
-
-PTHREAD_TID			offsetof (struct pthread, tid)
diff --git a/sysdeps/arm/nptl/Makefile b/sysdeps/arm/nptl/Makefile
index 44154bff37..2e8efe7170 100644
--- a/sysdeps/arm/nptl/Makefile
+++ b/sysdeps/arm/nptl/Makefile
@@ -15,10 +15,6 @@
 # License along with the GNU C Library.  If not, see
 # <https://www.gnu.org/licenses/>.
 
-ifeq ($(subdir),csu)
-gen-as-const-headers += tcb-offsets.sym
-endif
-
 ifeq ($(subdir),nptl)
 # This test relies on compiling part of the binary with EH information,
 # part without, and unwinding through.  The .ARM.exidx tables have
diff --git a/sysdeps/arm/nptl/tcb-offsets.sym b/sysdeps/arm/nptl/tcb-offsets.sym
deleted file mode 100644
index bf9c0a1c17..0000000000
--- a/sysdeps/arm/nptl/tcb-offsets.sym
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <sysdep.h>
-#include <tls.h>
-
---
-
--- Derive offsets relative to the thread register.
-#define thread_offsetof(mem)	(long)(offsetof(struct pthread, mem) - sizeof(struct pthread))
-
-MULTIPLE_THREADS_OFFSET		thread_offsetof (header.multiple_threads)
-TID_OFFSET			thread_offsetof (tid)
diff --git a/sysdeps/arm/nptl/tls.h b/sysdeps/arm/nptl/tls.h
index 57e039fc0f..9662da39ab 100644
--- a/sysdeps/arm/nptl/tls.h
+++ b/sysdeps/arm/nptl/tls.h
@@ -26,9 +26,6 @@
 # include <stddef.h>
 # include <stdint.h>
 # include <dl-dtv.h>
-
-#else /* __ASSEMBLER__ */
-# include <tcb-offsets.h>
 #endif /* __ASSEMBLER__ */
 
 
diff --git a/sysdeps/csky/Makefile b/sysdeps/csky/Makefile
index 0db09dccce..1ced510c2d 100644
--- a/sysdeps/csky/Makefile
+++ b/sysdeps/csky/Makefile
@@ -1,7 +1,3 @@
-ifeq ($(subdir),csu)
-gen-as-const-headers += tcb-offsets.sym
-endif
-
 ASFLAGS-.os += $(pic-ccflag)
 
 ifeq ($(subdir),gmon)
diff --git a/sysdeps/csky/nptl/Makefile b/sysdeps/csky/nptl/Makefile
deleted file mode 100644
index a16a8b63ca..0000000000
--- a/sysdeps/csky/nptl/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright (C) 2018-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/>.
-
-ifeq ($(subdir),csu)
-gen-as-const-headers += tcb-offsets.sym
-endif
diff --git a/sysdeps/csky/nptl/tcb-offsets.sym b/sysdeps/csky/nptl/tcb-offsets.sym
deleted file mode 100644
index f1105205c0..0000000000
--- a/sysdeps/csky/nptl/tcb-offsets.sym
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <sysdep.h>
-#include <tls.h>
-
---
-
--- Derive offsets relative to the thread register.
-#define thread_offsetof(mem)	(long)(offsetof (struct pthread, mem) - sizeof (struct pthread))
-
-MULTIPLE_THREADS_OFFSET		thread_offsetof (header.multiple_threads)
-TID_OFFSET			thread_offsetof (tid)
diff --git a/sysdeps/csky/nptl/tls.h b/sysdeps/csky/nptl/tls.h
index 64dcaec279..afd1b3bbb7 100644
--- a/sysdeps/csky/nptl/tls.h
+++ b/sysdeps/csky/nptl/tls.h
@@ -34,7 +34,6 @@
      __result; })
 
 #else
-# include <tcb-offsets.h>
 /* Define r31 as thread pointer register.  */
 # define READ_THREAD_POINTER() \
 	mov r0, r31;
diff --git a/sysdeps/hppa/nptl/Makefile b/sysdeps/hppa/nptl/Makefile
deleted file mode 100644
index 329a57a473..0000000000
--- a/sysdeps/hppa/nptl/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright (C) 2005-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/>.
-
-ifeq ($(subdir),csu)
-gen-as-const-headers += tcb-offsets.sym
-endif
diff --git a/sysdeps/hppa/nptl/tcb-offsets.sym b/sysdeps/hppa/nptl/tcb-offsets.sym
deleted file mode 100644
index 6e852f35b1..0000000000
--- a/sysdeps/hppa/nptl/tcb-offsets.sym
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <pthread.h>
-#include <tls.h>
-
-RESULT			offsetof (struct pthread, result)
-TID			offsetof (struct pthread, tid)
-CANCELHANDLING		offsetof (struct pthread, cancelhandling)
-CLEANUP_JMP_BUF		offsetof (struct pthread, cleanup_jmp_buf)
-MULTIPLE_THREADS_OFFSET	offsetof (struct pthread, header.multiple_threads)
-TLS_PRE_TCB_SIZE	sizeof (struct pthread)
-MUTEX_FUTEX		offsetof (pthread_mutex_t, __data.__lock)
-
--- Use a thread_offset when working with asm to make things simpler
--- This way we get the offset of a member in the struct pthread that
--- preceeds the thread pointer (which points to the dtv).
-#define thread_offsetof(mem)    (unsigned int)(offsetof(struct pthread, mem) - sizeof(struct pthread))
-TID_THREAD_OFFSET		thread_offsetof (tid)
-MULTIPLE_THREADS_THREAD_OFFSET	thread_offsetof (header.multiple_threads)
diff --git a/sysdeps/hppa/nptl/tls.h b/sysdeps/hppa/nptl/tls.h
index 62bfb96548..c4039038d3 100644
--- a/sysdeps/hppa/nptl/tls.h
+++ b/sysdeps/hppa/nptl/tls.h
@@ -26,9 +26,6 @@
 # include <stddef.h>
 # include <stdint.h>
 # include <dl-dtv.h>
-
-#else /* __ASSEMBLER__ */
-# include <tcb-offsets.h>
 #endif /* __ASSEMBLER__ */
 
 #ifndef __ASSEMBLER__
diff --git a/sysdeps/m68k/nptl/Makefile b/sysdeps/m68k/nptl/Makefile
deleted file mode 100644
index ed9ddd1648..0000000000
--- a/sysdeps/m68k/nptl/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright (C) 2010-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/>.
-
-ifeq ($(subdir),csu)
-gen-as-const-headers += tcb-offsets.sym
-endif
diff --git a/sysdeps/m68k/nptl/tcb-offsets.sym b/sysdeps/m68k/nptl/tcb-offsets.sym
deleted file mode 100644
index 241fb8b47c..0000000000
--- a/sysdeps/m68k/nptl/tcb-offsets.sym
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <sysdep.h>
-#include <tls.h>
-
---
-
--- Derive offsets relative to the thread register.
-#define thread_offsetof(mem)	(long)(offsetof(struct pthread, mem) - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE)
-
-MULTIPLE_THREADS_OFFSET		thread_offsetof (header.multiple_threads)
-TID_OFFSET			thread_offsetof (tid)
diff --git a/sysdeps/m68k/nptl/tls.h b/sysdeps/m68k/nptl/tls.h
index 3acedc8465..ab2a1d54bd 100644
--- a/sysdeps/m68k/nptl/tls.h
+++ b/sysdeps/m68k/nptl/tls.h
@@ -26,9 +26,6 @@
 # include <stddef.h>
 # include <stdint.h>
 # include <dl-dtv.h>
-
-#else /* __ASSEMBLER__ */
-# include <tcb-offsets.h>
 #endif /* __ASSEMBLER__ */
 
 #ifndef __ASSEMBLER__
diff --git a/sysdeps/microblaze/nptl/Makefile b/sysdeps/microblaze/nptl/Makefile
deleted file mode 100644
index 6d23959e30..0000000000
--- a/sysdeps/microblaze/nptl/Makefile
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright (C) 2005-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/>.
-
-ifeq ($(subdir),csu)
-gen-as-const-headers += tcb-offsets.sym
-endif
diff --git a/sysdeps/microblaze/nptl/tcb-offsets.sym b/sysdeps/microblaze/nptl/tcb-offsets.sym
deleted file mode 100644
index 614f0dfed6..0000000000
--- a/sysdeps/microblaze/nptl/tcb-offsets.sym
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <sysdep.h>
-#include <tls.h>
-
---
-
--- Abuse tls.h macros to derive offsets relative to the thread register.
-#define thread_offsetof(mem)	(long)(offsetof (struct pthread, mem) - sizeof (struct pthread))
-
-MULTIPLE_THREADS_OFFSET	thread_offsetof (header.multiple_threads)
-TID_OFFSET			thread_offsetof (tid)
diff --git a/sysdeps/microblaze/nptl/tls.h b/sysdeps/microblaze/nptl/tls.h
index de9d2b693b..2ad2219fe5 100644
--- a/sysdeps/microblaze/nptl/tls.h
+++ b/sysdeps/microblaze/nptl/tls.h
@@ -26,9 +26,6 @@
 # include <stddef.h>
 # include <stdint.h>
 # include <dl-dtv.h>
-
-#else /* __ASSEMBLER__ */
-# include <tcb-offsets.h>
 #endif /* __ASSEMBLER__ */
 
 #ifndef __ASSEMBLER__
diff --git a/sysdeps/mips/nptl/Makefile b/sysdeps/mips/nptl/Makefile
deleted file mode 100644
index 329a57a473..0000000000
--- a/sysdeps/mips/nptl/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright (C) 2005-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/>.
-
-ifeq ($(subdir),csu)
-gen-as-const-headers += tcb-offsets.sym
-endif
diff --git a/sysdeps/mips/nptl/tcb-offsets.sym b/sysdeps/mips/nptl/tcb-offsets.sym
deleted file mode 100644
index 9ea25b94a8..0000000000
--- a/sysdeps/mips/nptl/tcb-offsets.sym
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <sysdep.h>
-#include <tls.h>
-
---
-
--- Abuse tls.h macros to derive offsets relative to the thread register.
-#define thread_offsetof(mem)	(long)(offsetof(struct pthread, mem) - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE)
-
-MULTIPLE_THREADS_OFFSET		thread_offsetof (header.multiple_threads)
-TID_OFFSET			thread_offsetof (tid)
diff --git a/sysdeps/mips/nptl/tls.h b/sysdeps/mips/nptl/tls.h
index 797e661dc1..ce7c6606be 100644
--- a/sysdeps/mips/nptl/tls.h
+++ b/sysdeps/mips/nptl/tls.h
@@ -50,8 +50,6 @@
 #endif
 
 #else /* __ASSEMBLER__ */
-# include <tcb-offsets.h>
-
 # if __mips_isa_rev >= 2
 #  define READ_THREAD_POINTER(rd) rdhwr	rd, $29
 # else
diff --git a/sysdeps/nios2/Makefile b/sysdeps/nios2/Makefile
index f368a12b2d..825ed1357e 100644
--- a/sysdeps/nios2/Makefile
+++ b/sysdeps/nios2/Makefile
@@ -24,7 +24,3 @@ long-double-fcts = no
 ifeq ($(subdir),soft-fp)
 sysdep_routines += $(gcc-single-routines) $(gcc-double-routines)
 endif
-
-ifeq ($(subdir),csu)
-gen-as-const-headers += tcb-offsets.sym
-endif
diff --git a/sysdeps/riscv/nptl/Makefile b/sysdeps/riscv/nptl/Makefile
deleted file mode 100644
index cca67db324..0000000000
--- a/sysdeps/riscv/nptl/Makefile
+++ /dev/null
@@ -1,21 +0,0 @@
-# Makefile for sysdeps/riscv/nptl.
-# Copyright (C) 2005-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/>.
-
-ifeq ($(subdir),csu)
-gen-as-const-headers += tcb-offsets.sym
-endif
diff --git a/sysdeps/riscv/nptl/tcb-offsets.sym b/sysdeps/riscv/nptl/tcb-offsets.sym
deleted file mode 100644
index ab4981f2e2..0000000000
--- a/sysdeps/riscv/nptl/tcb-offsets.sym
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <sysdep.h>
-#include <tls.h>
-
-#define thread_offsetof(mem)	(long)(offsetof (struct pthread, mem) - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE)
-
-MULTIPLE_THREADS_OFFSET		thread_offsetof (header.multiple_threads)
-- 
2.32.0


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 2/5] malloc: Use C11 atomics on libmemusage
  2021-12-16 19:42 [PATCH 0/5] Architecture code cleanup Adhemerval Zanella
  2021-12-16 19:42 ` [PATCH 1/5] Remove ununsed tcb-offset Adhemerval Zanella
@ 2021-12-16 19:42 ` Adhemerval Zanella
  2021-12-16 19:42 ` [PATCH 3/5] Remove atomic-machine.h boilerplates definition Adhemerval Zanella
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Adhemerval Zanella @ 2021-12-16 19:42 UTC (permalink / raw)
  To: libc-alpha, Stafford Horne

It removes the usage of atomic-machine.h types.
---
 malloc/memusage.c          | 37 +++++++++++++++++++------------------
 sysdeps/arc/memusage.h     |  2 --
 sysdeps/generic/memusage.h | 14 --------------
 sysdeps/nios2/memusage.h   |  2 --
 4 files changed, 19 insertions(+), 36 deletions(-)

diff --git a/malloc/memusage.c b/malloc/memusage.c
index e99f0c1c14..d287a7aa82 100644
--- a/malloc/memusage.c
+++ b/malloc/memusage.c
@@ -32,6 +32,7 @@
 #include <stdint.h>
 #include <sys/mman.h>
 #include <sys/time.h>
+#include <stdatomic.h>
 
 #include <memusage.h>
 
@@ -71,20 +72,20 @@ struct header
 #define MAGIC 0xfeedbeaf
 
 
-static memusage_cntr_t calls[idx_last];
-static memusage_cntr_t failed[idx_last];
-static memusage_size_t total[idx_last];
-static memusage_size_t grand_total;
-static memusage_cntr_t histogram[65536 / 16];
-static memusage_cntr_t large;
-static memusage_cntr_t calls_total;
-static memusage_cntr_t inplace;
-static memusage_cntr_t decreasing;
-static memusage_cntr_t realloc_free;
-static memusage_cntr_t inplace_mremap;
-static memusage_cntr_t decreasing_mremap;
-static memusage_size_t current_heap;
-static memusage_size_t peak_use[3];
+static atomic_ulong calls[idx_last];
+static atomic_ulong failed[idx_last];
+static atomic_size_t total[idx_last];
+static atomic_size_t grand_total;
+static atomic_ulong histogram[65536 / 16];
+static atomic_ulong large;
+static atomic_ulong calls_total;
+static atomic_ulong inplace;
+static atomic_ulong decreasing;
+static atomic_ulong realloc_free;
+static atomic_ulong inplace_mremap;
+static atomic_ulong decreasing_mremap;
+static atomic_size_t current_heap;
+static atomic_size_t peak_use[3];
 static __thread uintptr_t start_sp;
 
 /* A few macros to make the source more readable.  */
@@ -111,7 +112,7 @@ struct entry
 };
 
 static struct entry buffer[2 * DEFAULT_BUFFER_SIZE];
-static uatomic32_t buffer_cnt;
+static _Atomic uint32_t buffer_cnt;
 static struct entry first;
 
 
@@ -128,7 +129,7 @@ update_data (struct header *result, size_t len, size_t old_len)
     }
 
   /* Compute current heap usage and compare it with the maximum value.  */
-  memusage_size_t heap
+  atomic_size_t heap
     = catomic_exchange_and_add (&current_heap, len - old_len) + len - old_len;
   catomic_max (&peak_heap, heap);
 
@@ -161,14 +162,14 @@ update_data (struct header *result, size_t len, size_t old_len)
   /* Store the value only if we are writing to a file.  */
   if (fd != -1)
     {
-      uatomic32_t idx = catomic_exchange_and_add (&buffer_cnt, 1);
+      _Atomic uint32_t idx = catomic_exchange_and_add (&buffer_cnt, 1);
       if (idx + 1 >= 2 * buffer_size)
         {
           /* We try to reset the counter to the correct range.  If
              this fails because of another thread increasing the
              counter it does not matter since that thread will take
              care of the correction.  */
-          uatomic32_t reset = (idx + 1) % (2 * buffer_size);
+          _Atomic uint32_t reset = (idx + 1) % (2 * buffer_size);
           catomic_compare_and_exchange_val_acq (&buffer_cnt, reset, idx + 1);
           if (idx >= 2 * buffer_size)
             idx = reset - 1;
diff --git a/sysdeps/arc/memusage.h b/sysdeps/arc/memusage.h
index 290252a92f..e8a508a8ff 100644
--- a/sysdeps/arc/memusage.h
+++ b/sysdeps/arc/memusage.h
@@ -18,6 +18,4 @@
 
 #define GETSP() ({ register uintptr_t stack_ptr asm ("sp"); stack_ptr; })
 
-#define uatomic32_t unsigned int
-
 #include <sysdeps/generic/memusage.h>
diff --git a/sysdeps/generic/memusage.h b/sysdeps/generic/memusage.h
index 408e0b891b..c9bde5cd11 100644
--- a/sysdeps/generic/memusage.h
+++ b/sysdeps/generic/memusage.h
@@ -17,7 +17,6 @@
 
 
 #include <limits.h>
-#include <atomic.h>
 #include <stdint.h>
 
 #ifndef GETSP
@@ -36,16 +35,3 @@
     high = usecs >> 32;							   \
   }
 #endif
-
-#if LONG_BIT == 32
-# define memusage_cntr_t uatomic32_t
-#else
-# define memusage_cntr_t uatomic64_t
-#endif
-#ifndef memusage_size_t
-# if LONG_BIT == 32
-#  define memusage_size_t uatomic32_t
-# else
-#  define memusage_size_t uatomic64_t
-# endif
-#endif
diff --git a/sysdeps/nios2/memusage.h b/sysdeps/nios2/memusage.h
index 01618e44a8..6f1c78812d 100644
--- a/sysdeps/nios2/memusage.h
+++ b/sysdeps/nios2/memusage.h
@@ -18,6 +18,4 @@
 
 #define GETSP() ({ register uintptr_t stack_ptr asm ("%sp"); stack_ptr; })
 
-#define uatomic32_t unsigned int
-
 #include <sysdeps/generic/memusage.h>
-- 
2.32.0


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 3/5] Remove atomic-machine.h boilerplates definition
  2021-12-16 19:42 [PATCH 0/5] Architecture code cleanup Adhemerval Zanella
  2021-12-16 19:42 ` [PATCH 1/5] Remove ununsed tcb-offset Adhemerval Zanella
  2021-12-16 19:42 ` [PATCH 2/5] malloc: Use C11 atomics on libmemusage Adhemerval Zanella
@ 2021-12-16 19:42 ` Adhemerval Zanella
  2021-12-16 19:42 ` [PATCH 4/5] malloc: Use hp-timing on libmemusage Adhemerval Zanella
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Adhemerval Zanella @ 2021-12-16 19:42 UTC (permalink / raw)
  To: libc-alpha, Stafford Horne

Now that memusage.c uses C11 atomics we can remove them.
---
 sysdeps/aarch64/atomic-machine.h              | 17 --------
 sysdeps/alpha/atomic-machine.h                | 27 +------------
 sysdeps/arc/atomic-machine.h                  | 12 ------
 sysdeps/arm/atomic-machine.h                  | 17 --------
 sysdeps/csky/atomic-machine.h                 | 10 -----
 sysdeps/ia64/atomic-machine.h                 | 26 ------------
 sysdeps/m68k/coldfire/atomic-machine.h        | 31 --------------
 sysdeps/m68k/m680x0/m68020/atomic-machine.h   | 28 -------------
 sysdeps/microblaze/atomic-machine.h           | 17 --------
 sysdeps/mips/atomic-machine.h                 | 17 --------
 sysdeps/powerpc/atomic-machine.h              | 17 --------
 sysdeps/s390/atomic-machine.h                 | 27 -------------
 sysdeps/sparc/atomic-machine.h                | 27 -------------
 sysdeps/unix/sysv/linux/hppa/atomic-machine.h | 17 --------
 .../sysv/linux/m68k/coldfire/atomic-machine.h | 11 -----
 .../unix/sysv/linux/nios2/atomic-machine.h    | 12 ------
 .../unix/sysv/linux/riscv/atomic-machine.h    | 13 ------
 sysdeps/unix/sysv/linux/sh/atomic-machine.h   | 28 -------------
 sysdeps/x86/atomic-machine.h                  | 40 ++++---------------
 19 files changed, 8 insertions(+), 386 deletions(-)

diff --git a/sysdeps/aarch64/atomic-machine.h b/sysdeps/aarch64/atomic-machine.h
index 44f55d424d..6056737e0d 100644
--- a/sysdeps/aarch64/atomic-machine.h
+++ b/sysdeps/aarch64/atomic-machine.h
@@ -19,23 +19,6 @@
 #ifndef _AARCH64_ATOMIC_MACHINE_H
 #define _AARCH64_ATOMIC_MACHINE_H	1
 
-#include <stdint.h>
-
-typedef int8_t  atomic8_t;
-typedef int16_t atomic16_t;
-typedef int32_t atomic32_t;
-typedef int64_t atomic64_t;
-
-typedef uint8_t  uatomic8_t;
-typedef uint16_t uatomic16_t;
-typedef uint32_t uatomic32_t;
-typedef uint64_t uatomic64_t;
-
-typedef intptr_t atomicptr_t;
-typedef uintptr_t uatomicptr_t;
-typedef intmax_t atomic_max_t;
-typedef uintmax_t uatomic_max_t;
-
 #define __HAVE_64B_ATOMICS 1
 #define USE_ATOMIC_COMPILER_BUILTINS 1
 #define ATOMIC_EXCHANGE_USES_CAS 0
diff --git a/sysdeps/alpha/atomic-machine.h b/sysdeps/alpha/atomic-machine.h
index 201b8cf836..2c93e14653 100644
--- a/sysdeps/alpha/atomic-machine.h
+++ b/sysdeps/alpha/atomic-machine.h
@@ -17,31 +17,6 @@
 
 #include <stdint.h>
 
-typedef int8_t atomic8_t;
-typedef uint8_t uatomic8_t;
-typedef int_fast8_t atomic_fast8_t;
-typedef uint_fast8_t uatomic_fast8_t;
-
-typedef int16_t atomic16_t;
-typedef uint16_t uatomic16_t;
-typedef int_fast16_t atomic_fast16_t;
-typedef uint_fast16_t uatomic_fast16_t;
-
-typedef int32_t atomic32_t;
-typedef uint32_t uatomic32_t;
-typedef int_fast32_t atomic_fast32_t;
-typedef uint_fast32_t uatomic_fast32_t;
-
-typedef int64_t atomic64_t;
-typedef uint64_t uatomic64_t;
-typedef int_fast64_t atomic_fast64_t;
-typedef uint_fast64_t uatomic_fast64_t;
-
-typedef intptr_t atomicptr_t;
-typedef uintptr_t uatomicptr_t;
-typedef intmax_t atomic_max_t;
-typedef uintmax_t uatomic_max_t;
-
 #define __HAVE_64B_ATOMICS 1
 #define USE_ATOMIC_COMPILER_BUILTINS 0
 
@@ -127,7 +102,7 @@ typedef uintmax_t uatomic_max_t;
 	: [__prev] "=&r" (__prev),					\
 	  [__cmp] "=&r" (__cmp)						\
 	: [__mem] "m" (*(mem)),						\
-	  [__old] "Ir" ((uint64_t)(atomic32_t)(uint64_t)(old)),		\
+	  [__old] "Ir" ((uint64_t)(int32_t)(uint64_t)(old)),		\
 	  [__new] "Ir" (new)						\
 	: "memory");							\
 })
diff --git a/sysdeps/arc/atomic-machine.h b/sysdeps/arc/atomic-machine.h
index 4cffc97f20..2080aaabfc 100644
--- a/sysdeps/arc/atomic-machine.h
+++ b/sysdeps/arc/atomic-machine.h
@@ -19,18 +19,6 @@
 #ifndef _ARC_BITS_ATOMIC_H
 #define _ARC_BITS_ATOMIC_H 1
 
-#include <stdint.h>
-
-typedef int32_t atomic32_t;
-typedef uint32_t uatomic32_t;
-typedef int_fast32_t atomic_fast32_t;
-typedef uint_fast32_t uatomic_fast32_t;
-
-typedef intptr_t atomicptr_t;
-typedef uintptr_t uatomicptr_t;
-typedef intmax_t atomic_max_t;
-typedef uintmax_t uatomic_max_t;
-
 #define __HAVE_64B_ATOMICS 0
 #define USE_ATOMIC_COMPILER_BUILTINS 1
 
diff --git a/sysdeps/arm/atomic-machine.h b/sysdeps/arm/atomic-machine.h
index 7928ff29d8..b439be9bfc 100644
--- a/sysdeps/arm/atomic-machine.h
+++ b/sysdeps/arm/atomic-machine.h
@@ -16,23 +16,6 @@
    License along with the GNU C Library.  If not, see
    <https://www.gnu.org/licenses/>.  */
 
-#include <stdint.h>
-
-typedef int8_t atomic8_t;
-typedef uint8_t uatomic8_t;
-typedef int_fast8_t atomic_fast8_t;
-typedef uint_fast8_t uatomic_fast8_t;
-
-typedef int32_t atomic32_t;
-typedef uint32_t uatomic32_t;
-typedef int_fast32_t atomic_fast32_t;
-typedef uint_fast32_t uatomic_fast32_t;
-
-typedef intptr_t atomicptr_t;
-typedef uintptr_t uatomicptr_t;
-typedef intmax_t atomic_max_t;
-typedef uintmax_t uatomic_max_t;
-
 #define __HAVE_64B_ATOMICS 0
 #define USE_ATOMIC_COMPILER_BUILTINS 0
 #define ATOMIC_EXCHANGE_USES_CAS 1
diff --git a/sysdeps/csky/atomic-machine.h b/sysdeps/csky/atomic-machine.h
index 7544c50413..4cd9f87aad 100644
--- a/sysdeps/csky/atomic-machine.h
+++ b/sysdeps/csky/atomic-machine.h
@@ -19,16 +19,6 @@
 #ifndef __CSKY_ATOMIC_H_
 #define __CSKY_ATOMIC_H_
 
-#include <stdint.h>
-
-typedef int32_t atomic32_t;
-typedef uint32_t uatomic32_t;
-
-typedef intptr_t atomicptr_t;
-typedef uintptr_t uatomicptr_t;
-typedef intmax_t atomic_max_t;
-typedef uintmax_t uatomic_max_t;
-
 #define __HAVE_64B_ATOMICS 0
 #define USE_ATOMIC_COMPILER_BUILTINS 1
 #define ATOMIC_EXCHANGE_USES_CAS 1
diff --git a/sysdeps/ia64/atomic-machine.h b/sysdeps/ia64/atomic-machine.h
index 8b7cefbd99..6f0b44ef03 100644
--- a/sysdeps/ia64/atomic-machine.h
+++ b/sysdeps/ia64/atomic-machine.h
@@ -15,34 +15,8 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-#include <stdint.h>
 #include <ia64intrin.h>
 
-typedef int8_t atomic8_t;
-typedef uint8_t uatomic8_t;
-typedef int_fast8_t atomic_fast8_t;
-typedef uint_fast8_t uatomic_fast8_t;
-
-typedef int16_t atomic16_t;
-typedef uint16_t uatomic16_t;
-typedef int_fast16_t atomic_fast16_t;
-typedef uint_fast16_t uatomic_fast16_t;
-
-typedef int32_t atomic32_t;
-typedef uint32_t uatomic32_t;
-typedef int_fast32_t atomic_fast32_t;
-typedef uint_fast32_t uatomic_fast32_t;
-
-typedef int64_t atomic64_t;
-typedef uint64_t uatomic64_t;
-typedef int_fast64_t atomic_fast64_t;
-typedef uint_fast64_t uatomic_fast64_t;
-
-typedef intptr_t atomicptr_t;
-typedef uintptr_t uatomicptr_t;
-typedef intmax_t atomic_max_t;
-typedef uintmax_t uatomic_max_t;
-
 #define __HAVE_64B_ATOMICS 1
 #define USE_ATOMIC_COMPILER_BUILTINS 0
 
diff --git a/sysdeps/m68k/coldfire/atomic-machine.h b/sysdeps/m68k/coldfire/atomic-machine.h
index eae9240a35..23dae68439 100644
--- a/sysdeps/m68k/coldfire/atomic-machine.h
+++ b/sysdeps/m68k/coldfire/atomic-machine.h
@@ -18,37 +18,6 @@
 #ifndef _ATOMIC_MACHINE_H
 #define _ATOMIC_MACHINE_H	1
 
-#include <stdint.h>
-
-/* Coldfire has no atomic compare-and-exchange operation, and the
-   kernel provides no userspace atomicity operations.  Here we just
-   use generic non-atomic implementations instead.  */
-
-typedef int8_t atomic8_t;
-typedef uint8_t uatomic8_t;
-typedef int_fast8_t atomic_fast8_t;
-typedef uint_fast8_t uatomic_fast8_t;
-
-typedef int16_t atomic16_t;
-typedef uint16_t uatomic16_t;
-typedef int_fast16_t atomic_fast16_t;
-typedef uint_fast16_t uatomic_fast16_t;
-
-typedef int32_t atomic32_t;
-typedef uint32_t uatomic32_t;
-typedef int_fast32_t atomic_fast32_t;
-typedef uint_fast32_t uatomic_fast32_t;
-
-typedef int64_t atomic64_t;
-typedef uint64_t uatomic64_t;
-typedef int_fast64_t atomic_fast64_t;
-typedef uint_fast64_t uatomic_fast64_t;
-
-typedef intptr_t atomicptr_t;
-typedef uintptr_t uatomicptr_t;
-typedef intmax_t atomic_max_t;
-typedef uintmax_t uatomic_max_t;
-
 /* If we have just non-atomic operations, we can as well make them wide.  */
 #define __HAVE_64B_ATOMICS 1
 #define USE_ATOMIC_COMPILER_BUILTINS 0
diff --git a/sysdeps/m68k/m680x0/m68020/atomic-machine.h b/sysdeps/m68k/m680x0/m68020/atomic-machine.h
index 7c8c8e75c9..bbf4f1b07d 100644
--- a/sysdeps/m68k/m680x0/m68020/atomic-machine.h
+++ b/sysdeps/m68k/m680x0/m68020/atomic-machine.h
@@ -15,34 +15,6 @@
    License along with the GNU C Library.  If not, see
    <https://www.gnu.org/licenses/>.  */
 
-#include <stdint.h>
-
-
-typedef int8_t atomic8_t;
-typedef uint8_t uatomic8_t;
-typedef int_fast8_t atomic_fast8_t;
-typedef uint_fast8_t uatomic_fast8_t;
-
-typedef int16_t atomic16_t;
-typedef uint16_t uatomic16_t;
-typedef int_fast16_t atomic_fast16_t;
-typedef uint_fast16_t uatomic_fast16_t;
-
-typedef int32_t atomic32_t;
-typedef uint32_t uatomic32_t;
-typedef int_fast32_t atomic_fast32_t;
-typedef uint_fast32_t uatomic_fast32_t;
-
-typedef int64_t atomic64_t;
-typedef uint64_t uatomic64_t;
-typedef int_fast64_t atomic_fast64_t;
-typedef uint_fast64_t uatomic_fast64_t;
-
-typedef intptr_t atomicptr_t;
-typedef uintptr_t uatomicptr_t;
-typedef intmax_t atomic_max_t;
-typedef uintmax_t uatomic_max_t;
-
 #define __HAVE_64B_ATOMICS 1
 #define USE_ATOMIC_COMPILER_BUILTINS 0
 
diff --git a/sysdeps/microblaze/atomic-machine.h b/sysdeps/microblaze/atomic-machine.h
index 365402eeb0..d9cfa7f9c4 100644
--- a/sysdeps/microblaze/atomic-machine.h
+++ b/sysdeps/microblaze/atomic-machine.h
@@ -16,25 +16,8 @@
    License along with the GNU C Library.  If not, see
    <https://www.gnu.org/licenses/>.  */
 
-#include <stdint.h>
 #include <sysdep.h>
 
-
-typedef int8_t atomic8_t;
-typedef uint8_t uatomic8_t;
-typedef int_fast8_t atomic_fast8_t;
-typedef uint_fast8_t uatomic_fast8_t;
-
-typedef int32_t atomic32_t;
-typedef uint32_t uatomic32_t;
-typedef int_fast32_t atomic_fast32_t;
-typedef uint_fast32_t uatomic_fast32_t;
-
-typedef intptr_t atomicptr_t;
-typedef uintptr_t uatomicptr_t;
-typedef intmax_t atomic_max_t;
-typedef uintmax_t uatomic_max_t;
-
 #define __HAVE_64B_ATOMICS 0
 #define USE_ATOMIC_COMPILER_BUILTINS 0
 
diff --git a/sysdeps/mips/atomic-machine.h b/sysdeps/mips/atomic-machine.h
index e946b9d395..47752ee53e 100644
--- a/sysdeps/mips/atomic-machine.h
+++ b/sysdeps/mips/atomic-machine.h
@@ -19,25 +19,8 @@
 #ifndef _MIPS_ATOMIC_MACHINE_H
 #define _MIPS_ATOMIC_MACHINE_H 1
 
-#include <stdint.h>
-#include <inttypes.h>
 #include <sgidefs.h>
 
-typedef int32_t atomic32_t;
-typedef uint32_t uatomic32_t;
-typedef int_fast32_t atomic_fast32_t;
-typedef uint_fast32_t uatomic_fast32_t;
-
-typedef int64_t atomic64_t;
-typedef uint64_t uatomic64_t;
-typedef int_fast64_t atomic_fast64_t;
-typedef uint_fast64_t uatomic_fast64_t;
-
-typedef intptr_t atomicptr_t;
-typedef uintptr_t uatomicptr_t;
-typedef intmax_t atomic_max_t;
-typedef uintmax_t uatomic_max_t;
-
 #if _MIPS_SIM == _ABIO32 && __mips < 2
 #define MIPS_PUSH_MIPS2 ".set	mips2\n\t"
 #else
diff --git a/sysdeps/powerpc/atomic-machine.h b/sysdeps/powerpc/atomic-machine.h
index 7535ba5d19..c0e7f6503f 100644
--- a/sysdeps/powerpc/atomic-machine.h
+++ b/sysdeps/powerpc/atomic-machine.h
@@ -25,23 +25,6 @@
  * as appropriate and which in turn include this file.
  */
 
-#include <stdint.h>
-
-typedef int32_t atomic32_t;
-typedef uint32_t uatomic32_t;
-typedef int_fast32_t atomic_fast32_t;
-typedef uint_fast32_t uatomic_fast32_t;
-
-typedef int64_t atomic64_t;
-typedef uint64_t uatomic64_t;
-typedef int_fast64_t atomic_fast64_t;
-typedef uint_fast64_t uatomic_fast64_t;
-
-typedef intptr_t atomicptr_t;
-typedef uintptr_t uatomicptr_t;
-typedef intmax_t atomic_max_t;
-typedef uintmax_t uatomic_max_t;
-
 /*
  * Powerpc does not have byte and halfword forms of load and reserve and
  * store conditional. So for powerpc we stub out the 8- and 16-bit forms.
diff --git a/sysdeps/s390/atomic-machine.h b/sysdeps/s390/atomic-machine.h
index 34409ca3c6..880e0e3c86 100644
--- a/sysdeps/s390/atomic-machine.h
+++ b/sysdeps/s390/atomic-machine.h
@@ -15,33 +15,6 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-#include <stdint.h>
-
-typedef int8_t atomic8_t;
-typedef uint8_t uatomic8_t;
-typedef int_fast8_t atomic_fast8_t;
-typedef uint_fast8_t uatomic_fast8_t;
-
-typedef int16_t atomic16_t;
-typedef uint16_t uatomic16_t;
-typedef int_fast16_t atomic_fast16_t;
-typedef uint_fast16_t uatomic_fast16_t;
-
-typedef int32_t atomic32_t;
-typedef uint32_t uatomic32_t;
-typedef int_fast32_t atomic_fast32_t;
-typedef uint_fast32_t uatomic_fast32_t;
-
-typedef int64_t atomic64_t;
-typedef uint64_t uatomic64_t;
-typedef int_fast64_t atomic_fast64_t;
-typedef uint_fast64_t uatomic_fast64_t;
-
-typedef intptr_t atomicptr_t;
-typedef uintptr_t uatomicptr_t;
-typedef intmax_t atomic_max_t;
-typedef uintmax_t uatomic_max_t;
-
 /* Activate all C11 atomic builtins.
 
    Note:
diff --git a/sysdeps/sparc/atomic-machine.h b/sysdeps/sparc/atomic-machine.h
index 062600218c..b92d2820a0 100644
--- a/sysdeps/sparc/atomic-machine.h
+++ b/sysdeps/sparc/atomic-machine.h
@@ -19,33 +19,6 @@
 #ifndef _ATOMIC_MACHINE_H
 #define _ATOMIC_MACHINE_H	1
 
-#include <stdint.h>
-
-typedef int8_t atomic8_t;
-typedef uint8_t uatomic8_t;
-typedef int_fast8_t atomic_fast8_t;
-typedef uint_fast8_t uatomic_fast8_t;
-
-typedef int16_t atomic16_t;
-typedef uint16_t uatomic16_t;
-typedef int_fast16_t atomic_fast16_t;
-typedef uint_fast16_t uatomic_fast16_t;
-
-typedef int32_t atomic32_t;
-typedef uint32_t uatomic32_t;
-typedef int_fast32_t atomic_fast32_t;
-typedef uint_fast32_t uatomic_fast32_t;
-
-typedef int64_t atomic64_t;
-typedef uint64_t uatomic64_t;
-typedef int_fast64_t atomic_fast64_t;
-typedef uint_fast64_t uatomic_fast64_t;
-
-typedef intptr_t atomicptr_t;
-typedef uintptr_t uatomicptr_t;
-typedef intmax_t atomic_max_t;
-typedef uintmax_t uatomic_max_t;
-
 #ifdef __arch64__
 # define __HAVE_64B_ATOMICS          1
 #else
diff --git a/sysdeps/unix/sysv/linux/hppa/atomic-machine.h b/sysdeps/unix/sysv/linux/hppa/atomic-machine.h
index e9edc0e7bc..640f6756f8 100644
--- a/sysdeps/unix/sysv/linux/hppa/atomic-machine.h
+++ b/sysdeps/unix/sysv/linux/hppa/atomic-machine.h
@@ -15,26 +15,9 @@
    License along with the GNU C Library.  If not, see
    <https://www.gnu.org/licenses/>.  */
 
-#include <stdint.h> /*  Required for type definitions e.g. uint8_t.  */
-
 #ifndef _ATOMIC_MACHINE_H
 #define _ATOMIC_MACHINE_H	1
 
-typedef int8_t atomic8_t;
-typedef uint8_t uatomic8_t;
-typedef int_fast8_t atomic_fast8_t;
-typedef uint_fast8_t uatomic_fast8_t;
-
-typedef int32_t atomic32_t;
-typedef uint32_t uatomic32_t;
-typedef int_fast32_t atomic_fast32_t;
-typedef uint_fast32_t uatomic_fast32_t;
-
-typedef intptr_t atomicptr_t;
-typedef uintptr_t uatomicptr_t;
-typedef intmax_t atomic_max_t;
-typedef uintmax_t uatomic_max_t;
-
 #define atomic_full_barrier() __sync_synchronize ()
 
 #define __HAVE_64B_ATOMICS 0
diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/atomic-machine.h b/sysdeps/unix/sysv/linux/m68k/coldfire/atomic-machine.h
index 1228660058..929bdf8edd 100644
--- a/sysdeps/unix/sysv/linux/m68k/coldfire/atomic-machine.h
+++ b/sysdeps/unix/sysv/linux/m68k/coldfire/atomic-machine.h
@@ -18,22 +18,11 @@
 #ifndef _ATOMIC_MACHINE_H
 #define _ATOMIC_MACHINE_H	1
 
-#include <stdint.h>
 #include <sysdep.h>
 
 /* Coldfire has no atomic compare-and-exchange operation, but the
    kernel provides userspace atomicity operations.  Use them.  */
 
-typedef int32_t atomic32_t;
-typedef uint32_t uatomic32_t;
-typedef int_fast32_t atomic_fast32_t;
-typedef uint_fast32_t uatomic_fast32_t;
-
-typedef intptr_t atomicptr_t;
-typedef uintptr_t uatomicptr_t;
-typedef intmax_t atomic_max_t;
-typedef uintmax_t uatomic_max_t;
-
 #define __HAVE_64B_ATOMICS 0
 #define USE_ATOMIC_COMPILER_BUILTINS 0
 
diff --git a/sysdeps/unix/sysv/linux/nios2/atomic-machine.h b/sysdeps/unix/sysv/linux/nios2/atomic-machine.h
index 9bba636c68..8ea7cdbc9b 100644
--- a/sysdeps/unix/sysv/linux/nios2/atomic-machine.h
+++ b/sysdeps/unix/sysv/linux/nios2/atomic-machine.h
@@ -19,18 +19,6 @@
 #ifndef _NIOS2_ATOMIC_MACHINE_H
 #define _NIOS2_ATOMIC_MACHINE_H 1
 
-#include <stdint.h>
-
-typedef int32_t atomic32_t;
-typedef uint32_t uatomic32_t;
-typedef int_fast32_t atomic_fast32_t;
-typedef uint_fast32_t uatomic_fast32_t;
-
-typedef intptr_t atomicptr_t;
-typedef uintptr_t uatomicptr_t;
-typedef intmax_t atomic_max_t;
-typedef uintmax_t uatomic_max_t;
-
 #define __HAVE_64B_ATOMICS 0
 #define USE_ATOMIC_COMPILER_BUILTINS 0
 
diff --git a/sysdeps/unix/sysv/linux/riscv/atomic-machine.h b/sysdeps/unix/sysv/linux/riscv/atomic-machine.h
index f4006baac2..8848804f49 100644
--- a/sysdeps/unix/sysv/linux/riscv/atomic-machine.h
+++ b/sysdeps/unix/sysv/linux/riscv/atomic-machine.h
@@ -19,19 +19,6 @@
 #ifndef _LINUX_RISCV_BITS_ATOMIC_H
 #define _LINUX_RISCV_BITS_ATOMIC_H 1
 
-#include <stdint.h>
-
-typedef int32_t atomic32_t;
-typedef uint32_t uatomic32_t;
-
-typedef int64_t atomic64_t;
-typedef uint64_t uatomic64_t;
-
-typedef intptr_t atomicptr_t;
-typedef uintptr_t uatomicptr_t;
-typedef intmax_t atomic_max_t;
-typedef uintmax_t uatomic_max_t;
-
 #define atomic_full_barrier() __sync_synchronize ()
 
 #ifdef __riscv_atomic
diff --git a/sysdeps/unix/sysv/linux/sh/atomic-machine.h b/sysdeps/unix/sysv/linux/sh/atomic-machine.h
index ec82e82c80..28d69907e9 100644
--- a/sysdeps/unix/sysv/linux/sh/atomic-machine.h
+++ b/sysdeps/unix/sysv/linux/sh/atomic-machine.h
@@ -16,34 +16,6 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-#include <stdint.h>
-
-
-typedef int8_t atomic8_t;
-typedef uint8_t uatomic8_t;
-typedef int_fast8_t atomic_fast8_t;
-typedef uint_fast8_t uatomic_fast8_t;
-
-typedef int16_t atomic16_t;
-typedef uint16_t uatomic16_t;
-typedef int_fast16_t atomic_fast16_t;
-typedef uint_fast16_t uatomic_fast16_t;
-
-typedef int32_t atomic32_t;
-typedef uint32_t uatomic32_t;
-typedef int_fast32_t atomic_fast32_t;
-typedef uint_fast32_t uatomic_fast32_t;
-
-typedef int64_t atomic64_t;
-typedef uint64_t uatomic64_t;
-typedef int_fast64_t atomic_fast64_t;
-typedef uint_fast64_t uatomic_fast64_t;
-
-typedef intptr_t atomicptr_t;
-typedef uintptr_t uatomicptr_t;
-typedef intmax_t atomic_max_t;
-typedef uintmax_t uatomic_max_t;
-
 #define __HAVE_64B_ATOMICS 0
 #define USE_ATOMIC_COMPILER_BUILTINS 0
 
diff --git a/sysdeps/x86/atomic-machine.h b/sysdeps/x86/atomic-machine.h
index 2692d94a92..af6e1d1c4f 100644
--- a/sysdeps/x86/atomic-machine.h
+++ b/sysdeps/x86/atomic-machine.h
@@ -23,32 +23,6 @@
 #include <tls.h>			/* For tcbhead_t.  */
 #include <libc-pointer-arith.h>		/* For cast_to_integer.  */
 
-typedef int8_t atomic8_t;
-typedef uint8_t uatomic8_t;
-typedef int_fast8_t atomic_fast8_t;
-typedef uint_fast8_t uatomic_fast8_t;
-
-typedef int16_t atomic16_t;
-typedef uint16_t uatomic16_t;
-typedef int_fast16_t atomic_fast16_t;
-typedef uint_fast16_t uatomic_fast16_t;
-
-typedef int32_t atomic32_t;
-typedef uint32_t uatomic32_t;
-typedef int_fast32_t atomic_fast32_t;
-typedef uint_fast32_t uatomic_fast32_t;
-
-typedef int64_t atomic64_t;
-typedef uint64_t uatomic64_t;
-typedef int_fast64_t atomic_fast64_t;
-typedef uint_fast64_t uatomic_fast64_t;
-
-typedef intptr_t atomicptr_t;
-typedef uintptr_t uatomicptr_t;
-typedef intmax_t atomic_max_t;
-typedef uintmax_t uatomic_max_t;
-
-
 #define LOCK_PREFIX "lock;"
 
 #define USE_ATOMIC_COMPILER_BUILTINS	1
@@ -119,9 +93,9 @@ typedef uintmax_t uatomic_max_t;
 		       "lock\n"						      \
 		       "0:\tcmpxchgq %q2, %1"				      \
 		       : "=a" (ret), "=m" (*mem)			      \
-		       : "q" ((atomic64_t) cast_to_integer (newval)),	      \
+		       : "q" ((int64_t) cast_to_integer (newval)),	      \
 			 "m" (*mem),					      \
-			 "0" ((atomic64_t) cast_to_integer (oldval)),	      \
+			 "0" ((int64_t) cast_to_integer (oldval)),	      \
 			 "i" (offsetof (tcbhead_t, multiple_threads)));	      \
      ret; })
 # define do_exchange_and_add_val_64_acq(pfx, mem, value) 0
@@ -191,7 +165,7 @@ typedef uintmax_t uatomic_max_t;
      else if (__HAVE_64B_ATOMICS)					      \
        __asm __volatile ("xchgq %q0, %1"				      \
 			 : "=r" (result), "=m" (*mem)			      \
-			 : "0" ((atomic64_t) cast_to_integer (newvalue)),     \
+			 : "0" ((int64_t) cast_to_integer (newvalue)),        \
 			   "m" (*mem));					      \
      else								      \
        {								      \
@@ -222,7 +196,7 @@ typedef uintmax_t uatomic_max_t;
      else if (__HAVE_64B_ATOMICS)					      \
        __asm __volatile (lock "xaddq %q0, %1"				      \
 			 : "=r" (__result), "=m" (*mem)			      \
-			 : "0" ((atomic64_t) cast_to_integer (__addval)),     \
+			 : "0" ((int64_t) cast_to_integer (__addval)),     \
 			   "m" (*mem),					      \
 			   "i" (offsetof (tcbhead_t, multiple_threads)));     \
      else								      \
@@ -264,7 +238,7 @@ typedef uintmax_t uatomic_max_t;
     else if (__HAVE_64B_ATOMICS)					      \
       __asm __volatile (lock "addq %q1, %0"				      \
 			: "=m" (*mem)					      \
-			: "ir" ((atomic64_t) cast_to_integer (value)),	      \
+			: "ir" ((int64_t) cast_to_integer (value)),	      \
 			  "m" (*mem),					      \
 			  "i" (offsetof (tcbhead_t, multiple_threads)));      \
     else								      \
@@ -298,7 +272,7 @@ typedef uintmax_t uatomic_max_t;
      else if (__HAVE_64B_ATOMICS)					      \
        __asm __volatile (LOCK_PREFIX "addq %q2, %0; sets %1"		      \
 			 : "=m" (*mem), "=qm" (__result)		      \
-			 : "ir" ((atomic64_t) cast_to_integer (value)),	      \
+			 : "ir" ((int64_t) cast_to_integer (value)),	      \
 			   "m" (*mem));					      \
      else								      \
        __atomic_link_error ();						      \
@@ -322,7 +296,7 @@ typedef uintmax_t uatomic_max_t;
      else if (__HAVE_64B_ATOMICS)					      \
        __asm __volatile (LOCK_PREFIX "addq %q2, %0; setz %1"		      \
 			 : "=m" (*mem), "=qm" (__result)		      \
-			 : "ir" ((atomic64_t) cast_to_integer (value)),	      \
+			 : "ir" ((int64_t) cast_to_integer (value)),	      \
 			   "m" (*mem));					      \
      else								      \
        __atomic_link_error ();					      \
-- 
2.32.0


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 4/5] malloc: Use hp-timing on libmemusage
  2021-12-16 19:42 [PATCH 0/5] Architecture code cleanup Adhemerval Zanella
                   ` (2 preceding siblings ...)
  2021-12-16 19:42 ` [PATCH 3/5] Remove atomic-machine.h boilerplates definition Adhemerval Zanella
@ 2021-12-16 19:42 ` Adhemerval Zanella
  2021-12-16 19:42 ` [PATCH 5/5] malloc: Remove memusage.h Adhemerval Zanella
  2021-12-16 21:41 ` [PATCH 0/5] Architecture code cleanup Joseph Myers
  5 siblings, 0 replies; 12+ messages in thread
From: Adhemerval Zanella @ 2021-12-16 19:42 UTC (permalink / raw)
  To: libc-alpha, Stafford Horne

Instead of reimplemeting on GETTIME macro.
---
 malloc/memusage.c            | 15 ++++++++++++---
 sysdeps/generic/memusage.h   | 12 ------------
 sysdeps/i386/i686/memusage.h |  1 -
 sysdeps/ia64/memusage.h      |  7 -------
 sysdeps/x86_64/memusage.h    |  1 -
 5 files changed, 12 insertions(+), 24 deletions(-)

diff --git a/malloc/memusage.c b/malloc/memusage.c
index d287a7aa82..fb4e754e09 100644
--- a/malloc/memusage.c
+++ b/malloc/memusage.c
@@ -35,6 +35,7 @@
 #include <stdatomic.h>
 
 #include <memusage.h>
+#include <hp-timing.h>
 
 /* Pointer to the real functions.  These are determined used `dlsym'
    when really needed.  */
@@ -115,6 +116,14 @@ static struct entry buffer[2 * DEFAULT_BUFFER_SIZE];
 static _Atomic uint32_t buffer_cnt;
 static struct entry first;
 
+static void
+gettime (struct entry *e)
+{
+  hp_timing_t now;
+  HP_TIMING_NOW (now);
+  e->time_low = now & 0xffffffff;
+  e->time_high = now >> 32;
+}
 
 /* Update the global data after a successful function call.  */
 static void
@@ -178,7 +187,7 @@ update_data (struct header *result, size_t len, size_t old_len)
 
       buffer[idx].heap = current_heap;
       buffer[idx].stack = current_stack;
-      GETTIME (buffer[idx].time_low, buffer[idx].time_high);
+      gettime (&buffer[idx]);
 
       /* Write out buffer if it is full.  */
       if (idx + 1 == buffer_size)
@@ -268,7 +277,7 @@ me (void)
               /* Write the first entry.  */
               first.heap = 0;
               first.stack = 0;
-              GETTIME (first.time_low, first.time_high);
+              gettime (&first);
               /* Write it two times since we need the starting and end time. */
               write (fd, &first, sizeof (first));
               write (fd, &first, sizeof (first));
@@ -819,7 +828,7 @@ dest (void)
          stack.  */
       first.heap = peak_heap;
       first.stack = peak_stack;
-      GETTIME (first.time_low, first.time_high);
+      gettime (&first);
       write (fd, &first, sizeof (struct entry));
 
       /* Close the file.  */
diff --git a/sysdeps/generic/memusage.h b/sysdeps/generic/memusage.h
index c9bde5cd11..514bd058d2 100644
--- a/sysdeps/generic/memusage.h
+++ b/sysdeps/generic/memusage.h
@@ -23,15 +23,3 @@
 # warning "GETSP is not defined for this architecture."
 # define GETSP 0
 #endif
-
-#ifndef GETTIME
-# define GETTIME(low,high)						   \
-  {									   \
-    struct __timespec64 now;						   \
-    uint64_t usecs;							   \
-    __clock_gettime64 (CLOCK_REALTIME, &now);				   \
-    usecs = (uint64_t)now.tv_nsec / 1000 + (uint64_t)now.tv_sec * 1000000; \
-    low = usecs & 0xffffffff;						   \
-    high = usecs >> 32;							   \
-  }
-#endif
diff --git a/sysdeps/i386/i686/memusage.h b/sysdeps/i386/i686/memusage.h
index 08b7831e12..07b241263c 100644
--- a/sysdeps/i386/i686/memusage.h
+++ b/sysdeps/i386/i686/memusage.h
@@ -16,6 +16,5 @@
    <https://www.gnu.org/licenses/>.  */
 
 #define GETSP() ({ register uintptr_t stack_ptr asm ("esp"); stack_ptr; })
-#define GETTIME(low,high) asm ("rdtsc" : "=a" (low), "=d" (high))
 
 #include <sysdeps/generic/memusage.h>
diff --git a/sysdeps/ia64/memusage.h b/sysdeps/ia64/memusage.h
index 3c3a526007..33fd6ec899 100644
--- a/sysdeps/ia64/memusage.h
+++ b/sysdeps/ia64/memusage.h
@@ -18,12 +18,5 @@
 #include <hp-timing.h>
 
 #define GETSP() ({ register uintptr_t stack_ptr asm ("%r12"); stack_ptr; })
-#define GETTIME(low, high) \
-  {									      \
-    hp_timing_t __now;							      \
-    HP_TIMING_NOW (__now);						      \
-    low = __now & 0xffffffff;						      \
-    high = __now >> 32;							      \
-  }
 
 #include <sysdeps/generic/memusage.h>
diff --git a/sysdeps/x86_64/memusage.h b/sysdeps/x86_64/memusage.h
index 568dd5512d..6652fc5da1 100644
--- a/sysdeps/x86_64/memusage.h
+++ b/sysdeps/x86_64/memusage.h
@@ -16,6 +16,5 @@
    <https://www.gnu.org/licenses/>.  */
 
 #define GETSP() ({ register uintptr_t stack_ptr asm ("rsp"); stack_ptr; })
-#define GETTIME(low,high) asm ("rdtsc" : "=a" (low), "=d" (high))
 
 #include <sysdeps/generic/memusage.h>
-- 
2.32.0


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 5/5] malloc: Remove memusage.h
  2021-12-16 19:42 [PATCH 0/5] Architecture code cleanup Adhemerval Zanella
                   ` (3 preceding siblings ...)
  2021-12-16 19:42 ` [PATCH 4/5] malloc: Use hp-timing on libmemusage Adhemerval Zanella
@ 2021-12-16 19:42 ` Adhemerval Zanella
  2021-12-16 21:41 ` [PATCH 0/5] Architecture code cleanup Joseph Myers
  5 siblings, 0 replies; 12+ messages in thread
From: Adhemerval Zanella @ 2021-12-16 19:42 UTC (permalink / raw)
  To: libc-alpha, Stafford Horne

And use machine-sp.h instead.  The Linux implementation is based on
already provided CURRENT_STACK_FRAME (used on nptl code) and
STACK_GROWS_UPWARD is replaced with _STACK_GROWS_UP.
---
 malloc/memusage.c                             | 13 ++++++-----
 sysdeps/aarch64/memusage.h                    | 21 ------------------
 sysdeps/alpha/memusage.h                      | 20 -----------------
 sysdeps/arc/memusage.h                        | 21 ------------------
 sysdeps/arm/memusage.h                        | 20 -----------------
 sysdeps/csky/memusage.h                       | 21 ------------------
 sysdeps/hppa/memusage.h                       | 21 ------------------
 sysdeps/i386/htl/machine-sp.h                 |  2 +-
 sysdeps/i386/i586/memusage.h                  |  1 -
 sysdeps/i386/i686/memusage.h                  | 20 -----------------
 sysdeps/i386/memusage.h                       | 20 -----------------
 sysdeps/ia64/memusage.h                       | 22 -------------------
 sysdeps/m68k/memusage.h                       | 21 ------------------
 sysdeps/mach/hurd/i386/tls.h                  |  1 -
 sysdeps/mach/i386/machine-sp.h                |  2 +-
 sysdeps/microblaze/memusage.h                 | 21 ------------------
 sysdeps/mips/memusage.h                       | 20 -----------------
 sysdeps/nios2/memusage.h                      | 21 ------------------
 sysdeps/powerpc/memusage.h                    | 20 -----------------
 sysdeps/riscv/memusage.h                      | 21 ------------------
 sysdeps/s390/memusage.h                       | 20 -----------------
 sysdeps/sh/memusage.h                         | 20 -----------------
 sysdeps/sparc/memusage.h                      | 20 -----------------
 .../sysv/linux/machine-sp.h}                  | 18 +++++++++------
 sysdeps/x86_64/memusage.h                     | 20 -----------------
 25 files changed, 20 insertions(+), 407 deletions(-)
 delete mode 100644 sysdeps/aarch64/memusage.h
 delete mode 100644 sysdeps/alpha/memusage.h
 delete mode 100644 sysdeps/arc/memusage.h
 delete mode 100644 sysdeps/arm/memusage.h
 delete mode 100644 sysdeps/csky/memusage.h
 delete mode 100644 sysdeps/hppa/memusage.h
 delete mode 100644 sysdeps/i386/i586/memusage.h
 delete mode 100644 sysdeps/i386/i686/memusage.h
 delete mode 100644 sysdeps/i386/memusage.h
 delete mode 100644 sysdeps/ia64/memusage.h
 delete mode 100644 sysdeps/m68k/memusage.h
 delete mode 100644 sysdeps/microblaze/memusage.h
 delete mode 100644 sysdeps/mips/memusage.h
 delete mode 100644 sysdeps/nios2/memusage.h
 delete mode 100644 sysdeps/powerpc/memusage.h
 delete mode 100644 sysdeps/riscv/memusage.h
 delete mode 100644 sysdeps/s390/memusage.h
 delete mode 100644 sysdeps/sh/memusage.h
 delete mode 100644 sysdeps/sparc/memusage.h
 rename sysdeps/{generic/memusage.h => unix/sysv/linux/machine-sp.h} (68%)
 delete mode 100644 sysdeps/x86_64/memusage.h

diff --git a/malloc/memusage.c b/malloc/memusage.c
index fb4e754e09..383ad51848 100644
--- a/malloc/memusage.c
+++ b/malloc/memusage.c
@@ -34,8 +34,9 @@
 #include <sys/time.h>
 #include <stdatomic.h>
 
-#include <memusage.h>
 #include <hp-timing.h>
+#include <machine-sp.h>
+#include <stackinfo.h>  /* For _STACK_GROWS_UP  */
 
 /* Pointer to the real functions.  These are determined used `dlsym'
    when really needed.  */
@@ -147,10 +148,10 @@ update_data (struct header *result, size_t len, size_t old_len)
      the main thread and it is the first call to any of these
      functions.  */
   if (__glibc_unlikely (!start_sp))
-    start_sp = GETSP ();
+    start_sp = __thread_stack_pointer ();
 
-  uintptr_t sp = GETSP ();
-#ifdef STACK_GROWS_UPWARD
+  uintptr_t sp = __thread_stack_pointer ();
+#ifdef _STACK_GROWS_UP
   /* This can happen in threads where we didn't catch the thread's
      stack early enough.  */
   if (__glibc_unlikely (sp < start_sp))
@@ -260,7 +261,7 @@ me (void)
       const char *outname;
 
       if (!start_sp)
-        start_sp = GETSP ();
+        start_sp = __thread_stack_pointer ();
 
       outname = getenv ("MEMUSAGE_OUTPUT");
       if (outname != NULL && outname[0] != '\0'
@@ -326,7 +327,7 @@ static void
 __attribute__ ((constructor))
 init (void)
 {
-  start_sp = GETSP ();
+  start_sp = __thread_stack_pointer ();
   if (!initialized)
     me ();
 }
diff --git a/sysdeps/aarch64/memusage.h b/sysdeps/aarch64/memusage.h
deleted file mode 100644
index d29f7c7f89..0000000000
--- a/sysdeps/aarch64/memusage.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Copyright (C) 2000-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/>.  */
-
-#define GETSP() ({ register uintptr_t stack_ptr asm ("sp"); stack_ptr; })
-
-#include <sysdeps/generic/memusage.h>
diff --git a/sysdeps/alpha/memusage.h b/sysdeps/alpha/memusage.h
deleted file mode 100644
index bbd28302e4..0000000000
--- a/sysdeps/alpha/memusage.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright (C) 2000-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/>.  */
-
-#define GETSP() ({ register uintptr_t stack_ptr asm ("$30"); stack_ptr; })
-
-#include <sysdeps/generic/memusage.h>
diff --git a/sysdeps/arc/memusage.h b/sysdeps/arc/memusage.h
deleted file mode 100644
index e8a508a8ff..0000000000
--- a/sysdeps/arc/memusage.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Machine-specific definitions for memory usage profiling, ARC version.
-   Copyright (C) 2020-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/>.  */
-
-#define GETSP() ({ register uintptr_t stack_ptr asm ("sp"); stack_ptr; })
-
-#include <sysdeps/generic/memusage.h>
diff --git a/sysdeps/arm/memusage.h b/sysdeps/arm/memusage.h
deleted file mode 100644
index 2ec8de22a5..0000000000
--- a/sysdeps/arm/memusage.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright (C) 2000-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/>.  */
-
-#define GETSP() ({ register uintptr_t stack_ptr asm ("sp"); stack_ptr; })
-
-#include <sysdeps/generic/memusage.h>
diff --git a/sysdeps/csky/memusage.h b/sysdeps/csky/memusage.h
deleted file mode 100644
index 392682e12b..0000000000
--- a/sysdeps/csky/memusage.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Machine-specific definitions for memory usage profiling, C-SKY version.
-   Copyright (C) 2018-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/>.  */
-
-#define GETSP() ({ register uintptr_t stack_ptr asm ("sp"); stack_ptr; })
-
-#include <sysdeps/generic/memusage.h>
diff --git a/sysdeps/hppa/memusage.h b/sysdeps/hppa/memusage.h
deleted file mode 100644
index 25e8b94b3f..0000000000
--- a/sysdeps/hppa/memusage.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Copyright (C) 2000-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/>.  */
-
-#define GETSP() ({ register uintptr_t stack_ptr asm ("%r30"); stack_ptr; })
-#define STACK_GROWS_UPWARD 1
-
-#include <sysdeps/generic/memusage.h>
diff --git a/sysdeps/i386/htl/machine-sp.h b/sysdeps/i386/htl/machine-sp.h
index 6b64dea385..812223d783 100644
--- a/sysdeps/i386/htl/machine-sp.h
+++ b/sysdeps/i386/htl/machine-sp.h
@@ -22,7 +22,7 @@
 /* Return the current stack pointer.  */
 
 #define __thread_stack_pointer() ({					      \
-  register void *__sp__ asm("esp");					      \
+  register uintptr_t __sp__ asm("esp");					      \
   __sp__;								      \
 })
 
diff --git a/sysdeps/i386/i586/memusage.h b/sysdeps/i386/i586/memusage.h
deleted file mode 100644
index c8170874d0..0000000000
--- a/sysdeps/i386/i586/memusage.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../i686/memusage.h"
diff --git a/sysdeps/i386/i686/memusage.h b/sysdeps/i386/i686/memusage.h
deleted file mode 100644
index 07b241263c..0000000000
--- a/sysdeps/i386/i686/memusage.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright (C) 2000-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/>.  */
-
-#define GETSP() ({ register uintptr_t stack_ptr asm ("esp"); stack_ptr; })
-
-#include <sysdeps/generic/memusage.h>
diff --git a/sysdeps/i386/memusage.h b/sysdeps/i386/memusage.h
deleted file mode 100644
index 07b241263c..0000000000
--- a/sysdeps/i386/memusage.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright (C) 2000-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/>.  */
-
-#define GETSP() ({ register uintptr_t stack_ptr asm ("esp"); stack_ptr; })
-
-#include <sysdeps/generic/memusage.h>
diff --git a/sysdeps/ia64/memusage.h b/sysdeps/ia64/memusage.h
deleted file mode 100644
index 33fd6ec899..0000000000
--- a/sysdeps/ia64/memusage.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Copyright (C) 2000-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/>.  */
-
-#include <hp-timing.h>
-
-#define GETSP() ({ register uintptr_t stack_ptr asm ("%r12"); stack_ptr; })
-
-#include <sysdeps/generic/memusage.h>
diff --git a/sysdeps/m68k/memusage.h b/sysdeps/m68k/memusage.h
deleted file mode 100644
index c22d312aed..0000000000
--- a/sysdeps/m68k/memusage.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Copyright (C) 2000-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/>.  */
-
-
-#define GETSP() ({ register uintptr_t stack_ptr asm ("%sp"); stack_ptr; })
-
-#include <sysdeps/generic/memusage.h>
diff --git a/sysdeps/mach/hurd/i386/tls.h b/sysdeps/mach/hurd/i386/tls.h
index c70ea73a81..c03d64c4d9 100644
--- a/sysdeps/mach/hurd/i386/tls.h
+++ b/sysdeps/mach/hurd/i386/tls.h
@@ -295,7 +295,6 @@ out:
      asm ("movl %%gs:%P1,%0" : "=q" (_dtv) : "i" (offsetof (tcbhead_t, dtv)));\
      _dtv; })
 
-
 /* Set the stack guard field in TCB head.  */
 #define THREAD_SET_STACK_GUARD(value) \
   THREAD_SETMEM (THREAD_SELF, stack_guard, value)
diff --git a/sysdeps/mach/i386/machine-sp.h b/sysdeps/mach/i386/machine-sp.h
index 280f3b7a4d..54b2a16c01 100644
--- a/sysdeps/mach/i386/machine-sp.h
+++ b/sysdeps/mach/i386/machine-sp.h
@@ -22,7 +22,7 @@
 /* Return the current stack pointer.  */
 
 #define __thread_stack_pointer() ({					      \
-  void *__sp__;								      \
+  uintptr_t __sp__;							      \
   __asm__ ("movl %%esp, %0" : "=r" (__sp__));				      \
   __sp__;								      \
 })
diff --git a/sysdeps/microblaze/memusage.h b/sysdeps/microblaze/memusage.h
deleted file mode 100644
index 516c0b4609..0000000000
--- a/sysdeps/microblaze/memusage.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Copyright (C) 2000-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/>.  */
-
-#define GETSP() ({ register uintptr_t stack_ptr asm ("r1"); stack_ptr; })
-
-#include <sysdeps/generic/memusage.h>
diff --git a/sysdeps/mips/memusage.h b/sysdeps/mips/memusage.h
deleted file mode 100644
index 64c558c81d..0000000000
--- a/sysdeps/mips/memusage.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright (C) 2000-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/>.  */
-
-#define GETSP() ({ register uintptr_t stack_ptr asm ("$29"); stack_ptr; })
-
-#include <sysdeps/generic/memusage.h>
diff --git a/sysdeps/nios2/memusage.h b/sysdeps/nios2/memusage.h
deleted file mode 100644
index 6f1c78812d..0000000000
--- a/sysdeps/nios2/memusage.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Machine-specific definitions for memory usage profiling, Nios II version.
-   Copyright (C) 2000-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/>.  */
-
-#define GETSP() ({ register uintptr_t stack_ptr asm ("%sp"); stack_ptr; })
-
-#include <sysdeps/generic/memusage.h>
diff --git a/sysdeps/powerpc/memusage.h b/sysdeps/powerpc/memusage.h
deleted file mode 100644
index ab21f46258..0000000000
--- a/sysdeps/powerpc/memusage.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright (C) 2000-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/>.  */
-
-#define GETSP() ({ register uintptr_t stack_ptr asm ("%r1"); stack_ptr; })
-
-#include <sysdeps/generic/memusage.h>
diff --git a/sysdeps/riscv/memusage.h b/sysdeps/riscv/memusage.h
deleted file mode 100644
index b7b45791b9..0000000000
--- a/sysdeps/riscv/memusage.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Machine-specific definitions for memory usage profiling, RISC-V version.
-   Copyright (C) 2000-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/>.  */
-
-#define GETSP() ({ register uintptr_t stack_ptr asm ("sp"); stack_ptr; })
-
-#include <sysdeps/generic/memusage.h>
diff --git a/sysdeps/s390/memusage.h b/sysdeps/s390/memusage.h
deleted file mode 100644
index 6219d79664..0000000000
--- a/sysdeps/s390/memusage.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright (C) 2000-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/>.  */
-
-#define GETSP() ({ register uintptr_t stack_ptr __asm__ ("15"); stack_ptr; })
-
-#include <sysdeps/generic/memusage.h>
diff --git a/sysdeps/sh/memusage.h b/sysdeps/sh/memusage.h
deleted file mode 100644
index 87c3d40fdf..0000000000
--- a/sysdeps/sh/memusage.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright (C) 2000-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/>.  */
-
-#define GETSP() ({ register uintptr_t stack_ptr asm ("r15"); stack_ptr; })
-
-#include <sysdeps/generic/memusage.h>
diff --git a/sysdeps/sparc/memusage.h b/sysdeps/sparc/memusage.h
deleted file mode 100644
index 13741e2577..0000000000
--- a/sysdeps/sparc/memusage.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright (C) 2000-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/>.  */
-
-#define GETSP() ({ register uintptr_t stack_ptr asm ("%sp"); stack_ptr; })
-
-#include <sysdeps/generic/memusage.h>
diff --git a/sysdeps/generic/memusage.h b/sysdeps/unix/sysv/linux/machine-sp.h
similarity index 68%
rename from sysdeps/generic/memusage.h
rename to sysdeps/unix/sysv/linux/machine-sp.h
index 514bd058d2..257d09e60d 100644
--- a/sysdeps/generic/memusage.h
+++ b/sysdeps/unix/sysv/linux/machine-sp.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 2000-2021 Free Software Foundation, Inc.
+/* Machine-specific function to return the stack pointer.  Linux version.
+   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
@@ -15,11 +16,14 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
+#ifndef _MACHINE_SP_H
+#define _MACHINE_SP_H
 
-#include <limits.h>
-#include <stdint.h>
+/* Return the current stack pointer.  */
+static inline uintptr_t
+__thread_stack_pointer (void)
+{
+  return (uintptr_t) CURRENT_STACK_FRAME;
+}
 
-#ifndef GETSP
-# warning "GETSP is not defined for this architecture."
-# define GETSP 0
-#endif
+#endif	/* machine-sp.h */
diff --git a/sysdeps/x86_64/memusage.h b/sysdeps/x86_64/memusage.h
deleted file mode 100644
index 6652fc5da1..0000000000
--- a/sysdeps/x86_64/memusage.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright (C) 2001-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/>.  */
-
-#define GETSP() ({ register uintptr_t stack_ptr asm ("rsp"); stack_ptr; })
-
-#include <sysdeps/generic/memusage.h>
-- 
2.32.0


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/5] Architecture code cleanup
  2021-12-16 19:42 [PATCH 0/5] Architecture code cleanup Adhemerval Zanella
                   ` (4 preceding siblings ...)
  2021-12-16 19:42 ` [PATCH 5/5] malloc: Remove memusage.h Adhemerval Zanella
@ 2021-12-16 21:41 ` Joseph Myers
  2021-12-16 23:08   ` Adhemerval Zanella
  5 siblings, 1 reply; 12+ messages in thread
From: Joseph Myers @ 2021-12-16 21:41 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: libc-alpha, Stafford Horne

On Thu, 16 Dec 2021, Adhemerval Zanella via Libc-alpha wrote:

> The libmemusage requires duplicate definition and adds a lot of
> boilerplate code: its internal atomics can be replaces by
> C11 atomics, which allows remove a lof of atomic-machine.h
> internal types; the internal time can be replaced with hp-timing.h,
> and for stack pointer information we can use either the
> __thread_stack_pointer (hurd) or CURRENT_STACK_FRAME (Linux).

Has this patch series been tested with build-many-glibcs.py?  (I'm 
concerned with making sure the atomics aren't introducing any circular 
dependencies on libatomic - that they're expanded entirely inline or to 
use libgcc operations.)

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/5] Architecture code cleanup
  2021-12-16 21:41 ` [PATCH 0/5] Architecture code cleanup Joseph Myers
@ 2021-12-16 23:08   ` Adhemerval Zanella
  2021-12-16 23:35     ` Adhemerval Zanella
  0 siblings, 1 reply; 12+ messages in thread
From: Adhemerval Zanella @ 2021-12-16 23:08 UTC (permalink / raw)
  To: Joseph Myers; +Cc: libc-alpha, Stafford Horne



On 16/12/2021 18:41, Joseph Myers wrote:
> On Thu, 16 Dec 2021, Adhemerval Zanella via Libc-alpha wrote:
> 
>> The libmemusage requires duplicate definition and adds a lot of
>> boilerplate code: its internal atomics can be replaces by
>> C11 atomics, which allows remove a lof of atomic-machine.h
>> internal types; the internal time can be replaced with hp-timing.h,
>> and for stack pointer information we can use either the
>> __thread_stack_pointer (hurd) or CURRENT_STACK_FRAME (Linux).
> 
> Has this patch series been tested with build-many-glibcs.py?  (I'm 
> concerned with making sure the atomics aren't introducing any circular 
> dependencies on libatomic - that they're expanded entirely inline or to 
> use libgcc operations.)
> 

The C11 usage is for the types, memusage.c still uses catomic_* functions
(which it is not optimal).  My plan is to clean this up later patch.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/5] Architecture code cleanup
  2021-12-16 23:08   ` Adhemerval Zanella
@ 2021-12-16 23:35     ` Adhemerval Zanella
  2021-12-17 11:10       ` Adhemerval Zanella
  0 siblings, 1 reply; 12+ messages in thread
From: Adhemerval Zanella @ 2021-12-16 23:35 UTC (permalink / raw)
  To: Joseph Myers; +Cc: libc-alpha, Stafford Horne



On 16/12/2021 20:08, Adhemerval Zanella wrote:
> 
> 
> On 16/12/2021 18:41, Joseph Myers wrote:
>> On Thu, 16 Dec 2021, Adhemerval Zanella via Libc-alpha wrote:
>>
>>> The libmemusage requires duplicate definition and adds a lot of
>>> boilerplate code: its internal atomics can be replaces by
>>> C11 atomics, which allows remove a lof of atomic-machine.h
>>> internal types; the internal time can be replaced with hp-timing.h,
>>> and for stack pointer information we can use either the
>>> __thread_stack_pointer (hurd) or CURRENT_STACK_FRAME (Linux).
>>
>> Has this patch series been tested with build-many-glibcs.py?  (I'm 
>> concerned with making sure the atomics aren't introducing any circular 
>> dependencies on libatomic - that they're expanded entirely inline or to 
>> use libgcc operations.)
>>
> 
> The C11 usage is for the types, memusage.c still uses catomic_* functions
> (which it is not optimal).  My plan is to clean this up later patch.

Scratch that, I just realized that did use _Atomic. I will check with
build-many-glibcs.py.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/5] Architecture code cleanup
  2021-12-16 23:35     ` Adhemerval Zanella
@ 2021-12-17 11:10       ` Adhemerval Zanella
  0 siblings, 0 replies; 12+ messages in thread
From: Adhemerval Zanella @ 2021-12-17 11:10 UTC (permalink / raw)
  To: Joseph Myers; +Cc: libc-alpha, Stafford Horne



On 16/12/2021 20:35, Adhemerval Zanella wrote:
> 
> 
> On 16/12/2021 20:08, Adhemerval Zanella wrote:
>>
>>
>> On 16/12/2021 18:41, Joseph Myers wrote:
>>> On Thu, 16 Dec 2021, Adhemerval Zanella via Libc-alpha wrote:
>>>
>>>> The libmemusage requires duplicate definition and adds a lot of
>>>> boilerplate code: its internal atomics can be replaces by
>>>> C11 atomics, which allows remove a lof of atomic-machine.h
>>>> internal types; the internal time can be replaced with hp-timing.h,
>>>> and for stack pointer information we can use either the
>>>> __thread_stack_pointer (hurd) or CURRENT_STACK_FRAME (Linux).
>>>
>>> Has this patch series been tested with build-many-glibcs.py?  (I'm 
>>> concerned with making sure the atomics aren't introducing any circular 
>>> dependencies on libatomic - that they're expanded entirely inline or to 
>>> use libgcc operations.)
>>>
>>
>> The C11 usage is for the types, memusage.c still uses catomic_* functions
>> (which it is not optimal).  My plan is to clean this up later patch.
> 
> Scratch that, I just realized that did use _Atomic. I will check with
> build-many-glibcs.py.

It does pass on handful of architecture that might use libatomic, but thinking
again it does seems the best strategy to use C11 atomics while issuing glibc
handcrafted atomic functions/macros.  I will just replace with plain [u]intXX_t
types, since it is what we usually do in other places.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/5] Remove ununsed tcb-offset
  2021-12-16 19:42 ` [PATCH 1/5] Remove ununsed tcb-offset Adhemerval Zanella
@ 2021-12-17 19:26   ` Adhemerval Zanella
  2021-12-17 23:25     ` Stafford Horne
  0 siblings, 1 reply; 12+ messages in thread
From: Adhemerval Zanella @ 2021-12-17 19:26 UTC (permalink / raw)
  To: libc-alpha, Stafford Horne

I will commit this shortly if noone opposes it.

On 16/12/2021 16:42, Adhemerval Zanella wrote:
> Some architectures do not use the auto-generated tcb-offsets.h.
> ---
>  sysdeps/aarch64/nptl/Makefile           | 21 ---------------------
>  sysdeps/aarch64/nptl/tcb-offsets.sym    |  6 ------
>  sysdeps/aarch64/nptl/tls.h              |  3 ---
>  sysdeps/alpha/nptl/Makefile             | 20 --------------------
>  sysdeps/alpha/nptl/tcb-offsets.sym      | 13 -------------
>  sysdeps/alpha/nptl/tls.h                |  2 --
>  sysdeps/arc/nptl/Makefile               | 22 ----------------------
>  sysdeps/arc/nptl/tcb-offsets.sym        | 11 -----------
>  sysdeps/arm/nptl/Makefile               |  4 ----
>  sysdeps/arm/nptl/tcb-offsets.sym        | 10 ----------
>  sysdeps/arm/nptl/tls.h                  |  3 ---
>  sysdeps/csky/Makefile                   |  4 ----
>  sysdeps/csky/nptl/Makefile              | 20 --------------------
>  sysdeps/csky/nptl/tcb-offsets.sym       | 10 ----------
>  sysdeps/csky/nptl/tls.h                 |  1 -
>  sysdeps/hppa/nptl/Makefile              | 20 --------------------
>  sysdeps/hppa/nptl/tcb-offsets.sym       | 17 -----------------
>  sysdeps/hppa/nptl/tls.h                 |  3 ---
>  sysdeps/m68k/nptl/Makefile              | 20 --------------------
>  sysdeps/m68k/nptl/tcb-offsets.sym       | 10 ----------
>  sysdeps/m68k/nptl/tls.h                 |  3 ---
>  sysdeps/microblaze/nptl/Makefile        | 21 ---------------------
>  sysdeps/microblaze/nptl/tcb-offsets.sym | 10 ----------
>  sysdeps/microblaze/nptl/tls.h           |  3 ---
>  sysdeps/mips/nptl/Makefile              | 20 --------------------
>  sysdeps/mips/nptl/tcb-offsets.sym       | 10 ----------
>  sysdeps/mips/nptl/tls.h                 |  2 --
>  sysdeps/nios2/Makefile                  |  4 ----
>  sysdeps/riscv/nptl/Makefile             | 21 ---------------------
>  sysdeps/riscv/nptl/tcb-offsets.sym      |  6 ------
>  30 files changed, 320 deletions(-)
>  delete mode 100644 sysdeps/aarch64/nptl/Makefile
>  delete mode 100644 sysdeps/aarch64/nptl/tcb-offsets.sym
>  delete mode 100644 sysdeps/alpha/nptl/Makefile
>  delete mode 100644 sysdeps/alpha/nptl/tcb-offsets.sym
>  delete mode 100644 sysdeps/arc/nptl/Makefile
>  delete mode 100644 sysdeps/arc/nptl/tcb-offsets.sym
>  delete mode 100644 sysdeps/arm/nptl/tcb-offsets.sym
>  delete mode 100644 sysdeps/csky/nptl/Makefile
>  delete mode 100644 sysdeps/csky/nptl/tcb-offsets.sym
>  delete mode 100644 sysdeps/hppa/nptl/Makefile
>  delete mode 100644 sysdeps/hppa/nptl/tcb-offsets.sym
>  delete mode 100644 sysdeps/m68k/nptl/Makefile
>  delete mode 100644 sysdeps/m68k/nptl/tcb-offsets.sym
>  delete mode 100644 sysdeps/microblaze/nptl/Makefile
>  delete mode 100644 sysdeps/microblaze/nptl/tcb-offsets.sym
>  delete mode 100644 sysdeps/mips/nptl/Makefile
>  delete mode 100644 sysdeps/mips/nptl/tcb-offsets.sym
>  delete mode 100644 sysdeps/riscv/nptl/Makefile
>  delete mode 100644 sysdeps/riscv/nptl/tcb-offsets.sym
> 
> diff --git a/sysdeps/aarch64/nptl/Makefile b/sysdeps/aarch64/nptl/Makefile
> deleted file mode 100644
> index 6d23959e30..0000000000
> --- a/sysdeps/aarch64/nptl/Makefile
> +++ /dev/null
> @@ -1,21 +0,0 @@
> -# Copyright (C) 2005-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/>.
> -
> -ifeq ($(subdir),csu)
> -gen-as-const-headers += tcb-offsets.sym
> -endif
> diff --git a/sysdeps/aarch64/nptl/tcb-offsets.sym b/sysdeps/aarch64/nptl/tcb-offsets.sym
> deleted file mode 100644
> index 238647dd47..0000000000
> --- a/sysdeps/aarch64/nptl/tcb-offsets.sym
> +++ /dev/null
> @@ -1,6 +0,0 @@
> -#include <sysdep.h>
> -#include <tls.h>
> -
> -PTHREAD_MULTIPLE_THREADS_OFFSET		offsetof (struct pthread, header.multiple_threads)
> -PTHREAD_TID_OFFSET			offsetof (struct pthread, tid)
> -PTHREAD_SIZEOF				sizeof (struct pthread)
> diff --git a/sysdeps/aarch64/nptl/tls.h b/sysdeps/aarch64/nptl/tls.h
> index 860776bb4b..84916f36b7 100644
> --- a/sysdeps/aarch64/nptl/tls.h
> +++ b/sysdeps/aarch64/nptl/tls.h
> @@ -26,9 +26,6 @@
>  # include <stddef.h>
>  # include <stdint.h>
>  # include <dl-dtv.h>
> -
> -#else /* __ASSEMBLER__ */
> -# include <tcb-offsets.h>
>  #endif /* __ASSEMBLER__ */
>  
>  #ifndef __ASSEMBLER__
> diff --git a/sysdeps/alpha/nptl/Makefile b/sysdeps/alpha/nptl/Makefile
> deleted file mode 100644
> index fc5567ee55..0000000000
> --- a/sysdeps/alpha/nptl/Makefile
> +++ /dev/null
> @@ -1,20 +0,0 @@
> -# Copyright (C) 2003-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/>.
> -
> -ifeq ($(subdir),csu)
> -gen-as-const-headers += tcb-offsets.sym
> -endif
> diff --git a/sysdeps/alpha/nptl/tcb-offsets.sym b/sysdeps/alpha/nptl/tcb-offsets.sym
> deleted file mode 100644
> index 1005621b37..0000000000
> --- a/sysdeps/alpha/nptl/tcb-offsets.sym
> +++ /dev/null
> @@ -1,13 +0,0 @@
> -#include <sysdep.h>
> -#include <tls.h>
> -
> ---
> -
> --- Abuse tls.h macros to derive offsets relative to the thread register.
> --- # define __builtin_thread_pointer()  ((void *) 0)
> --- # define thread_offsetof(mem)     ((void *) &THREAD_SELF->mem - (void *) 0)
> --- Ho hum, this doesn't work in gcc4, so Know Things about THREAD_SELF
> -#define thread_offsetof(mem)	(long)(offsetof(struct pthread, mem) - sizeof(struct pthread))
> -
> -MULTIPLE_THREADS_OFFSET		thread_offsetof (header.multiple_threads)
> -TID_OFFSET			thread_offsetof (tid)
> diff --git a/sysdeps/alpha/nptl/tls.h b/sysdeps/alpha/nptl/tls.h
> index 860cc46d88..c260078c86 100644
> --- a/sysdeps/alpha/nptl/tls.h
> +++ b/sysdeps/alpha/nptl/tls.h
> @@ -109,8 +109,6 @@ typedef struct
>      }									     \
>    while (0)
>  
> -#else /* __ASSEMBLER__ */
> -# include <tcb-offsets.h>
>  #endif /* __ASSEMBLER__ */
>  
>  #endif	/* tls.h */
> diff --git a/sysdeps/arc/nptl/Makefile b/sysdeps/arc/nptl/Makefile
> deleted file mode 100644
> index d85b47416a..0000000000
> --- a/sysdeps/arc/nptl/Makefile
> +++ /dev/null
> @@ -1,22 +0,0 @@
> -# NPTL makefile fragment for ARC.
> -# Copyright (C) 2020-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/>.
> -
> -ifeq ($(subdir),csu)
> -gen-as-const-headers += tcb-offsets.sym
> -endif
> diff --git a/sysdeps/arc/nptl/tcb-offsets.sym b/sysdeps/arc/nptl/tcb-offsets.sym
> deleted file mode 100644
> index 64c432c22e..0000000000
> --- a/sysdeps/arc/nptl/tcb-offsets.sym
> +++ /dev/null
> @@ -1,11 +0,0 @@
> -#include <sysdep.h>
> -#include <tls.h>
> -
> --- Derive offsets relative to the thread register.
> -#define thread_offsetof(mem)	(long)(offsetof (struct pthread, mem) - sizeof (struct pthread))
> -
> -MULTIPLE_THREADS_OFFSET		offsetof (struct pthread, header.multiple_threads)
> -TLS_PRE_TCB_SIZE		sizeof (struct pthread)
> -TLS_TCB_SIZE            	sizeof (tcbhead_t)
> -
> -PTHREAD_TID			offsetof (struct pthread, tid)
> diff --git a/sysdeps/arm/nptl/Makefile b/sysdeps/arm/nptl/Makefile
> index 44154bff37..2e8efe7170 100644
> --- a/sysdeps/arm/nptl/Makefile
> +++ b/sysdeps/arm/nptl/Makefile
> @@ -15,10 +15,6 @@
>  # License along with the GNU C Library.  If not, see
>  # <https://www.gnu.org/licenses/>.
>  
> -ifeq ($(subdir),csu)
> -gen-as-const-headers += tcb-offsets.sym
> -endif
> -
>  ifeq ($(subdir),nptl)
>  # This test relies on compiling part of the binary with EH information,
>  # part without, and unwinding through.  The .ARM.exidx tables have
> diff --git a/sysdeps/arm/nptl/tcb-offsets.sym b/sysdeps/arm/nptl/tcb-offsets.sym
> deleted file mode 100644
> index bf9c0a1c17..0000000000
> --- a/sysdeps/arm/nptl/tcb-offsets.sym
> +++ /dev/null
> @@ -1,10 +0,0 @@
> -#include <sysdep.h>
> -#include <tls.h>
> -
> ---
> -
> --- Derive offsets relative to the thread register.
> -#define thread_offsetof(mem)	(long)(offsetof(struct pthread, mem) - sizeof(struct pthread))
> -
> -MULTIPLE_THREADS_OFFSET		thread_offsetof (header.multiple_threads)
> -TID_OFFSET			thread_offsetof (tid)
> diff --git a/sysdeps/arm/nptl/tls.h b/sysdeps/arm/nptl/tls.h
> index 57e039fc0f..9662da39ab 100644
> --- a/sysdeps/arm/nptl/tls.h
> +++ b/sysdeps/arm/nptl/tls.h
> @@ -26,9 +26,6 @@
>  # include <stddef.h>
>  # include <stdint.h>
>  # include <dl-dtv.h>
> -
> -#else /* __ASSEMBLER__ */
> -# include <tcb-offsets.h>
>  #endif /* __ASSEMBLER__ */
>  
>  
> diff --git a/sysdeps/csky/Makefile b/sysdeps/csky/Makefile
> index 0db09dccce..1ced510c2d 100644
> --- a/sysdeps/csky/Makefile
> +++ b/sysdeps/csky/Makefile
> @@ -1,7 +1,3 @@
> -ifeq ($(subdir),csu)
> -gen-as-const-headers += tcb-offsets.sym
> -endif
> -
>  ASFLAGS-.os += $(pic-ccflag)
>  
>  ifeq ($(subdir),gmon)
> diff --git a/sysdeps/csky/nptl/Makefile b/sysdeps/csky/nptl/Makefile
> deleted file mode 100644
> index a16a8b63ca..0000000000
> --- a/sysdeps/csky/nptl/Makefile
> +++ /dev/null
> @@ -1,20 +0,0 @@
> -# Copyright (C) 2018-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/>.
> -
> -ifeq ($(subdir),csu)
> -gen-as-const-headers += tcb-offsets.sym
> -endif
> diff --git a/sysdeps/csky/nptl/tcb-offsets.sym b/sysdeps/csky/nptl/tcb-offsets.sym
> deleted file mode 100644
> index f1105205c0..0000000000
> --- a/sysdeps/csky/nptl/tcb-offsets.sym
> +++ /dev/null
> @@ -1,10 +0,0 @@
> -#include <sysdep.h>
> -#include <tls.h>
> -
> ---
> -
> --- Derive offsets relative to the thread register.
> -#define thread_offsetof(mem)	(long)(offsetof (struct pthread, mem) - sizeof (struct pthread))
> -
> -MULTIPLE_THREADS_OFFSET		thread_offsetof (header.multiple_threads)
> -TID_OFFSET			thread_offsetof (tid)
> diff --git a/sysdeps/csky/nptl/tls.h b/sysdeps/csky/nptl/tls.h
> index 64dcaec279..afd1b3bbb7 100644
> --- a/sysdeps/csky/nptl/tls.h
> +++ b/sysdeps/csky/nptl/tls.h
> @@ -34,7 +34,6 @@
>       __result; })
>  
>  #else
> -# include <tcb-offsets.h>
>  /* Define r31 as thread pointer register.  */
>  # define READ_THREAD_POINTER() \
>  	mov r0, r31;
> diff --git a/sysdeps/hppa/nptl/Makefile b/sysdeps/hppa/nptl/Makefile
> deleted file mode 100644
> index 329a57a473..0000000000
> --- a/sysdeps/hppa/nptl/Makefile
> +++ /dev/null
> @@ -1,20 +0,0 @@
> -# Copyright (C) 2005-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/>.
> -
> -ifeq ($(subdir),csu)
> -gen-as-const-headers += tcb-offsets.sym
> -endif
> diff --git a/sysdeps/hppa/nptl/tcb-offsets.sym b/sysdeps/hppa/nptl/tcb-offsets.sym
> deleted file mode 100644
> index 6e852f35b1..0000000000
> --- a/sysdeps/hppa/nptl/tcb-offsets.sym
> +++ /dev/null
> @@ -1,17 +0,0 @@
> -#include <pthread.h>
> -#include <tls.h>
> -
> -RESULT			offsetof (struct pthread, result)
> -TID			offsetof (struct pthread, tid)
> -CANCELHANDLING		offsetof (struct pthread, cancelhandling)
> -CLEANUP_JMP_BUF		offsetof (struct pthread, cleanup_jmp_buf)
> -MULTIPLE_THREADS_OFFSET	offsetof (struct pthread, header.multiple_threads)
> -TLS_PRE_TCB_SIZE	sizeof (struct pthread)
> -MUTEX_FUTEX		offsetof (pthread_mutex_t, __data.__lock)
> -
> --- Use a thread_offset when working with asm to make things simpler
> --- This way we get the offset of a member in the struct pthread that
> --- preceeds the thread pointer (which points to the dtv).
> -#define thread_offsetof(mem)    (unsigned int)(offsetof(struct pthread, mem) - sizeof(struct pthread))
> -TID_THREAD_OFFSET		thread_offsetof (tid)
> -MULTIPLE_THREADS_THREAD_OFFSET	thread_offsetof (header.multiple_threads)
> diff --git a/sysdeps/hppa/nptl/tls.h b/sysdeps/hppa/nptl/tls.h
> index 62bfb96548..c4039038d3 100644
> --- a/sysdeps/hppa/nptl/tls.h
> +++ b/sysdeps/hppa/nptl/tls.h
> @@ -26,9 +26,6 @@
>  # include <stddef.h>
>  # include <stdint.h>
>  # include <dl-dtv.h>
> -
> -#else /* __ASSEMBLER__ */
> -# include <tcb-offsets.h>
>  #endif /* __ASSEMBLER__ */
>  
>  #ifndef __ASSEMBLER__
> diff --git a/sysdeps/m68k/nptl/Makefile b/sysdeps/m68k/nptl/Makefile
> deleted file mode 100644
> index ed9ddd1648..0000000000
> --- a/sysdeps/m68k/nptl/Makefile
> +++ /dev/null
> @@ -1,20 +0,0 @@
> -# Copyright (C) 2010-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/>.
> -
> -ifeq ($(subdir),csu)
> -gen-as-const-headers += tcb-offsets.sym
> -endif
> diff --git a/sysdeps/m68k/nptl/tcb-offsets.sym b/sysdeps/m68k/nptl/tcb-offsets.sym
> deleted file mode 100644
> index 241fb8b47c..0000000000
> --- a/sysdeps/m68k/nptl/tcb-offsets.sym
> +++ /dev/null
> @@ -1,10 +0,0 @@
> -#include <sysdep.h>
> -#include <tls.h>
> -
> ---
> -
> --- Derive offsets relative to the thread register.
> -#define thread_offsetof(mem)	(long)(offsetof(struct pthread, mem) - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE)
> -
> -MULTIPLE_THREADS_OFFSET		thread_offsetof (header.multiple_threads)
> -TID_OFFSET			thread_offsetof (tid)
> diff --git a/sysdeps/m68k/nptl/tls.h b/sysdeps/m68k/nptl/tls.h
> index 3acedc8465..ab2a1d54bd 100644
> --- a/sysdeps/m68k/nptl/tls.h
> +++ b/sysdeps/m68k/nptl/tls.h
> @@ -26,9 +26,6 @@
>  # include <stddef.h>
>  # include <stdint.h>
>  # include <dl-dtv.h>
> -
> -#else /* __ASSEMBLER__ */
> -# include <tcb-offsets.h>
>  #endif /* __ASSEMBLER__ */
>  
>  #ifndef __ASSEMBLER__
> diff --git a/sysdeps/microblaze/nptl/Makefile b/sysdeps/microblaze/nptl/Makefile
> deleted file mode 100644
> index 6d23959e30..0000000000
> --- a/sysdeps/microblaze/nptl/Makefile
> +++ /dev/null
> @@ -1,21 +0,0 @@
> -# Copyright (C) 2005-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/>.
> -
> -ifeq ($(subdir),csu)
> -gen-as-const-headers += tcb-offsets.sym
> -endif
> diff --git a/sysdeps/microblaze/nptl/tcb-offsets.sym b/sysdeps/microblaze/nptl/tcb-offsets.sym
> deleted file mode 100644
> index 614f0dfed6..0000000000
> --- a/sysdeps/microblaze/nptl/tcb-offsets.sym
> +++ /dev/null
> @@ -1,10 +0,0 @@
> -#include <sysdep.h>
> -#include <tls.h>
> -
> ---
> -
> --- Abuse tls.h macros to derive offsets relative to the thread register.
> -#define thread_offsetof(mem)	(long)(offsetof (struct pthread, mem) - sizeof (struct pthread))
> -
> -MULTIPLE_THREADS_OFFSET	thread_offsetof (header.multiple_threads)
> -TID_OFFSET			thread_offsetof (tid)
> diff --git a/sysdeps/microblaze/nptl/tls.h b/sysdeps/microblaze/nptl/tls.h
> index de9d2b693b..2ad2219fe5 100644
> --- a/sysdeps/microblaze/nptl/tls.h
> +++ b/sysdeps/microblaze/nptl/tls.h
> @@ -26,9 +26,6 @@
>  # include <stddef.h>
>  # include <stdint.h>
>  # include <dl-dtv.h>
> -
> -#else /* __ASSEMBLER__ */
> -# include <tcb-offsets.h>
>  #endif /* __ASSEMBLER__ */
>  
>  #ifndef __ASSEMBLER__
> diff --git a/sysdeps/mips/nptl/Makefile b/sysdeps/mips/nptl/Makefile
> deleted file mode 100644
> index 329a57a473..0000000000
> --- a/sysdeps/mips/nptl/Makefile
> +++ /dev/null
> @@ -1,20 +0,0 @@
> -# Copyright (C) 2005-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/>.
> -
> -ifeq ($(subdir),csu)
> -gen-as-const-headers += tcb-offsets.sym
> -endif
> diff --git a/sysdeps/mips/nptl/tcb-offsets.sym b/sysdeps/mips/nptl/tcb-offsets.sym
> deleted file mode 100644
> index 9ea25b94a8..0000000000
> --- a/sysdeps/mips/nptl/tcb-offsets.sym
> +++ /dev/null
> @@ -1,10 +0,0 @@
> -#include <sysdep.h>
> -#include <tls.h>
> -
> ---
> -
> --- Abuse tls.h macros to derive offsets relative to the thread register.
> -#define thread_offsetof(mem)	(long)(offsetof(struct pthread, mem) - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE)
> -
> -MULTIPLE_THREADS_OFFSET		thread_offsetof (header.multiple_threads)
> -TID_OFFSET			thread_offsetof (tid)
> diff --git a/sysdeps/mips/nptl/tls.h b/sysdeps/mips/nptl/tls.h
> index 797e661dc1..ce7c6606be 100644
> --- a/sysdeps/mips/nptl/tls.h
> +++ b/sysdeps/mips/nptl/tls.h
> @@ -50,8 +50,6 @@
>  #endif
>  
>  #else /* __ASSEMBLER__ */
> -# include <tcb-offsets.h>
> -
>  # if __mips_isa_rev >= 2
>  #  define READ_THREAD_POINTER(rd) rdhwr	rd, $29
>  # else
> diff --git a/sysdeps/nios2/Makefile b/sysdeps/nios2/Makefile
> index f368a12b2d..825ed1357e 100644
> --- a/sysdeps/nios2/Makefile
> +++ b/sysdeps/nios2/Makefile
> @@ -24,7 +24,3 @@ long-double-fcts = no
>  ifeq ($(subdir),soft-fp)
>  sysdep_routines += $(gcc-single-routines) $(gcc-double-routines)
>  endif
> -
> -ifeq ($(subdir),csu)
> -gen-as-const-headers += tcb-offsets.sym
> -endif
> diff --git a/sysdeps/riscv/nptl/Makefile b/sysdeps/riscv/nptl/Makefile
> deleted file mode 100644
> index cca67db324..0000000000
> --- a/sysdeps/riscv/nptl/Makefile
> +++ /dev/null
> @@ -1,21 +0,0 @@
> -# Makefile for sysdeps/riscv/nptl.
> -# Copyright (C) 2005-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/>.
> -
> -ifeq ($(subdir),csu)
> -gen-as-const-headers += tcb-offsets.sym
> -endif
> diff --git a/sysdeps/riscv/nptl/tcb-offsets.sym b/sysdeps/riscv/nptl/tcb-offsets.sym
> deleted file mode 100644
> index ab4981f2e2..0000000000
> --- a/sysdeps/riscv/nptl/tcb-offsets.sym
> +++ /dev/null
> @@ -1,6 +0,0 @@
> -#include <sysdep.h>
> -#include <tls.h>
> -
> -#define thread_offsetof(mem)	(long)(offsetof (struct pthread, mem) - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE)
> -
> -MULTIPLE_THREADS_OFFSET		thread_offsetof (header.multiple_threads)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/5] Remove ununsed tcb-offset
  2021-12-17 19:26   ` Adhemerval Zanella
@ 2021-12-17 23:25     ` Stafford Horne
  0 siblings, 0 replies; 12+ messages in thread
From: Stafford Horne @ 2021-12-17 23:25 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: GLIBC patches

I looks good to me.

On Sat, Dec 18, 2021, 4:26 AM Adhemerval Zanella <
adhemerval.zanella@linaro.org> wrote:

> I will commit this shortly if noone opposes it.
>
> On 16/12/2021 16:42, Adhemerval Zanella wrote:
> > Some architectures do not use the auto-generated tcb-offsets.h.
> > ---
> >  sysdeps/aarch64/nptl/Makefile           | 21 ---------------------
> >  sysdeps/aarch64/nptl/tcb-offsets.sym    |  6 ------
> >  sysdeps/aarch64/nptl/tls.h              |  3 ---
> >  sysdeps/alpha/nptl/Makefile             | 20 --------------------
> >  sysdeps/alpha/nptl/tcb-offsets.sym      | 13 -------------
> >  sysdeps/alpha/nptl/tls.h                |  2 --
> >  sysdeps/arc/nptl/Makefile               | 22 ----------------------
> >  sysdeps/arc/nptl/tcb-offsets.sym        | 11 -----------
> >  sysdeps/arm/nptl/Makefile               |  4 ----
> >  sysdeps/arm/nptl/tcb-offsets.sym        | 10 ----------
> >  sysdeps/arm/nptl/tls.h                  |  3 ---
> >  sysdeps/csky/Makefile                   |  4 ----
> >  sysdeps/csky/nptl/Makefile              | 20 --------------------
> >  sysdeps/csky/nptl/tcb-offsets.sym       | 10 ----------
> >  sysdeps/csky/nptl/tls.h                 |  1 -
> >  sysdeps/hppa/nptl/Makefile              | 20 --------------------
> >  sysdeps/hppa/nptl/tcb-offsets.sym       | 17 -----------------
> >  sysdeps/hppa/nptl/tls.h                 |  3 ---
> >  sysdeps/m68k/nptl/Makefile              | 20 --------------------
> >  sysdeps/m68k/nptl/tcb-offsets.sym       | 10 ----------
> >  sysdeps/m68k/nptl/tls.h                 |  3 ---
> >  sysdeps/microblaze/nptl/Makefile        | 21 ---------------------
> >  sysdeps/microblaze/nptl/tcb-offsets.sym | 10 ----------
> >  sysdeps/microblaze/nptl/tls.h           |  3 ---
> >  sysdeps/mips/nptl/Makefile              | 20 --------------------
> >  sysdeps/mips/nptl/tcb-offsets.sym       | 10 ----------
> >  sysdeps/mips/nptl/tls.h                 |  2 --
> >  sysdeps/nios2/Makefile                  |  4 ----
> >  sysdeps/riscv/nptl/Makefile             | 21 ---------------------
> >  sysdeps/riscv/nptl/tcb-offsets.sym      |  6 ------
> >  30 files changed, 320 deletions(-)
> >  delete mode 100644 sysdeps/aarch64/nptl/Makefile
> >  delete mode 100644 sysdeps/aarch64/nptl/tcb-offsets.sym
> >  delete mode 100644 sysdeps/alpha/nptl/Makefile
> >  delete mode 100644 sysdeps/alpha/nptl/tcb-offsets.sym
> >  delete mode 100644 sysdeps/arc/nptl/Makefile
> >  delete mode 100644 sysdeps/arc/nptl/tcb-offsets.sym
> >  delete mode 100644 sysdeps/arm/nptl/tcb-offsets.sym
> >  delete mode 100644 sysdeps/csky/nptl/Makefile
> >  delete mode 100644 sysdeps/csky/nptl/tcb-offsets.sym
> >  delete mode 100644 sysdeps/hppa/nptl/Makefile
> >  delete mode 100644 sysdeps/hppa/nptl/tcb-offsets.sym
> >  delete mode 100644 sysdeps/m68k/nptl/Makefile
> >  delete mode 100644 sysdeps/m68k/nptl/tcb-offsets.sym
> >  delete mode 100644 sysdeps/microblaze/nptl/Makefile
> >  delete mode 100644 sysdeps/microblaze/nptl/tcb-offsets.sym
> >  delete mode 100644 sysdeps/mips/nptl/Makefile
> >  delete mode 100644 sysdeps/mips/nptl/tcb-offsets.sym
> >  delete mode 100644 sysdeps/riscv/nptl/Makefile
> >  delete mode 100644 sysdeps/riscv/nptl/tcb-offsets.sym
> >
> > diff --git a/sysdeps/aarch64/nptl/Makefile
> b/sysdeps/aarch64/nptl/Makefile
> > deleted file mode 100644
> > index 6d23959e30..0000000000
> > --- a/sysdeps/aarch64/nptl/Makefile
> > +++ /dev/null
> > @@ -1,21 +0,0 @@
> > -# Copyright (C) 2005-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/>.
> > -
> > -ifeq ($(subdir),csu)
> > -gen-as-const-headers += tcb-offsets.sym
> > -endif
> > diff --git a/sysdeps/aarch64/nptl/tcb-offsets.sym
> b/sysdeps/aarch64/nptl/tcb-offsets.sym
> > deleted file mode 100644
> > index 238647dd47..0000000000
> > --- a/sysdeps/aarch64/nptl/tcb-offsets.sym
> > +++ /dev/null
> > @@ -1,6 +0,0 @@
> > -#include <sysdep.h>
> > -#include <tls.h>
> > -
> > -PTHREAD_MULTIPLE_THREADS_OFFSET              offsetof (struct pthread,
> header.multiple_threads)
> > -PTHREAD_TID_OFFSET                   offsetof (struct pthread, tid)
> > -PTHREAD_SIZEOF                               sizeof (struct pthread)
> > diff --git a/sysdeps/aarch64/nptl/tls.h b/sysdeps/aarch64/nptl/tls.h
> > index 860776bb4b..84916f36b7 100644
> > --- a/sysdeps/aarch64/nptl/tls.h
> > +++ b/sysdeps/aarch64/nptl/tls.h
> > @@ -26,9 +26,6 @@
> >  # include <stddef.h>
> >  # include <stdint.h>
> >  # include <dl-dtv.h>
> > -
> > -#else /* __ASSEMBLER__ */
> > -# include <tcb-offsets.h>
> >  #endif /* __ASSEMBLER__ */
> >
> >  #ifndef __ASSEMBLER__
> > diff --git a/sysdeps/alpha/nptl/Makefile b/sysdeps/alpha/nptl/Makefile
> > deleted file mode 100644
> > index fc5567ee55..0000000000
> > --- a/sysdeps/alpha/nptl/Makefile
> > +++ /dev/null
> > @@ -1,20 +0,0 @@
> > -# Copyright (C) 2003-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/>.
> > -
> > -ifeq ($(subdir),csu)
> > -gen-as-const-headers += tcb-offsets.sym
> > -endif
> > diff --git a/sysdeps/alpha/nptl/tcb-offsets.sym
> b/sysdeps/alpha/nptl/tcb-offsets.sym
> > deleted file mode 100644
> > index 1005621b37..0000000000
> > --- a/sysdeps/alpha/nptl/tcb-offsets.sym
> > +++ /dev/null
> > @@ -1,13 +0,0 @@
> > -#include <sysdep.h>
> > -#include <tls.h>
> > -
> > ---
> > -
> > --- Abuse tls.h macros to derive offsets relative to the thread register.
> > --- # define __builtin_thread_pointer()  ((void *) 0)
> > --- # define thread_offsetof(mem)     ((void *) &THREAD_SELF->mem -
> (void *) 0)
> > --- Ho hum, this doesn't work in gcc4, so Know Things about THREAD_SELF
> > -#define thread_offsetof(mem) (long)(offsetof(struct pthread, mem) -
> sizeof(struct pthread))
> > -
> > -MULTIPLE_THREADS_OFFSET              thread_offsetof
> (header.multiple_threads)
> > -TID_OFFSET                   thread_offsetof (tid)
> > diff --git a/sysdeps/alpha/nptl/tls.h b/sysdeps/alpha/nptl/tls.h
> > index 860cc46d88..c260078c86 100644
> > --- a/sysdeps/alpha/nptl/tls.h
> > +++ b/sysdeps/alpha/nptl/tls.h
> > @@ -109,8 +109,6 @@ typedef struct
> >      }
>            \
> >    while (0)
> >
> > -#else /* __ASSEMBLER__ */
> > -# include <tcb-offsets.h>
> >  #endif /* __ASSEMBLER__ */
> >
> >  #endif       /* tls.h */
> > diff --git a/sysdeps/arc/nptl/Makefile b/sysdeps/arc/nptl/Makefile
> > deleted file mode 100644
> > index d85b47416a..0000000000
> > --- a/sysdeps/arc/nptl/Makefile
> > +++ /dev/null
> > @@ -1,22 +0,0 @@
> > -# NPTL makefile fragment for ARC.
> > -# Copyright (C) 2020-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/>.
> > -
> > -ifeq ($(subdir),csu)
> > -gen-as-const-headers += tcb-offsets.sym
> > -endif
> > diff --git a/sysdeps/arc/nptl/tcb-offsets.sym
> b/sysdeps/arc/nptl/tcb-offsets.sym
> > deleted file mode 100644
> > index 64c432c22e..0000000000
> > --- a/sysdeps/arc/nptl/tcb-offsets.sym
> > +++ /dev/null
> > @@ -1,11 +0,0 @@
> > -#include <sysdep.h>
> > -#include <tls.h>
> > -
> > --- Derive offsets relative to the thread register.
> > -#define thread_offsetof(mem) (long)(offsetof (struct pthread, mem) -
> sizeof (struct pthread))
> > -
> > -MULTIPLE_THREADS_OFFSET              offsetof (struct pthread,
> header.multiple_threads)
> > -TLS_PRE_TCB_SIZE             sizeof (struct pthread)
> > -TLS_TCB_SIZE                 sizeof (tcbhead_t)
> > -
> > -PTHREAD_TID                  offsetof (struct pthread, tid)
> > diff --git a/sysdeps/arm/nptl/Makefile b/sysdeps/arm/nptl/Makefile
> > index 44154bff37..2e8efe7170 100644
> > --- a/sysdeps/arm/nptl/Makefile
> > +++ b/sysdeps/arm/nptl/Makefile
> > @@ -15,10 +15,6 @@
> >  # License along with the GNU C Library.  If not, see
> >  # <https://www.gnu.org/licenses/>.
> >
> > -ifeq ($(subdir),csu)
> > -gen-as-const-headers += tcb-offsets.sym
> > -endif
> > -
> >  ifeq ($(subdir),nptl)
> >  # This test relies on compiling part of the binary with EH information,
> >  # part without, and unwinding through.  The .ARM.exidx tables have
> > diff --git a/sysdeps/arm/nptl/tcb-offsets.sym
> b/sysdeps/arm/nptl/tcb-offsets.sym
> > deleted file mode 100644
> > index bf9c0a1c17..0000000000
> > --- a/sysdeps/arm/nptl/tcb-offsets.sym
> > +++ /dev/null
> > @@ -1,10 +0,0 @@
> > -#include <sysdep.h>
> > -#include <tls.h>
> > -
> > ---
> > -
> > --- Derive offsets relative to the thread register.
> > -#define thread_offsetof(mem) (long)(offsetof(struct pthread, mem) -
> sizeof(struct pthread))
> > -
> > -MULTIPLE_THREADS_OFFSET              thread_offsetof
> (header.multiple_threads)
> > -TID_OFFSET                   thread_offsetof (tid)
> > diff --git a/sysdeps/arm/nptl/tls.h b/sysdeps/arm/nptl/tls.h
> > index 57e039fc0f..9662da39ab 100644
> > --- a/sysdeps/arm/nptl/tls.h
> > +++ b/sysdeps/arm/nptl/tls.h
> > @@ -26,9 +26,6 @@
> >  # include <stddef.h>
> >  # include <stdint.h>
> >  # include <dl-dtv.h>
> > -
> > -#else /* __ASSEMBLER__ */
> > -# include <tcb-offsets.h>
> >  #endif /* __ASSEMBLER__ */
> >
> >
> > diff --git a/sysdeps/csky/Makefile b/sysdeps/csky/Makefile
> > index 0db09dccce..1ced510c2d 100644
> > --- a/sysdeps/csky/Makefile
> > +++ b/sysdeps/csky/Makefile
> > @@ -1,7 +1,3 @@
> > -ifeq ($(subdir),csu)
> > -gen-as-const-headers += tcb-offsets.sym
> > -endif
> > -
> >  ASFLAGS-.os += $(pic-ccflag)
> >
> >  ifeq ($(subdir),gmon)
> > diff --git a/sysdeps/csky/nptl/Makefile b/sysdeps/csky/nptl/Makefile
> > deleted file mode 100644
> > index a16a8b63ca..0000000000
> > --- a/sysdeps/csky/nptl/Makefile
> > +++ /dev/null
> > @@ -1,20 +0,0 @@
> > -# Copyright (C) 2018-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/>.
> > -
> > -ifeq ($(subdir),csu)
> > -gen-as-const-headers += tcb-offsets.sym
> > -endif
> > diff --git a/sysdeps/csky/nptl/tcb-offsets.sym
> b/sysdeps/csky/nptl/tcb-offsets.sym
> > deleted file mode 100644
> > index f1105205c0..0000000000
> > --- a/sysdeps/csky/nptl/tcb-offsets.sym
> > +++ /dev/null
> > @@ -1,10 +0,0 @@
> > -#include <sysdep.h>
> > -#include <tls.h>
> > -
> > ---
> > -
> > --- Derive offsets relative to the thread register.
> > -#define thread_offsetof(mem) (long)(offsetof (struct pthread, mem) -
> sizeof (struct pthread))
> > -
> > -MULTIPLE_THREADS_OFFSET              thread_offsetof
> (header.multiple_threads)
> > -TID_OFFSET                   thread_offsetof (tid)
> > diff --git a/sysdeps/csky/nptl/tls.h b/sysdeps/csky/nptl/tls.h
> > index 64dcaec279..afd1b3bbb7 100644
> > --- a/sysdeps/csky/nptl/tls.h
> > +++ b/sysdeps/csky/nptl/tls.h
> > @@ -34,7 +34,6 @@
> >       __result; })
> >
> >  #else
> > -# include <tcb-offsets.h>
> >  /* Define r31 as thread pointer register.  */
> >  # define READ_THREAD_POINTER() \
> >       mov r0, r31;
> > diff --git a/sysdeps/hppa/nptl/Makefile b/sysdeps/hppa/nptl/Makefile
> > deleted file mode 100644
> > index 329a57a473..0000000000
> > --- a/sysdeps/hppa/nptl/Makefile
> > +++ /dev/null
> > @@ -1,20 +0,0 @@
> > -# Copyright (C) 2005-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/>.
> > -
> > -ifeq ($(subdir),csu)
> > -gen-as-const-headers += tcb-offsets.sym
> > -endif
> > diff --git a/sysdeps/hppa/nptl/tcb-offsets.sym
> b/sysdeps/hppa/nptl/tcb-offsets.sym
> > deleted file mode 100644
> > index 6e852f35b1..0000000000
> > --- a/sysdeps/hppa/nptl/tcb-offsets.sym
> > +++ /dev/null
> > @@ -1,17 +0,0 @@
> > -#include <pthread.h>
> > -#include <tls.h>
> > -
> > -RESULT                       offsetof (struct pthread, result)
> > -TID                  offsetof (struct pthread, tid)
> > -CANCELHANDLING               offsetof (struct pthread, cancelhandling)
> > -CLEANUP_JMP_BUF              offsetof (struct pthread, cleanup_jmp_buf)
> > -MULTIPLE_THREADS_OFFSET      offsetof (struct pthread,
> header.multiple_threads)
> > -TLS_PRE_TCB_SIZE     sizeof (struct pthread)
> > -MUTEX_FUTEX          offsetof (pthread_mutex_t, __data.__lock)
> > -
> > --- Use a thread_offset when working with asm to make things simpler
> > --- This way we get the offset of a member in the struct pthread that
> > --- preceeds the thread pointer (which points to the dtv).
> > -#define thread_offsetof(mem)    (unsigned int)(offsetof(struct pthread,
> mem) - sizeof(struct pthread))
> > -TID_THREAD_OFFSET            thread_offsetof (tid)
> > -MULTIPLE_THREADS_THREAD_OFFSET       thread_offsetof
> (header.multiple_threads)
> > diff --git a/sysdeps/hppa/nptl/tls.h b/sysdeps/hppa/nptl/tls.h
> > index 62bfb96548..c4039038d3 100644
> > --- a/sysdeps/hppa/nptl/tls.h
> > +++ b/sysdeps/hppa/nptl/tls.h
> > @@ -26,9 +26,6 @@
> >  # include <stddef.h>
> >  # include <stdint.h>
> >  # include <dl-dtv.h>
> > -
> > -#else /* __ASSEMBLER__ */
> > -# include <tcb-offsets.h>
> >  #endif /* __ASSEMBLER__ */
> >
> >  #ifndef __ASSEMBLER__
> > diff --git a/sysdeps/m68k/nptl/Makefile b/sysdeps/m68k/nptl/Makefile
> > deleted file mode 100644
> > index ed9ddd1648..0000000000
> > --- a/sysdeps/m68k/nptl/Makefile
> > +++ /dev/null
> > @@ -1,20 +0,0 @@
> > -# Copyright (C) 2010-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/>.
> > -
> > -ifeq ($(subdir),csu)
> > -gen-as-const-headers += tcb-offsets.sym
> > -endif
> > diff --git a/sysdeps/m68k/nptl/tcb-offsets.sym
> b/sysdeps/m68k/nptl/tcb-offsets.sym
> > deleted file mode 100644
> > index 241fb8b47c..0000000000
> > --- a/sysdeps/m68k/nptl/tcb-offsets.sym
> > +++ /dev/null
> > @@ -1,10 +0,0 @@
> > -#include <sysdep.h>
> > -#include <tls.h>
> > -
> > ---
> > -
> > --- Derive offsets relative to the thread register.
> > -#define thread_offsetof(mem) (long)(offsetof(struct pthread, mem) -
> TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE)
> > -
> > -MULTIPLE_THREADS_OFFSET              thread_offsetof
> (header.multiple_threads)
> > -TID_OFFSET                   thread_offsetof (tid)
> > diff --git a/sysdeps/m68k/nptl/tls.h b/sysdeps/m68k/nptl/tls.h
> > index 3acedc8465..ab2a1d54bd 100644
> > --- a/sysdeps/m68k/nptl/tls.h
> > +++ b/sysdeps/m68k/nptl/tls.h
> > @@ -26,9 +26,6 @@
> >  # include <stddef.h>
> >  # include <stdint.h>
> >  # include <dl-dtv.h>
> > -
> > -#else /* __ASSEMBLER__ */
> > -# include <tcb-offsets.h>
> >  #endif /* __ASSEMBLER__ */
> >
> >  #ifndef __ASSEMBLER__
> > diff --git a/sysdeps/microblaze/nptl/Makefile
> b/sysdeps/microblaze/nptl/Makefile
> > deleted file mode 100644
> > index 6d23959e30..0000000000
> > --- a/sysdeps/microblaze/nptl/Makefile
> > +++ /dev/null
> > @@ -1,21 +0,0 @@
> > -# Copyright (C) 2005-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/>.
> > -
> > -ifeq ($(subdir),csu)
> > -gen-as-const-headers += tcb-offsets.sym
> > -endif
> > diff --git a/sysdeps/microblaze/nptl/tcb-offsets.sym
> b/sysdeps/microblaze/nptl/tcb-offsets.sym
> > deleted file mode 100644
> > index 614f0dfed6..0000000000
> > --- a/sysdeps/microblaze/nptl/tcb-offsets.sym
> > +++ /dev/null
> > @@ -1,10 +0,0 @@
> > -#include <sysdep.h>
> > -#include <tls.h>
> > -
> > ---
> > -
> > --- Abuse tls.h macros to derive offsets relative to the thread register.
> > -#define thread_offsetof(mem) (long)(offsetof (struct pthread, mem) -
> sizeof (struct pthread))
> > -
> > -MULTIPLE_THREADS_OFFSET      thread_offsetof (header.multiple_threads)
> > -TID_OFFSET                   thread_offsetof (tid)
> > diff --git a/sysdeps/microblaze/nptl/tls.h
> b/sysdeps/microblaze/nptl/tls.h
> > index de9d2b693b..2ad2219fe5 100644
> > --- a/sysdeps/microblaze/nptl/tls.h
> > +++ b/sysdeps/microblaze/nptl/tls.h
> > @@ -26,9 +26,6 @@
> >  # include <stddef.h>
> >  # include <stdint.h>
> >  # include <dl-dtv.h>
> > -
> > -#else /* __ASSEMBLER__ */
> > -# include <tcb-offsets.h>
> >  #endif /* __ASSEMBLER__ */
> >
> >  #ifndef __ASSEMBLER__
> > diff --git a/sysdeps/mips/nptl/Makefile b/sysdeps/mips/nptl/Makefile
> > deleted file mode 100644
> > index 329a57a473..0000000000
> > --- a/sysdeps/mips/nptl/Makefile
> > +++ /dev/null
> > @@ -1,20 +0,0 @@
> > -# Copyright (C) 2005-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/>.
> > -
> > -ifeq ($(subdir),csu)
> > -gen-as-const-headers += tcb-offsets.sym
> > -endif
> > diff --git a/sysdeps/mips/nptl/tcb-offsets.sym
> b/sysdeps/mips/nptl/tcb-offsets.sym
> > deleted file mode 100644
> > index 9ea25b94a8..0000000000
> > --- a/sysdeps/mips/nptl/tcb-offsets.sym
> > +++ /dev/null
> > @@ -1,10 +0,0 @@
> > -#include <sysdep.h>
> > -#include <tls.h>
> > -
> > ---
> > -
> > --- Abuse tls.h macros to derive offsets relative to the thread register.
> > -#define thread_offsetof(mem) (long)(offsetof(struct pthread, mem) -
> TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE)
> > -
> > -MULTIPLE_THREADS_OFFSET              thread_offsetof
> (header.multiple_threads)
> > -TID_OFFSET                   thread_offsetof (tid)
> > diff --git a/sysdeps/mips/nptl/tls.h b/sysdeps/mips/nptl/tls.h
> > index 797e661dc1..ce7c6606be 100644
> > --- a/sysdeps/mips/nptl/tls.h
> > +++ b/sysdeps/mips/nptl/tls.h
> > @@ -50,8 +50,6 @@
> >  #endif
> >
> >  #else /* __ASSEMBLER__ */
> > -# include <tcb-offsets.h>
> > -
> >  # if __mips_isa_rev >= 2
> >  #  define READ_THREAD_POINTER(rd) rdhwr      rd, $29
> >  # else
> > diff --git a/sysdeps/nios2/Makefile b/sysdeps/nios2/Makefile
> > index f368a12b2d..825ed1357e 100644
> > --- a/sysdeps/nios2/Makefile
> > +++ b/sysdeps/nios2/Makefile
> > @@ -24,7 +24,3 @@ long-double-fcts = no
> >  ifeq ($(subdir),soft-fp)
> >  sysdep_routines += $(gcc-single-routines) $(gcc-double-routines)
> >  endif
> > -
> > -ifeq ($(subdir),csu)
> > -gen-as-const-headers += tcb-offsets.sym
> > -endif
> > diff --git a/sysdeps/riscv/nptl/Makefile b/sysdeps/riscv/nptl/Makefile
> > deleted file mode 100644
> > index cca67db324..0000000000
> > --- a/sysdeps/riscv/nptl/Makefile
> > +++ /dev/null
> > @@ -1,21 +0,0 @@
> > -# Makefile for sysdeps/riscv/nptl.
> > -# Copyright (C) 2005-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/>.
> > -
> > -ifeq ($(subdir),csu)
> > -gen-as-const-headers += tcb-offsets.sym
> > -endif
> > diff --git a/sysdeps/riscv/nptl/tcb-offsets.sym
> b/sysdeps/riscv/nptl/tcb-offsets.sym
> > deleted file mode 100644
> > index ab4981f2e2..0000000000
> > --- a/sysdeps/riscv/nptl/tcb-offsets.sym
> > +++ /dev/null
> > @@ -1,6 +0,0 @@
> > -#include <sysdep.h>
> > -#include <tls.h>
> > -
> > -#define thread_offsetof(mem) (long)(offsetof (struct pthread, mem) -
> TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE)
> > -
> > -MULTIPLE_THREADS_OFFSET              thread_offsetof
> (header.multiple_threads)
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-12-17 23:26 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-16 19:42 [PATCH 0/5] Architecture code cleanup Adhemerval Zanella
2021-12-16 19:42 ` [PATCH 1/5] Remove ununsed tcb-offset Adhemerval Zanella
2021-12-17 19:26   ` Adhemerval Zanella
2021-12-17 23:25     ` Stafford Horne
2021-12-16 19:42 ` [PATCH 2/5] malloc: Use C11 atomics on libmemusage Adhemerval Zanella
2021-12-16 19:42 ` [PATCH 3/5] Remove atomic-machine.h boilerplates definition Adhemerval Zanella
2021-12-16 19:42 ` [PATCH 4/5] malloc: Use hp-timing on libmemusage Adhemerval Zanella
2021-12-16 19:42 ` [PATCH 5/5] malloc: Remove memusage.h Adhemerval Zanella
2021-12-16 21:41 ` [PATCH 0/5] Architecture code cleanup Joseph Myers
2021-12-16 23:08   ` Adhemerval Zanella
2021-12-16 23:35     ` Adhemerval Zanella
2021-12-17 11:10       ` Adhemerval Zanella

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).