From patchwork Wed Jun 3 00:04:36 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 136335 X-Patchwork-Delegate: dj@redhat.com Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D99764BA2E2C for ; Wed, 3 Jun 2026 00:08:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D99764BA2E2C Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=aI9k1nsC X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-yw1-x1131.google.com (mail-yw1-x1131.google.com [IPv6:2607:f8b0:4864:20::1131]) by sourceware.org (Postfix) with ESMTPS id 4B7F74BA2E20 for ; Wed, 3 Jun 2026 00:07:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4B7F74BA2E20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4B7F74BA2E20 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::1131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1780445235; cv=none; b=GBVUV4mUjMkSC0voUFb7sgmqnn5tAtWiz8yzViKrve/rS3as/oepeYAImhrYNbDMJ30rG/hF/Lag8Jo/wbnLSa47/x2VrbxnouHBN1hlMwsHqu8+6Iiom0ccd+pdEDAjwRvonfIBXVKxvWcVyuqdkZ72DbsQA+SrroyKcfjTdwo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1780445235; c=relaxed/simple; bh=p0Q6ztW3+cP8oSs2z1t8KNMBCmcHi2TRaTHOQawkwSE=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=QqtwzIm+D/cAlB7WdDyLXNtuVR8KMTexrLRGb5Vf1jd2SMw7oDXpoh89t+XlUWmzbldL6RcRx2JUkC5nGP9d1fOA5x8QHYjnnYDWiCj0c1hsYkRgCRUKYKAOTye5UhBjia0fFXWFNWF5UBmOA8Xvb7MVLt+KD/QQhVCPhC/juCQ= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=aI9k1nsC DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4B7F74BA2E20 Received: by mail-yw1-x1131.google.com with SMTP id 00721157ae682-7dbd25309f7so64305127b3.2 for ; Tue, 02 Jun 2026 17:07:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1780445235; x=1781050035; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oZyaAU0t997oCtxvx70UWvbrioS5de9pe/ta3uQCNGc=; b=aI9k1nsC2nyU9UTe2v6X3THPcvipHuUuEjWhuca/qmY6fJHyKg5xWOIsCuFSbsr6du mUea6I4RBv1wqb9jPFbu0hGe+iPwcKcBDe2pkQgbN7jAAqbreC+kQg+b7Keu5DUx67aw lDlkxjpPFg7d+QFL/XVgDX0vpexNZ2dfVNB6/QNUhC7XwnAGUQb5qTNBq+Ts1I4Hl5oK xVU4UU0alITGD5CCUIt11iXD7eRd3J1yifypuDWHvHWUigWDXmskIji20bPx3SgfpDJs kogYkhc+wO4EnYhv06XdheDgKiB3Mh3mXmGho2LKutIfxbGw7zaYwlYW3nFf2RdZ92tm bK+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780445235; x=1781050035; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=oZyaAU0t997oCtxvx70UWvbrioS5de9pe/ta3uQCNGc=; b=j5WUSQgQk3pg1gEygRu/qwVULbLNRgT92l05GfSOjpeaUwfIJ0JfCJDRCcoE7cecta oY+n70wtk9AavxH2SIVmfCjPcv73fXoO67pIo5uonMskot11iV2+6MY5Si14MdMjGuCB dQSJeq2DEz/dy7qHREzJhBfgNWOs0cGR1zw1H2g7pRXfKChVWZ8LfnI9FhPVykA4eItc nCAFhPQKwsC2xy7bQX3btT6ZicJJqjMCtzdlNsIpKtLvRWbsEIq9JpxrhBlPC9x0s8Kf KPgBPCbpDXk52Uj7Ax9Ff2SCKvn5y4DUElMsL0vZhLt8CDOIl2jKYylTwCXLHV5FYghk sWvw== X-Gm-Message-State: AOJu0Yz2+RwfqG7WH246e6M8R7pTQM8z57nW54TRfl2WwNJZOtGEKa73 Ig4zQ0JbCXN/qtHxbm4ODyj7Mb5pQl4G+r1FuB6opdNDLPkHHTQO3KKghOYvM9BFo+KBCoB/J90 Wol/x X-Gm-Gg: Acq92OH+7eSIuhiTTEySb30mLmS8mma7Vra+SGouX5rgkGAW2+pSEHJ7rZvjlikBp5Y L0pCrqoay32zobUYNwCm//DFgfaVHLKaoIOP/a8vbgf5YlbMEuGDYZpFZwk9zMsqnEE/cJBfqe0 sqj5rSbHcxgTJzWBO7enWf4xYXCOPWKNXeXsoC0PwOpDUo4GFTuna7NZNstHdnDJoG2I8+7q09q SQWwt5lsJIbdwUWqERtDdPQCRX/y5rPUZM21+iGfKmecfggAB8pm33e2oZ0u9Ph4fidylkwefwr A3FCeUVFlN/qFPih6f5LU8pVbeat3rzR7OOEtTqo2ZvHXjeg6xoaN9cZBBGmaiaUCavDfvLV52V VqcFwHsaf37VlbKOcRPavIpq5CcBm2/ejxbA5miePeqxz2wpKj7ZBfK2sbfE1rgW22u9es6gL6x iXuoFOOqHiO6ouG12Ft5VsmoECRmCV6Kbap4SNLiu4aUgmgIMqQCHjD5Zc X-Received: by 2002:a05:690c:600f:b0:7ba:f690:70be with SMTP id 00721157ae682-7ea49872b63mr12081247b3.7.1780445234291; Tue, 02 Jun 2026 17:07:14 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c2:efc6:8f41:550d:2b14:9278]) by smtp.gmail.com with ESMTPSA id 00721157ae682-7ea23a9946bsm7332207b3.37.2026.06.02.17.07.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jun 2026 17:07:13 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: Anderson Nascimento , Carlos O'Donell Subject: [PATCH 5/8] Consolidate the C pointer guard implementation into the generic header Date: Tue, 2 Jun 2026 21:04:36 -0300 Message-ID: <20260603000656.3287796-6-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260603000656.3287796-1-adhemerval.zanella@linaro.org> References: <20260603000656.3287796-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_BLOCKED, SPF_HELO_NONE, SPF_PASS, TXREP, URIBL_BLOCKED shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org All the per-architecture pointer_guard.h files implemented the same C PTR_MANGLE/PTR_DEMANGLE (an exclusive-or by the guard followed by a rotate) and only differed in the assembly macros, which now live in the separate pointer_guard-asm.h headers. Remove the redundant per-arch C headers and keep a single implementation in sysdeps/generic/pointer_guard.h, which includes for the assembly definitions. The i386 and x86_64 assembly headers do not depend on the Linux ABI, so move them out of sysdeps/unix/sysv/linux into the generic per-arch directories alongside the other targets. Checked with builds for all supported ABIs. Reviewed-by: DJ Delorie --- sysdeps/arm/pointer_guard.h | 40 ------------ sysdeps/generic/pointer_guard.h | 28 +++++++- .../sysv/linux => }/i386/pointer_guard-asm.h | 0 .../unix/sysv/linux/aarch64/pointer_guard.h | 41 ------------ sysdeps/unix/sysv/linux/alpha/pointer_guard.h | 40 ------------ sysdeps/unix/sysv/linux/csky/pointer_guard.h | 40 ------------ sysdeps/unix/sysv/linux/i386/pointer_guard.h | 48 -------------- .../unix/sysv/linux/loongarch/pointer_guard.h | 41 ------------ .../unix/sysv/linux/powerpc/pointer_guard.h | 38 ----------- sysdeps/unix/sysv/linux/s390/pointer_guard.h | 38 ----------- sysdeps/unix/sysv/linux/sh/pointer_guard.h | 38 ----------- .../sysv/linux/sparc/sparc32/pointer_guard.h | 38 ----------- .../sysv/linux/sparc/sparc64/pointer_guard.h | 38 ----------- .../unix/sysv/linux/x86_64/pointer_guard.h | 64 ------------------- .../linux => }/x86_64/pointer_guard-asm.h | 0 15 files changed, 25 insertions(+), 507 deletions(-) delete mode 100644 sysdeps/arm/pointer_guard.h rename sysdeps/{unix/sysv/linux => }/i386/pointer_guard-asm.h (100%) delete mode 100644 sysdeps/unix/sysv/linux/aarch64/pointer_guard.h delete mode 100644 sysdeps/unix/sysv/linux/alpha/pointer_guard.h delete mode 100644 sysdeps/unix/sysv/linux/csky/pointer_guard.h delete mode 100644 sysdeps/unix/sysv/linux/i386/pointer_guard.h delete mode 100644 sysdeps/unix/sysv/linux/loongarch/pointer_guard.h delete mode 100644 sysdeps/unix/sysv/linux/powerpc/pointer_guard.h delete mode 100644 sysdeps/unix/sysv/linux/s390/pointer_guard.h delete mode 100644 sysdeps/unix/sysv/linux/sh/pointer_guard.h delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc32/pointer_guard.h delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/pointer_guard.h delete mode 100644 sysdeps/unix/sysv/linux/x86_64/pointer_guard.h rename sysdeps/{unix/sysv/linux => }/x86_64/pointer_guard-asm.h (100%) diff --git a/sysdeps/arm/pointer_guard.h b/sysdeps/arm/pointer_guard.h deleted file mode 100644 index 9fa25c708a9..00000000000 --- a/sysdeps/arm/pointer_guard.h +++ /dev/null @@ -1,40 +0,0 @@ -/* Pointer guard implementation. Arm version. - Copyright (C) 2013-2026 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 - . */ - -#ifndef POINTER_GUARD_H -#define POINTER_GUARD_H - -#include - -#ifndef __ASSEMBLER__ -# if (IS_IN (rtld) \ - || (!defined SHARED && (IS_IN (libc) || IS_IN (libpthread)))) -extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden; -# define PTR_MANGLE(var) \ - (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local) -# define PTR_DEMANGLE(var) PTR_MANGLE (var) -# else -# include -extern uintptr_t __pointer_chk_guard attribute_relro; -# define PTR_MANGLE(var) \ - (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard) -# define PTR_DEMANGLE(var) PTR_MANGLE (var) -# endif -#endif - -#endif /* POINTER_GUARD_H */ diff --git a/sysdeps/generic/pointer_guard.h b/sysdeps/generic/pointer_guard.h index 49eb5ca4ba2..aee84c1fa4e 100644 --- a/sysdeps/generic/pointer_guard.h +++ b/sysdeps/generic/pointer_guard.h @@ -1,4 +1,4 @@ -/* Pointer obfuscation implenentation. Generic (no-op) version. +/* Pointer obfuscation implenentation. Generic version. Copyright (C) 2022-2026 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -22,8 +22,30 @@ #include #ifndef __ASSEMBLER__ -# define PTR_MANGLE(x) (void) (x) -# define PTR_DEMANGLE(x) (void) (x) +# include +# include + +# if (IS_IN (rtld) \ + || (!defined SHARED && (IS_IN (libc) || IS_IN (libpthread)))) +extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden; +# define PTR_GUARD_VALUE __pointer_chk_guard_local +# else +extern uintptr_t __pointer_chk_guard attribute_relro; +# define PTR_GUARD_VALUE __pointer_chk_guard +# endif + +# define PTR_MANGLE(var) \ + do { \ + (var) = (__typeof (var)) ((uintptr_t) (var) ^ PTR_GUARD_VALUE); \ + (var) = (__typeof (var)) stdc_rotate_left ((uintptr_t) (var), \ + 2 * sizeof (uintptr_t) + 1); \ + } while (0) +# define PTR_DEMANGLE(var) \ + do { \ + (var) = (__typeof (var)) stdc_rotate_right ((uintptr_t) (var), \ + 2 * sizeof (uintptr_t) + 1); \ + (var) = (__typeof (var)) ((uintptr_t) (var) ^ PTR_GUARD_VALUE); \ + } while (0) #endif #endif /* POINTER_GUARD_H */ diff --git a/sysdeps/unix/sysv/linux/i386/pointer_guard-asm.h b/sysdeps/i386/pointer_guard-asm.h similarity index 100% rename from sysdeps/unix/sysv/linux/i386/pointer_guard-asm.h rename to sysdeps/i386/pointer_guard-asm.h diff --git a/sysdeps/unix/sysv/linux/aarch64/pointer_guard.h b/sysdeps/unix/sysv/linux/aarch64/pointer_guard.h deleted file mode 100644 index 7b7d8b0b714..00000000000 --- a/sysdeps/unix/sysv/linux/aarch64/pointer_guard.h +++ /dev/null @@ -1,41 +0,0 @@ -/* Pointer guard implementation. AArch64 version. - Copyright (C) 2014-2026 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 - . */ - -#ifndef POINTER_GUARD_H -#define POINTER_GUARD_H - -#include - -#ifndef __ASSEMBLER__ -# if (IS_IN (rtld) \ - || (!defined SHARED && (IS_IN (libc) \ - || IS_IN (libpthread)))) -extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden; -# define PTR_MANGLE(var) \ - (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local) -# define PTR_DEMANGLE(var) PTR_MANGLE (var) -# else -# include -extern uintptr_t __pointer_chk_guard attribute_relro; -# define PTR_MANGLE(var) \ - (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard) -# define PTR_DEMANGLE(var) PTR_MANGLE (var) -# endif -#endif - -#endif /* POINTER_GUARD_H */ diff --git a/sysdeps/unix/sysv/linux/alpha/pointer_guard.h b/sysdeps/unix/sysv/linux/alpha/pointer_guard.h deleted file mode 100644 index 0741bf7a183..00000000000 --- a/sysdeps/unix/sysv/linux/alpha/pointer_guard.h +++ /dev/null @@ -1,40 +0,0 @@ -/* Pointer guard implementation. Alpha version. - Copyright (C) 2006-2026 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 - . */ - -#ifndef POINTER_GUARD_H -#define POINTER_GUARD_H - -#include - -#ifndef __ASSEMBLER__ -# include -# if (IS_IN (rtld) \ - || (!defined SHARED && (IS_IN (libc) \ - || IS_IN (libpthread)))) -extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden; -# define PTR_MANGLE(var) \ - (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local) -# else -extern uintptr_t __pointer_chk_guard attribute_relro; -# define PTR_MANGLE(var) \ - (var) = (__typeof(var)) ((uintptr_t) (var) ^ __pointer_chk_guard) -# endif -# define PTR_DEMANGLE(var) PTR_MANGLE(var) -#endif /* ASSEMBLER */ - -#endif /* POINTER_GUARD_H */ diff --git a/sysdeps/unix/sysv/linux/csky/pointer_guard.h b/sysdeps/unix/sysv/linux/csky/pointer_guard.h deleted file mode 100644 index 2aa044bdc42..00000000000 --- a/sysdeps/unix/sysv/linux/csky/pointer_guard.h +++ /dev/null @@ -1,40 +0,0 @@ -/* Pointer obfuscation implenentation. C-SKY version. - Copyright (C) 2022-2026 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 - . */ - -#ifndef POINTER_GUARD_H -#define POINTER_GUARD_H - -#include - -#ifndef __ASSEMBLER__ -# if (IS_IN (rtld) \ - || (!defined SHARED && (IS_IN (libc) || IS_IN (libpthread)))) -extern uintptr_t __pointer_chk_guard_local; -# define PTR_MANGLE(var) \ - (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local) -# define PTR_DEMANGLE(var) PTR_MANGLE (var) -# else -# include -extern uintptr_t __pointer_chk_guard; -# define PTR_MANGLE(var) \ - (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard) -# define PTR_DEMANGLE(var) PTR_MANGLE (var) -# endif -#endif - -#endif /* POINTER_GUARD_H */ diff --git a/sysdeps/unix/sysv/linux/i386/pointer_guard.h b/sysdeps/unix/sysv/linux/i386/pointer_guard.h deleted file mode 100644 index 7776c282d81..00000000000 --- a/sysdeps/unix/sysv/linux/i386/pointer_guard.h +++ /dev/null @@ -1,48 +0,0 @@ -/* Pointer obfuscation implenentation. i386 version. - Copyright (C) 2005-2026 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 - . */ - -#ifndef POINTER_GUARD_H -#define POINTER_GUARD_H - -#include - -#ifndef __ASSEMBLER__ -# include -# include -# if IS_IN (rtld) || !defined SHARED -extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden; -# define PTR_GUARD_VALUE __pointer_chk_guard_local -# else -extern uintptr_t __pointer_chk_guard attribute_relro; -# define PTR_GUARD_VALUE __pointer_chk_guard -# endif -# define PTR_MANGLE(var) \ - do { \ - (var) = (__typeof (var)) ((uintptr_t) (var) ^ PTR_GUARD_VALUE); \ - (var) = (__typeof (var)) stdc_rotate_left ((uintptr_t) (var), \ - 2 * sizeof (uintptr_t) + 1); \ - } while (0) -# define PTR_DEMANGLE(var) \ - do { \ - (var) = (__typeof (var)) stdc_rotate_right ((uintptr_t) (var), \ - 2 * sizeof (uintptr_t) + 1); \ - (var) = (__typeof (var)) ((uintptr_t) (var) ^ PTR_GUARD_VALUE); \ - } while (0) -#endif - -#endif /* POINTER_GUARD_H */ diff --git a/sysdeps/unix/sysv/linux/loongarch/pointer_guard.h b/sysdeps/unix/sysv/linux/loongarch/pointer_guard.h deleted file mode 100644 index c080bdd0a9d..00000000000 --- a/sysdeps/unix/sysv/linux/loongarch/pointer_guard.h +++ /dev/null @@ -1,41 +0,0 @@ -/* Pointer obfuscation implenentation. LoongArch version. - Copyright (C) 2022-2026 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 - . */ - -#ifndef POINTER_GUARD_H -#define POINTER_GUARD_H - -#include - -#ifndef __ASSEMBLER__ -# include -# if (IS_IN (rtld) \ - || (!defined SHARED && (IS_IN (libc) \ - || IS_IN (libpthread)))) -extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden; -# define PTR_MANGLE(var) \ - (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local) -# define PTR_DEMANGLE(var) PTR_MANGLE (var) -# else -extern uintptr_t __pointer_chk_guard attribute_relro; -# define PTR_MANGLE(var) \ - (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard) -# define PTR_DEMANGLE(var) PTR_MANGLE (var) -# endif -#endif - -#endif /* POINTER_GUARD_H */ diff --git a/sysdeps/unix/sysv/linux/powerpc/pointer_guard.h b/sysdeps/unix/sysv/linux/powerpc/pointer_guard.h deleted file mode 100644 index 51f588ec11c..00000000000 --- a/sysdeps/unix/sysv/linux/powerpc/pointer_guard.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Pointer obfuscation implenentation. PowerPC version. - Copyright (C) 2005-2026 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 - . */ - -#ifndef POINTER_GUARD_H -#define POINTER_GUARD_H - -#include - -#ifndef __ASSEMBLER__ -# include -# if IS_IN (rtld) || !defined SHARED -extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden; -# define PTR_MANGLE(var) \ - (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local) -# else -extern uintptr_t __pointer_chk_guard attribute_relro; -# define PTR_MANGLE(var) \ - (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard) -# endif -# define PTR_DEMANGLE(var) PTR_MANGLE (var) -#endif - -#endif /* POINTER_GUARD_H */ diff --git a/sysdeps/unix/sysv/linux/s390/pointer_guard.h b/sysdeps/unix/sysv/linux/s390/pointer_guard.h deleted file mode 100644 index 403eff63282..00000000000 --- a/sysdeps/unix/sysv/linux/s390/pointer_guard.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Pointer obfuscation implenentation. s390x version. - Copyright (C) 2005-2026 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 - . */ - -#ifndef POINTER_GUARD_H -#define POINTER_GUARD_H - -#include - -#ifndef __ASSEMBLER__ -# include -# if IS_IN (rtld) || !defined SHARED -extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden; -# define PTR_GUARD_VALUE __pointer_chk_guard_local -# else -extern uintptr_t __pointer_chk_guard attribute_relro; -# define PTR_GUARD_VALUE __pointer_chk_guard -# endif -# define PTR_MANGLE(var) \ - (var) = (void *) ((uintptr_t) (var) ^ PTR_GUARD_VALUE) -# define PTR_DEMANGLE(var) PTR_MANGLE (var) -#endif - -#endif /* POINTER_GUARD_H */ diff --git a/sysdeps/unix/sysv/linux/sh/pointer_guard.h b/sysdeps/unix/sysv/linux/sh/pointer_guard.h deleted file mode 100644 index 42340faca83..00000000000 --- a/sysdeps/unix/sysv/linux/sh/pointer_guard.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Pointer obfuscation implenentation. SH version. - Copyright (C) 2005-2026 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 - . */ - -#ifndef POINTER_GUARD_H -#define POINTER_GUARD_H - -#include - -#ifndef __ASSEMBLER__ -# include -# if IS_IN (rtld) || !defined SHARED -extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden; -# define PTR_MANGLE(var) \ - (var) = (void *) ((uintptr_t) (var) ^ __pointer_chk_guard_local) -# else -extern uintptr_t __pointer_chk_guard attribute_relro; -# define PTR_MANGLE(var) \ - (var) = (void *) ((uintptr_t) (var) ^ __pointer_chk_guard) -# endif -# define PTR_DEMANGLE(var) PTR_MANGLE (var) -#endif - -#endif /* POINTER_GUARD_H */ diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/pointer_guard.h b/sysdeps/unix/sysv/linux/sparc/sparc32/pointer_guard.h deleted file mode 100644 index 86d3fbb7d27..00000000000 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/pointer_guard.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Pointer obfuscation implenentation. 32-bit SPARC version. - Copyright (C) 2006-2026 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 - . */ - -#ifndef POINTER_GUARD_H -#define POINTER_GUARD_H - -#include - -#ifndef __ASSEMBLER__ -# include -# if IS_IN (rtld) || !defined SHARED -extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden; -# define PTR_MANGLE(var) \ - (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local) -# else -extern uintptr_t __pointer_chk_guard attribute_relro; -# define PTR_MANGLE(var) \ - (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard) -# endif -# define PTR_DEMANGLE(var) PTR_MANGLE (var) -#endif - -#endif /* POINTER_GUARD_H */ diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/pointer_guard.h b/sysdeps/unix/sysv/linux/sparc/sparc64/pointer_guard.h deleted file mode 100644 index fc0a723905e..00000000000 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/pointer_guard.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Pointer obfuscation implenentation. 64-bit SPARC version. - Copyright (C) 2006-2026 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 - . */ - -#ifndef POINTER_GUARD_H -#define POINTER_GUARD_H - -#include - -#ifndef __ASSEMBLER__ -# include -# if IS_IN (rtld) || !defined SHARED -extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden; -# define PTR_MANGLE(var) \ - (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local) -# else -extern uintptr_t __pointer_chk_guard attribute_relro; -# define PTR_MANGLE(var) \ - (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard) -# endif -# define PTR_DEMANGLE(var) PTR_MANGLE (var) -#endif - -#endif /* POINTER_GUARD_H */ diff --git a/sysdeps/unix/sysv/linux/x86_64/pointer_guard.h b/sysdeps/unix/sysv/linux/x86_64/pointer_guard.h deleted file mode 100644 index dd3a9752b2a..00000000000 --- a/sysdeps/unix/sysv/linux/x86_64/pointer_guard.h +++ /dev/null @@ -1,64 +0,0 @@ -/* Pointer obfuscation implenentation. x86-64 version. - Copyright (C) 2005-2026 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 - . */ - -#ifndef POINTER_GUARD_H -#define POINTER_GUARD_H - -#include - -#ifndef __ASSEMBLER__ -# include -# include - -# if (IS_IN (rtld) \ - || (!defined SHARED && (IS_IN (libc) || IS_IN (libpthread)))) -extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden; -# define PTR_MANGLE(var) \ - do { \ - (var) = (__typeof (var)) ((uintptr_t) (var) \ - ^ __pointer_chk_guard_local); \ - (var) = (__typeof (var)) stdc_rotate_left ((uintptr_t) (var), \ - 2 * sizeof (uintptr_t) + 1); \ - } while (0) -# define PTR_DEMANGLE(var) \ - do { \ - (var) = (__typeof (var)) stdc_rotate_right ((uintptr_t) (var), \ - 2 * sizeof (uintptr_t) + 1); \ - (var) = (__typeof (var)) ((uintptr_t) (var) \ - ^ __pointer_chk_guard_local); \ - } while (0) -# else -extern uintptr_t __pointer_chk_guard attribute_relro; -# define PTR_MANGLE(var) \ - do { \ - (var) = (__typeof (var)) ((uintptr_t) (var) \ - ^ __pointer_chk_guard); \ - (var) = (__typeof (var)) stdc_rotate_left ((uintptr_t) (var), \ - 2 * sizeof (uintptr_t) + 1); \ - } while (0) -# define PTR_DEMANGLE(var) \ - do { \ - (var) = (__typeof (var)) stdc_rotate_right ((uintptr_t) (var), \ - 2 * sizeof (uintptr_t) + 1); \ - (var) = (__typeof (var)) ((uintptr_t) (var) \ - ^ __pointer_chk_guard); \ - } while (0) -# endif -#endif - -#endif /* POINTER_GUARD_H */ diff --git a/sysdeps/unix/sysv/linux/x86_64/pointer_guard-asm.h b/sysdeps/x86_64/pointer_guard-asm.h similarity index 100% rename from sysdeps/unix/sysv/linux/x86_64/pointer_guard-asm.h rename to sysdeps/x86_64/pointer_guard-asm.h