summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2022-10-18 17:00:07 +0200
committerFlorian Weimer <fweimer@redhat.com>2022-10-18 17:04:10 +0200
commit58548b9d689fb9bba67bdc5b59c8d2fa47f4f8ec (patch)
tree0aea307f4cf761952fbdf15fd67fc3b09b43707c /sysdeps
parent88f4b6929c26f9240a4b0b7dcc62922f02544a09 (diff)
downloadglibc-58548b9d689fb9bba67bdc5b59c8d2fa47f4f8ec.tar.gz
glibc-58548b9d689fb9bba67bdc5b59c8d2fa47f4f8ec.tar.xz
glibc-58548b9d689fb9bba67bdc5b59c8d2fa47f4f8ec.zip
Use PTR_MANGLE and PTR_DEMANGLE unconditionally in C sources
In the future, this will result in a compilation failure if the
macros are unexpectedly undefined (due to header inclusion ordering
or header inclusion missing altogether).

Assembler sources are more difficult to convert.  In many cases,
they are hand-optimized for the mangling and no-mangling variants,
which is why they are not converted.

sysdeps/s390/s390-32/__longjmp.c and sysdeps/s390/s390-64/__longjmp.c
are special: These are C sources, but most of the implementation is
in assembler, so the PTR_DEMANGLE macro has to be undefined in some
cases, to match the assembler style.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/aarch64/jmpbuf-offsets.h2
-rw-r--r--sysdeps/alpha/jmpbuf-unwind.h2
-rw-r--r--sysdeps/arc/jmpbuf-unwind.h2
-rw-r--r--sysdeps/arm/jmpbuf-unwind.h2
-rw-r--r--sysdeps/csky/jmpbuf-unwind.h2
-rw-r--r--sysdeps/generic/unwind-link.h6
-rw-r--r--sysdeps/i386/jmpbuf-unwind.h2
-rw-r--r--sysdeps/i386/unwind-arch.h6
-rw-r--r--sysdeps/loongarch/jmpbuf-unwind.h2
-rw-r--r--sysdeps/m68k/jmpbuf-unwind.h2
-rw-r--r--sysdeps/mach/hurd/jmp-unwind.c2
-rw-r--r--sysdeps/microblaze/jmpbuf-unwind.h2
-rw-r--r--sysdeps/mips/jmpbuf-unwind.h2
-rw-r--r--sysdeps/nios2/jmpbuf-offsets.h2
-rw-r--r--sysdeps/powerpc/jmpbuf-unwind.h2
-rw-r--r--sysdeps/riscv/jmpbuf-unwind.h2
-rw-r--r--sysdeps/s390/jmpbuf-unwind.h2
-rw-r--r--sysdeps/s390/s390-32/__longjmp.c5
-rw-r--r--sysdeps/s390/s390-64/__longjmp.c5
-rw-r--r--sysdeps/sh/jmpbuf-unwind.h2
-rw-r--r--sysdeps/sparc/sparc32/jmpbuf-unwind.h2
-rw-r--r--sysdeps/x86_64/jmpbuf-unwind.h2
22 files changed, 12 insertions, 46 deletions
diff --git a/sysdeps/aarch64/jmpbuf-offsets.h b/sysdeps/aarch64/jmpbuf-offsets.h
index 78bdd4a539..841da965a6 100644
--- a/sysdeps/aarch64/jmpbuf-offsets.h
+++ b/sysdeps/aarch64/jmpbuf-offsets.h
@@ -49,9 +49,7 @@ static inline uintptr_t __attribute__ ((unused))
 _jmpbuf_sp (__jmp_buf jmpbuf)
 {
   uintptr_t sp = jmpbuf[JB_SP];
-#ifdef PTR_DEMANGLE
   PTR_DEMANGLE (sp);
-#endif
   return sp;
 }
 #endif
diff --git a/sysdeps/alpha/jmpbuf-unwind.h b/sysdeps/alpha/jmpbuf-unwind.h
index 318b73b100..05a0dc9cba 100644
--- a/sysdeps/alpha/jmpbuf-unwind.h
+++ b/sysdeps/alpha/jmpbuf-unwind.h
@@ -34,9 +34,7 @@ static inline uintptr_t __attribute__ ((unused))
 _jmpbuf_sp (__jmp_buf regs)
 {
   uintptr_t sp = regs[JB_SP];
-#ifdef PTR_DEMANGLE
   PTR_DEMANGLE (sp);
-#endif
   return sp;
 }
 
diff --git a/sysdeps/arc/jmpbuf-unwind.h b/sysdeps/arc/jmpbuf-unwind.h
index e5434a95dd..2eadc5d22f 100644
--- a/sysdeps/arc/jmpbuf-unwind.h
+++ b/sysdeps/arc/jmpbuf-unwind.h
@@ -35,9 +35,7 @@ static inline uintptr_t __attribute__ ((unused))
 _jmpbuf_sp (__jmp_buf jmpbuf)
 {
   uintptr_t sp = jmpbuf[JB_SP];
-#ifdef PTR_DEMANGLE
   PTR_DEMANGLE (sp);
-#endif
   return sp;
 }
 
diff --git a/sysdeps/arm/jmpbuf-unwind.h b/sysdeps/arm/jmpbuf-unwind.h
index 641444eaf3..be99b4f9be 100644
--- a/sysdeps/arm/jmpbuf-unwind.h
+++ b/sysdeps/arm/jmpbuf-unwind.h
@@ -33,9 +33,7 @@ static inline uintptr_t __attribute__ ((unused))
 _jmpbuf_sp (__jmp_buf regs)
 {
   uintptr_t sp = regs[__JMP_BUF_SP];
-#ifdef PTR_DEMANGLE
   PTR_DEMANGLE (sp);
-#endif
   return sp;
 }
 
diff --git a/sysdeps/csky/jmpbuf-unwind.h b/sysdeps/csky/jmpbuf-unwind.h
index 76fca431c6..61e9c45875 100644
--- a/sysdeps/csky/jmpbuf-unwind.h
+++ b/sysdeps/csky/jmpbuf-unwind.h
@@ -36,9 +36,7 @@ static inline uintptr_t __attribute__ ((unused))
 _jmpbuf_sp (__jmp_buf regs)
 {
   uintptr_t sp = (uintptr_t) regs[0].__sp;
-#ifdef PTR_DEMANGLE
   PTR_DEMANGLE (sp);
-#endif
   return sp;
 }
 
diff --git a/sysdeps/generic/unwind-link.h b/sysdeps/generic/unwind-link.h
index a2076a23bf..ea031a04d0 100644
--- a/sysdeps/generic/unwind-link.h
+++ b/sysdeps/generic/unwind-link.h
@@ -61,16 +61,12 @@ libc_hidden_proto (__libc_unwind_link_get)
 /* UNWIND_LINK_PTR returns the stored function pointer NAME from the
    cached unwind link OBJ (which was previously returned by
    __libc_unwind_link_get).  */
-# ifdef PTR_DEMANGLE
-#  define UNWIND_LINK_PTR(obj, name, ...)                          \
+# define UNWIND_LINK_PTR(obj, name, ...)                             \
   ({                                                                \
     __typeof ((obj)->ptr_##name) __unwind_fptr = (obj)->ptr_##name; \
     PTR_DEMANGLE (__unwind_fptr);                                   \
     __unwind_fptr;                                                  \
   })
-# else /* !PTR_DEMANGLE */
-#  define UNWIND_LINK_PTR(obj, name, ...) ((obj)->ptr_##name)
-# endif
 
 /* Called from fork, in the new subprocess.  */
 void __libc_unwind_link_after_fork (void);
diff --git a/sysdeps/i386/jmpbuf-unwind.h b/sysdeps/i386/jmpbuf-unwind.h
index 73d214fd31..25b54f8bb0 100644
--- a/sysdeps/i386/jmpbuf-unwind.h
+++ b/sysdeps/i386/jmpbuf-unwind.h
@@ -34,9 +34,7 @@ static inline uintptr_t __attribute__ ((unused))
 _jmpbuf_sp (__jmp_buf regs)
 {
   uintptr_t sp = regs[JB_SP];
-#ifdef PTR_DEMANGLE
   PTR_DEMANGLE (sp);
-#endif
   return sp;
 }
 
diff --git a/sysdeps/i386/unwind-arch.h b/sysdeps/i386/unwind-arch.h
index ae23469d3f..bb2e878dd0 100644
--- a/sysdeps/i386/unwind-arch.h
+++ b/sysdeps/i386/unwind-arch.h
@@ -28,12 +28,8 @@
   local.ptr__Unwind_GetGR                                   \
     = __libc_dlsym (local_libgcc_handle, "_Unwind_GetGR");  \
   assert (local.ptr__Unwind_GetGR != NULL);
-#ifdef PTR_MANGLE
-# define UNWIND_LINK_EXTRA_INIT                 \
+#define UNWIND_LINK_EXTRA_INIT                  \
   UNWIND_LINK_EXTRA_INIT_SHARED                 \
   PTR_MANGLE (local.ptr__Unwind_GetGR);
-#else
-# define UNWIND_LINK_EXTRA_INIT UNWIND_LINK_EXTRA_INIT_SHARED
-#endif
 
 #endif /* _ARCH_UNWIND_LINK_H */
diff --git a/sysdeps/loongarch/jmpbuf-unwind.h b/sysdeps/loongarch/jmpbuf-unwind.h
index 458edec135..bd58dd7cc5 100644
--- a/sysdeps/loongarch/jmpbuf-unwind.h
+++ b/sysdeps/loongarch/jmpbuf-unwind.h
@@ -33,9 +33,7 @@
 static inline uintptr_t __attribute__ ((unused)) _jmpbuf_sp (__jmp_buf regs)
 {
   uintptr_t sp = regs[0].__sp;
-#ifdef PTR_DEMANGLE
   PTR_DEMANGLE (sp);
-#endif
   return sp;
 }
 
diff --git a/sysdeps/m68k/jmpbuf-unwind.h b/sysdeps/m68k/jmpbuf-unwind.h
index 3ee46c050c..baf6f79b88 100644
--- a/sysdeps/m68k/jmpbuf-unwind.h
+++ b/sysdeps/m68k/jmpbuf-unwind.h
@@ -33,9 +33,7 @@ static inline uintptr_t __attribute__ ((unused))
 _jmpbuf_sp (__jmp_buf regs)
 {
   uintptr_t sp = (uintptr_t) regs[0].__sp;
-#ifdef PTR_DEMANGLE
   PTR_DEMANGLE (sp);
-#endif
   return sp;
 }
 
diff --git a/sysdeps/mach/hurd/jmp-unwind.c b/sysdeps/mach/hurd/jmp-unwind.c
index 2577fbf3ee..1ac2815aac 100644
--- a/sysdeps/mach/hurd/jmp-unwind.c
+++ b/sysdeps/mach/hurd/jmp-unwind.c
@@ -31,9 +31,7 @@
 static inline uintptr_t
 demangle_ptr (uintptr_t x)
 {
-# ifdef PTR_DEMANGLE
   PTR_DEMANGLE (x);
-# endif
   return x;
 }
 
diff --git a/sysdeps/microblaze/jmpbuf-unwind.h b/sysdeps/microblaze/jmpbuf-unwind.h
index 302e950ced..79fc493971 100644
--- a/sysdeps/microblaze/jmpbuf-unwind.h
+++ b/sysdeps/microblaze/jmpbuf-unwind.h
@@ -34,9 +34,7 @@ static inline uintptr_t __attribute__ ((unused))
 _jmpbuf_sp (__jmp_buf regs)
 {
   void *sp = (void *) regs[0].__sp;
-#ifdef PTR_DEMANGLE
   PTR_DEMANGLE (sp);
-#endif
   return (uintptr_t) sp;
 }
 
diff --git a/sysdeps/mips/jmpbuf-unwind.h b/sysdeps/mips/jmpbuf-unwind.h
index 28ecffedb0..827000a729 100644
--- a/sysdeps/mips/jmpbuf-unwind.h
+++ b/sysdeps/mips/jmpbuf-unwind.h
@@ -35,9 +35,7 @@ static inline uintptr_t __attribute__ ((unused))
 _jmpbuf_sp (__jmp_buf regs)
 {
   uintptr_t sp = (uintptr_t) regs[0].__sp;
-#ifdef PTR_DEMANGLE
   PTR_DEMANGLE (sp);
-#endif
   return sp;
 }
 
diff --git a/sysdeps/nios2/jmpbuf-offsets.h b/sysdeps/nios2/jmpbuf-offsets.h
index 76fea64ffe..50f938c8cf 100644
--- a/sysdeps/nios2/jmpbuf-offsets.h
+++ b/sysdeps/nios2/jmpbuf-offsets.h
@@ -38,9 +38,7 @@ static inline uintptr_t __attribute__ ((unused))
 _jmpbuf_sp (__jmp_buf jmpbuf)
 {
   uintptr_t sp = jmpbuf[JB_SP];
-#ifdef PTR_DEMANGLE
   PTR_DEMANGLE (sp);
-#endif
   return sp;
 }
 #endif
diff --git a/sysdeps/powerpc/jmpbuf-unwind.h b/sysdeps/powerpc/jmpbuf-unwind.h
index 93573ce238..82499594a3 100644
--- a/sysdeps/powerpc/jmpbuf-unwind.h
+++ b/sysdeps/powerpc/jmpbuf-unwind.h
@@ -34,9 +34,7 @@ static inline uintptr_t __attribute__ ((unused))
 _jmpbuf_sp (__jmp_buf regs)
 {
   uintptr_t sp = regs[JB_GPR1];
-#ifdef PTR_DEMANGLE
   PTR_DEMANGLE (sp);
-#endif
   return sp;
 }
 
diff --git a/sysdeps/riscv/jmpbuf-unwind.h b/sysdeps/riscv/jmpbuf-unwind.h
index b411a246d1..0aeb0a76c6 100644
--- a/sysdeps/riscv/jmpbuf-unwind.h
+++ b/sysdeps/riscv/jmpbuf-unwind.h
@@ -34,9 +34,7 @@ static inline uintptr_t __attribute__ ((unused))
 _jmpbuf_sp (__jmp_buf regs)
 {
   uintptr_t sp = regs[0].__sp;
-#ifdef PTR_DEMANGLE
   PTR_DEMANGLE (sp);
-#endif
   return sp;
 }
 
diff --git a/sysdeps/s390/jmpbuf-unwind.h b/sysdeps/s390/jmpbuf-unwind.h
index 10b37f09c3..d125f3100a 100644
--- a/sysdeps/s390/jmpbuf-unwind.h
+++ b/sysdeps/s390/jmpbuf-unwind.h
@@ -41,9 +41,7 @@ static inline uintptr_t __attribute__ ((unused))
 _jmpbuf_sp (__jmp_buf regs)
 {
   void *sp = (void *) (uintptr_t) regs[0].__gregs[__JB_GPR15];
-#ifdef PTR_DEMANGLE
   PTR_DEMANGLE (sp);
-#endif
   return (uintptr_t) sp;
 }
 
diff --git a/sysdeps/s390/s390-32/__longjmp.c b/sysdeps/s390/s390-32/__longjmp.c
index 83d42329a3..f0317f6a03 100644
--- a/sysdeps/s390/s390-32/__longjmp.c
+++ b/sysdeps/s390/s390-32/__longjmp.c
@@ -24,6 +24,11 @@
 #include <unistd.h>
 #include <stap-probe.h>
 
+/* See sysdeps/unix/sysv/linux/s390/s390-32/pointer_guard.h.  */
+#if IS_IN (rtld)
+# undef PTR_DEMANGLE
+#endif
+
 /* Jump to the position specified by ENV, causing the
    setjmp call there to return VAL, or 1 if VAL is 0.  */
 void
diff --git a/sysdeps/s390/s390-64/__longjmp.c b/sysdeps/s390/s390-64/__longjmp.c
index 9fe4939e5e..eabe245d95 100644
--- a/sysdeps/s390/s390-64/__longjmp.c
+++ b/sysdeps/s390/s390-64/__longjmp.c
@@ -24,6 +24,11 @@
 #include <unistd.h>
 #include <stap-probe.h>
 
+/* See sysdeps/unix/sysv/linux/s390/s390-64/pointer_guard.h.  */
+#if IS_IN (rtld)
+# undef PTR_DEMANGLE
+#endif
+
 /* Jump to the position specified by ENV, causing the
    setjmp call there to return VAL, or 1 if VAL is 0.  */
 void
diff --git a/sysdeps/sh/jmpbuf-unwind.h b/sysdeps/sh/jmpbuf-unwind.h
index 1957e5275d..2c8b8b3696 100644
--- a/sysdeps/sh/jmpbuf-unwind.h
+++ b/sysdeps/sh/jmpbuf-unwind.h
@@ -33,9 +33,7 @@ static inline uintptr_t __attribute__ ((unused))
 _jmpbuf_sp (__jmp_buf regs)
 {
   void *sp = (void *) regs[0].__regs[7];
-#ifdef PTR_DEMANGLE
   PTR_DEMANGLE (sp);
-#endif
   return (uintptr_t) sp;
 }
 
diff --git a/sysdeps/sparc/sparc32/jmpbuf-unwind.h b/sysdeps/sparc/sparc32/jmpbuf-unwind.h
index 8b697ed95b..a225a33dc5 100644
--- a/sysdeps/sparc/sparc32/jmpbuf-unwind.h
+++ b/sysdeps/sparc/sparc32/jmpbuf-unwind.h
@@ -34,9 +34,7 @@ static inline uintptr_t __attribute__ ((unused))
 _jmpbuf_sp (__jmp_buf regs)
 {
   uintptr_t sp = regs[JB_SP];
-#ifdef PTR_DEMANGLE
   PTR_DEMANGLE (sp);
-#endif
   return sp;
 }
 
diff --git a/sysdeps/x86_64/jmpbuf-unwind.h b/sysdeps/x86_64/jmpbuf-unwind.h
index c92b2633bc..6fc5097e11 100644
--- a/sysdeps/x86_64/jmpbuf-unwind.h
+++ b/sysdeps/x86_64/jmpbuf-unwind.h
@@ -36,9 +36,7 @@ static inline uintptr_t __attribute__ ((unused))
 _jmpbuf_sp (__jmp_buf regs)
 {
   uintptr_t sp = regs[JB_RSP];
-#ifdef PTR_DEMANGLE
   PTR_DEMANGLE (sp);
-#endif
   return sp;
 }