From patchwork Thu Dec 16 19:42:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 49022 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 501F4385842A for ; Thu, 16 Dec 2021 19:44:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 501F4385842A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1639683852; bh=Z2WBNoGpnd+FTR2YpEhXOnj/e5JqGAULbl2qUxcCs/4=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=w11jyM2cwzHkYJ8zvIn4DpcdAzmKSn6kQdCIX6lnfgfXb296EYNu7LvfAcmUdSzOo M/lui+02Bn4CskHK+xAaV98YLgOPeYiCKhmZe7x2jo8aAsDI8sWV+JkcZ8PXUnLZI7 TISB42DXuJInaeXBgzfKYPNV2Nv5ukoWMTzMMgDg= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qv1-xf30.google.com (mail-qv1-xf30.google.com [IPv6:2607:f8b0:4864:20::f30]) by sourceware.org (Postfix) with ESMTPS id B31163858D35 for ; Thu, 16 Dec 2021 19:42:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B31163858D35 Received: by mail-qv1-xf30.google.com with SMTP id kj6so308293qvb.2 for ; Thu, 16 Dec 2021 11:42:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Z2WBNoGpnd+FTR2YpEhXOnj/e5JqGAULbl2qUxcCs/4=; b=p9iC7wmZ9e+AR73zq2L2JaVZgnh+QBM4TvKl8gsU9kpBl09m7ikbcuVu6ICCwZ+uke zh/+ny3w77hm/RQNNjF0ANvIE/FdML3YfRRKs82dZmNgV+nLX6Hh71DXGDE7nelPqQsH RYAUin6TGIpVy1g5enMCZhoH4kAJCKt1L7vDCncq9d7nyegxL4saWEFmWtrHBi92Laf7 9qOMcLqOTA/8WMY/SRGPC7/wOD8ozEVWXeFFHwevTblRvxk/fJqiVs+uzsIsgg2jY2ZH LBC+tHluFyZv1jgz9fpIgeGt1vFzXixmNwjfKm12c61DPrNV60+0zxnlIOPlrjJbFHzS zOCA== X-Gm-Message-State: AOAM533RYsB6/ov5RLpeArn5fAf5Fcz1VU+zyhMwAbabYW4+gaAcPVbL jFy0NJB/FcKCfuyGEwXAAWJJpFBuOxL0yA== X-Google-Smtp-Source: ABdhPJxNkqmvp6G6y5Bn5IoPcxq0XMDpcthMguRQ/2s3ESN+K686FkH14Pmf5u1XlN7dG2p40Yz73w== X-Received: by 2002:ad4:5911:: with SMTP id ez17mr12814258qvb.96.1639683747709; Thu, 16 Dec 2021 11:42:27 -0800 (PST) Received: from birita.. ([2804:431:c7ca:103f:96e9:fe91:2aff:a44d]) by smtp.gmail.com with ESMTPSA id br13sm3503836qkb.10.2021.12.16.11.42.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Dec 2021 11:42:27 -0800 (PST) To: libc-alpha@sourceware.org, Stafford Horne Subject: [PATCH 1/5] Remove ununsed tcb-offset Date: Thu, 16 Dec 2021 16:42:18 -0300 Message-Id: <20211216194222.186992-2-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211216194222.186992-1-adhemerval.zanella@linaro.org> References: <20211216194222.186992-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_ASCII_DIVIDERS, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" 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 -# . - -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 -#include - -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 # include # include - -#else /* __ASSEMBLER__ */ -# include #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 -# . - -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 -#include - --- - --- 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 #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 -# . - -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 -#include - --- 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 # . -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 -#include - --- - --- 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 # include # include - -#else /* __ASSEMBLER__ */ -# include #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 -# . - -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 -#include - --- - --- 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 /* 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 -# . - -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 -#include - -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 # include # include - -#else /* __ASSEMBLER__ */ -# include #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 -# . - -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 -#include - --- - --- 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 # include # include - -#else /* __ASSEMBLER__ */ -# include #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 -# . - -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 -#include - --- - --- 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 # include # include - -#else /* __ASSEMBLER__ */ -# include #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 -# . - -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 -#include - --- - --- 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 - # 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 -# . - -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 -#include - -#define thread_offsetof(mem) (long)(offsetof (struct pthread, mem) - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE) - -MULTIPLE_THREADS_OFFSET thread_offsetof (header.multiple_threads) From patchwork Thu Dec 16 19:42:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 49021 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EE10E3858003 for ; Thu, 16 Dec 2021 19:43:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EE10E3858003 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1639683810; bh=msMtjGsnSGOPcf6Hi0t+MMQPcD3qX7WWHEUsYuUkHpE=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=QjhQuzPpV6tumuryQqFRox6fGNTtuehlbYov4R46lttxARRYHx7234JfGrSjHwuk7 S8AK1zqblIs31+gGz8BDNat6yrLu+usquOTFTVouFFPZfqy/L3ZFXsG+Tvs0RwitsG yHeBwJdhuYdCS4W3Ae3JIV/MlVepckjDEjvdAdcs= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qv1-xf2e.google.com (mail-qv1-xf2e.google.com [IPv6:2607:f8b0:4864:20::f2e]) by sourceware.org (Postfix) with ESMTPS id D0ACB3858439 for ; Thu, 16 Dec 2021 19:42:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D0ACB3858439 Received: by mail-qv1-xf2e.google.com with SMTP id jo22so241023qvb.13 for ; Thu, 16 Dec 2021 11:42:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=msMtjGsnSGOPcf6Hi0t+MMQPcD3qX7WWHEUsYuUkHpE=; b=UlFJi7OdSGcB+GM+6V081WMiGtfCODVw0eflQhTkuuOk+z8QzZqdJTdLcQSCQTAj8f X7mVOBbxG2PnolJXYufu48zyrbuQ9OJJYeRUbbfSll16hvSY3dQIzb7Gsy2+4LwWtX1L jdGN9FQY/NG92NlcuEbQh945LFT1zIcmw8xfH+5J0jvGDxmv/vjftAYZarwEN42EEs1g PgPp1SW2bonGcd0BzY5Fo1U3142hXYAqfLona/iaGD7YPpNtTO38tSyRF4swwYYN54fp YFwllY8usJY6yCk+/vyvF7Ge1HcLiiIPOKdLo3Qd/0u3CnNNrzUMdFVcApc1H5fH6qj/ 76uw== X-Gm-Message-State: AOAM532f5n1aXd8XCdNbCUrGwiWbzFh8UTupnzmw5wQMKHxpRpDOlEL0 3PN3osPBBE4QYC996O7h3WQmJNvaKzxwiw== X-Google-Smtp-Source: ABdhPJx77kxE/ykZMtHmqY2kF4Anh8NoWNh7/y1ldVFH0jepAtou58CxX2aMJKNBRFmi2pvv98alJQ== X-Received: by 2002:ad4:5962:: with SMTP id eq2mr13764786qvb.105.1639683749247; Thu, 16 Dec 2021 11:42:29 -0800 (PST) Received: from birita.. ([2804:431:c7ca:103f:96e9:fe91:2aff:a44d]) by smtp.gmail.com with ESMTPSA id br13sm3503836qkb.10.2021.12.16.11.42.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Dec 2021 11:42:28 -0800 (PST) To: libc-alpha@sourceware.org, Stafford Horne Subject: [PATCH 2/5] malloc: Use C11 atomics on libmemusage Date: Thu, 16 Dec 2021 16:42:19 -0300 Message-Id: <20211216194222.186992-3-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211216194222.186992-1-adhemerval.zanella@linaro.org> References: <20211216194222.186992-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" 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 #include #include +#include #include @@ -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 (¤t_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 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 -#include #include #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 From patchwork Thu Dec 16 19:42:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 49024 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9A18B3858014 for ; Thu, 16 Dec 2021 19:45:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9A18B3858014 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1639683943; bh=BcRfPucTfpksjJE+LEX8GlVjdP1q8LpiX/1FgFfiw4o=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=IwBuI8cL034LZ8VpNwtZXhWN/0yABn/Gtbp9fbuR30Ic2ONmPsNv9BDuu1UGNQgsY vop61SsTo2vpyjfHYfRVaH8mV/SZDDCnpxViPsrVikFUkeo3A6DhjKimac4m0oXhsP X2BSgic7Rxyc/eJhrWOSf38HVa1440CpL4j1Rj8M= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qv1-xf31.google.com (mail-qv1-xf31.google.com [IPv6:2607:f8b0:4864:20::f31]) by sourceware.org (Postfix) with ESMTPS id 8574C385800C for ; Thu, 16 Dec 2021 19:42:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8574C385800C Received: by mail-qv1-xf31.google.com with SMTP id kc16so302982qvb.3 for ; Thu, 16 Dec 2021 11:42:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BcRfPucTfpksjJE+LEX8GlVjdP1q8LpiX/1FgFfiw4o=; b=svrM5sOVtaBrUUH+YObE54G68nitf/b+w5IUHqqlvkSQ+lzrEpnO/Vkb4F6rXGpTgs dBh5yPzuSiEwP+Y+RkhUznKi/BE+G9eq0gHfFQlv/5GO3G4u2SMg5rdcKGVMbvlLbs6+ qfu3s41FU5npT2LCDEwCq/BIlnPJKmMRE2dCx3Np37v3wjvTjmblmytNnS8M0cqNW9P3 PF9sVEq9t3HlTCX4L2d386Woq0uPnlqayHoeDTCypU2DZ8++liTvLoeOBYlq5d9IJW78 Ppzm7Cx4JQFL9K/onYi2NwbFMTyF8vW8CXMCzXG8VBb3m+sDlKCnDLKeZa2vY0g1+i9s SLtw== X-Gm-Message-State: AOAM532Ajz2969HyVn3bu098Zu+j8F5YBlcK6X/RKgqk+aiUYaz3yu43 oHicMUDCLKNAjowhPllsT4PKoMXf6ry+gQ== X-Google-Smtp-Source: ABdhPJx7fO++qawdRMK5ORCPUnZY81zUvEI5y0m63ok0NRlxnaTUYwVH8xERmfWqGU/wVq8OnzuDBA== X-Received: by 2002:a0c:8e08:: with SMTP id v8mr12826791qvb.93.1639683750700; Thu, 16 Dec 2021 11:42:30 -0800 (PST) Received: from birita.. ([2804:431:c7ca:103f:96e9:fe91:2aff:a44d]) by smtp.gmail.com with ESMTPSA id br13sm3503836qkb.10.2021.12.16.11.42.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Dec 2021 11:42:30 -0800 (PST) To: libc-alpha@sourceware.org, Stafford Horne Subject: [PATCH 3/5] Remove atomic-machine.h boilerplates definition Date: Thu, 16 Dec 2021 16:42:20 -0300 Message-Id: <20211216194222.186992-4-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211216194222.186992-1-adhemerval.zanella@linaro.org> References: <20211216194222.186992-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" 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 - -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 -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 - -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 . */ -#include - -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 - -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 . */ -#include #include -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 - -/* 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 . */ -#include - - -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 . */ -#include #include - -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 -#include #include -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 - -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 . */ -#include - -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 - -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 . */ -#include /* 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 #include /* 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 - -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 - -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 . */ -#include - - -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 /* For tcbhead_t. */ #include /* 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 (); \ From patchwork Thu Dec 16 19:42:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 49023 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7B0473858435 for ; Thu, 16 Dec 2021 19:45:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7B0473858435 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1639683901; bh=oAcPF38qMYtsXpBd4EJc9NVHUR0LJV7l2qnN6TP4XBM=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=SH8zFWEDeesEmeZh+4r1XRlV8xIhblhGxXv7qeEDDTSM+XUuXdqCqvkYBg8l3UBli ZdqeZsqsKpc+9icFcXDkfK6nR6wbeJYah8Ya4OR2h/LkwmNWfyhlJk35rjfjGRxsim NbHX4hpXopgBx+D2MFC1gy5xjNXckfXqjrIQr0WU= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qv1-xf2f.google.com (mail-qv1-xf2f.google.com [IPv6:2607:f8b0:4864:20::f2f]) by sourceware.org (Postfix) with ESMTPS id A05813858418 for ; Thu, 16 Dec 2021 19:42:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A05813858418 Received: by mail-qv1-xf2f.google.com with SMTP id ke6so314468qvb.1 for ; Thu, 16 Dec 2021 11:42:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oAcPF38qMYtsXpBd4EJc9NVHUR0LJV7l2qnN6TP4XBM=; b=q9Lwqeu8lWRjQvjaTSHWVrWUWFRM9lYwN74dtXhtiqKnaIgSOXMi27eWX6TtiCOor/ Yq7khyHxPgOBPAKrWS3fmY6M1FbkUh717zTIB5+naxUCQMZrDxQ6IhJ1XXy3SLqSoBKS CZXEOSK6TJkTaNQR2lr4uumDrgGqWJpDkqY5h0qy2khcCj5PZPOaAzHK7IYiTWlAcH79 FeaDGmAeDWRLNy1o2y0yY4oDTbbTVRqJiNMltYzrCFqYPtF9yA5NePdbFqxm5jzIaee/ teIb5LWEko6ZURsQVewxJIXUrQgQ5KMIkKOneMW9s2dcb31L4asStGs6Frh5xskAJprx 9JNw== X-Gm-Message-State: AOAM533yEhlQsA7uZygmqrUNlO+kph0FT3cLj8/I1JOKum45lrqA6r+E L1B7TZQCfjPOPHV07g9VUERUTZ75qE1/0Q== X-Google-Smtp-Source: ABdhPJw83PpBlXioR3oxL9SMjYTSncF4Ze4L9PlVIe40YfBNbdkJz428Q5/D9s/8WYVYJnNpizJsuA== X-Received: by 2002:a05:6214:1d23:: with SMTP id f3mr16845932qvd.25.1639683752093; Thu, 16 Dec 2021 11:42:32 -0800 (PST) Received: from birita.. ([2804:431:c7ca:103f:96e9:fe91:2aff:a44d]) by smtp.gmail.com with ESMTPSA id br13sm3503836qkb.10.2021.12.16.11.42.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Dec 2021 11:42:31 -0800 (PST) To: libc-alpha@sourceware.org, Stafford Horne Subject: [PATCH 4/5] malloc: Use hp-timing on libmemusage Date: Thu, 16 Dec 2021 16:42:21 -0300 Message-Id: <20211216194222.186992-5-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211216194222.186992-1-adhemerval.zanella@linaro.org> References: <20211216194222.186992-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" 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 #include +#include /* 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 @@ . */ #define GETSP() ({ register uintptr_t stack_ptr asm ("esp"); stack_ptr; }) -#define GETTIME(low,high) asm ("rdtsc" : "=a" (low), "=d" (high)) #include 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 #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 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 @@ . */ #define GETSP() ({ register uintptr_t stack_ptr asm ("rsp"); stack_ptr; }) -#define GETTIME(low,high) asm ("rdtsc" : "=a" (low), "=d" (high)) #include From patchwork Thu Dec 16 19:42:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 49025 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AA7DF3858439 for ; Thu, 16 Dec 2021 19:46:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AA7DF3858439 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1639683991; bh=rQl5Zf10CIgayKywn5wNs+aXwAEYCsdWoLMeMddtKsA=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=rsFf9+/4jiHol4WGoonq/5D8BH4JAKa0FxScLFmhgkO0rFxVkcMuTlP9xL6tYpBrg 5hsglObS9IkoDrjNb6oxY0yJ01cQjeNYreWbwqsOaxyclsfSEfKV5jiHk2EZeRoxmO 6NzedfE3Vfu0ZsuJ6fL4QVgjo/ardno1zNcW5MDo= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qv1-xf33.google.com (mail-qv1-xf33.google.com [IPv6:2607:f8b0:4864:20::f33]) by sourceware.org (Postfix) with ESMTPS id 847A4385843D for ; Thu, 16 Dec 2021 19:42:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 847A4385843D Received: by mail-qv1-xf33.google.com with SMTP id m6so259314qvh.10 for ; Thu, 16 Dec 2021 11:42:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rQl5Zf10CIgayKywn5wNs+aXwAEYCsdWoLMeMddtKsA=; b=wDFEmkR8bT1aQYa8MlFvB/wKFAIdQcfAIz2zr6PyvPaDiOqttwiJboEdHvMdlPvv1W 4S0Gl8jwjesLqdFW1lTKpWBVuRAj0kPPtgoBr+rQRwcZQGf1uf6FGyFd2bThzGifcqbp J8LFAoWjefAIUy/YzEYGiTLicyIOUGqa20mHkw4IpLYGSU3+N+ht05zxQHYPiyEaKEwN gZRaOy3iEfzzSLEAtDcZ7nJ78g/jrSm2D/eyShYyeZ+5zF4W7GXST86vv6OQnAsXlSRS XpwyMBlxznAoy12HQfX404nmgyWwuHPii3cgTEmFKkZSoEqe/mDSXKjzdIrJpYUy0O9b DUNA== X-Gm-Message-State: AOAM532laMhpz/3IqFrjgPDUrZoT7MHvbEwa4rJl4FOhf+C1Y8alD2IZ jcszbFkvL+ICx6uc5d1YmqZfEDp6G7SZRA== X-Google-Smtp-Source: ABdhPJxA0yLNNhED9PLi6UL9PdgoV+pmh0bt6uVfAIkeRj6p5FO6J0+HEJeL7Vnifb+k15eh4ptxLw== X-Received: by 2002:a05:6214:262e:: with SMTP id gv14mr2958312qvb.5.1639683753536; Thu, 16 Dec 2021 11:42:33 -0800 (PST) Received: from birita.. ([2804:431:c7ca:103f:96e9:fe91:2aff:a44d]) by smtp.gmail.com with ESMTPSA id br13sm3503836qkb.10.2021.12.16.11.42.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Dec 2021 11:42:33 -0800 (PST) To: libc-alpha@sourceware.org, Stafford Horne Subject: [PATCH 5/5] malloc: Remove memusage.h Date: Thu, 16 Dec 2021 16:42:22 -0300 Message-Id: <20211216194222.186992-6-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211216194222.186992-1-adhemerval.zanella@linaro.org> References: <20211216194222.186992-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" 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 #include -#include #include +#include +#include /* 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 - . */ - -#define GETSP() ({ register uintptr_t stack_ptr asm ("sp"); stack_ptr; }) - -#include 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 - . */ - -#define GETSP() ({ register uintptr_t stack_ptr asm ("$30"); stack_ptr; }) - -#include 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 - . */ - -#define GETSP() ({ register uintptr_t stack_ptr asm ("sp"); stack_ptr; }) - -#include 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 - . */ - -#define GETSP() ({ register uintptr_t stack_ptr asm ("sp"); stack_ptr; }) - -#include 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 - . */ - -#define GETSP() ({ register uintptr_t stack_ptr asm ("sp"); stack_ptr; }) - -#include 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 - . */ - -#define GETSP() ({ register uintptr_t stack_ptr asm ("%r30"); stack_ptr; }) -#define STACK_GROWS_UPWARD 1 - -#include 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 - . */ - -#define GETSP() ({ register uintptr_t stack_ptr asm ("esp"); stack_ptr; }) - -#include 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 - . */ - -#define GETSP() ({ register uintptr_t stack_ptr asm ("esp"); stack_ptr; }) - -#include 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 - . */ - -#include - -#define GETSP() ({ register uintptr_t stack_ptr asm ("%r12"); stack_ptr; }) - -#include 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 - . */ - - -#define GETSP() ({ register uintptr_t stack_ptr asm ("%sp"); stack_ptr; }) - -#include 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 - . */ - -#define GETSP() ({ register uintptr_t stack_ptr asm ("r1"); stack_ptr; }) - -#include 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 - . */ - -#define GETSP() ({ register uintptr_t stack_ptr asm ("$29"); stack_ptr; }) - -#include 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 - . */ - -#define GETSP() ({ register uintptr_t stack_ptr asm ("%sp"); stack_ptr; }) - -#include 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 - . */ - -#define GETSP() ({ register uintptr_t stack_ptr asm ("%r1"); stack_ptr; }) - -#include 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 - . */ - -#define GETSP() ({ register uintptr_t stack_ptr asm ("sp"); stack_ptr; }) - -#include 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 - . */ - -#define GETSP() ({ register uintptr_t stack_ptr __asm__ ("15"); stack_ptr; }) - -#include 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 - . */ - -#define GETSP() ({ register uintptr_t stack_ptr asm ("r15"); stack_ptr; }) - -#include 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 - . */ - -#define GETSP() ({ register uintptr_t stack_ptr asm ("%sp"); stack_ptr; }) - -#include 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 . */ +#ifndef _MACHINE_SP_H +#define _MACHINE_SP_H -#include -#include +/* 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 - . */ - -#define GETSP() ({ register uintptr_t stack_ptr asm ("rsp"); stack_ptr; }) - -#include