[PATCH 5/8] Consolidate the C pointer guard implementation into the generic header
Adhemerval Zanella
adhemerval.zanella@linaro.org
Wed Jun 3 00:04:36 GMT 2026
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 <pointer_guard-asm.h> 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.
---
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
- <https://www.gnu.org/licenses/>. */
-
-#ifndef POINTER_GUARD_H
-#define POINTER_GUARD_H
-
-#include <pointer_guard-asm.h>
-
-#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 <stdint.h>
-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 <pointer_guard-asm.h>
#ifndef __ASSEMBLER__
-# define PTR_MANGLE(x) (void) (x)
-# define PTR_DEMANGLE(x) (void) (x)
+# include <stdbit.h>
+# include <stdint.h>
+
+# 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
- <https://www.gnu.org/licenses/>. */
-
-#ifndef POINTER_GUARD_H
-#define POINTER_GUARD_H
-
-#include <pointer_guard-asm.h>
-
-#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 <stdint.h>
-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
- <https://www.gnu.org/licenses/>. */
-
-#ifndef POINTER_GUARD_H
-#define POINTER_GUARD_H
-
-#include <pointer_guard-asm.h>
-
-#ifndef __ASSEMBLER__
-# include <stdint.h>
-# 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
- <https://www.gnu.org/licenses/>. */
-
-#ifndef POINTER_GUARD_H
-#define POINTER_GUARD_H
-
-#include <pointer_guard-asm.h>
-
-#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 <stdint.h>
-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
- <https://www.gnu.org/licenses/>. */
-
-#ifndef POINTER_GUARD_H
-#define POINTER_GUARD_H
-
-#include <pointer_guard-asm.h>
-
-#ifndef __ASSEMBLER__
-# include <stdbit.h>
-# include <stdint.h>
-# 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
- <https://www.gnu.org/licenses/>. */
-
-#ifndef POINTER_GUARD_H
-#define POINTER_GUARD_H
-
-#include <pointer_guard-asm.h>
-
-#ifndef __ASSEMBLER__
-# include <stdint.h>
-# 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
- <https://www.gnu.org/licenses/>. */
-
-#ifndef POINTER_GUARD_H
-#define POINTER_GUARD_H
-
-#include <pointer_guard-asm.h>
-
-#ifndef __ASSEMBLER__
-# include <stdint.h>
-# 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
- <https://www.gnu.org/licenses/>. */
-
-#ifndef POINTER_GUARD_H
-#define POINTER_GUARD_H
-
-#include <pointer_guard-asm.h>
-
-#ifndef __ASSEMBLER__
-# include <stdint.h>
-# 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
- <https://www.gnu.org/licenses/>. */
-
-#ifndef POINTER_GUARD_H
-#define POINTER_GUARD_H
-
-#include <pointer_guard-asm.h>
-
-#ifndef __ASSEMBLER__
-# include <stdint.h>
-# 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
- <https://www.gnu.org/licenses/>. */
-
-#ifndef POINTER_GUARD_H
-#define POINTER_GUARD_H
-
-#include <pointer_guard-asm.h>
-
-#ifndef __ASSEMBLER__
-# include <stdint.h>
-# 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
- <https://www.gnu.org/licenses/>. */
-
-#ifndef POINTER_GUARD_H
-#define POINTER_GUARD_H
-
-#include <pointer_guard-asm.h>
-
-#ifndef __ASSEMBLER__
-# include <stdint.h>
-# 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
- <https://www.gnu.org/licenses/>. */
-
-#ifndef POINTER_GUARD_H
-#define POINTER_GUARD_H
-
-#include <pointer_guard-asm.h>
-
-#ifndef __ASSEMBLER__
-# include <stdbit.h>
-# include <stdint.h>
-
-# 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
--
2.43.0
More information about the Libc-alpha
mailing list