diff mbox

[uclibc-ng-devel] cleanup patch PTR_MANGLE/PTR_DEMANGLE

Message ID 20160710062522.GC18938@waldemar-brodkorb.de
State Accepted
Headers show

Commit Message

Waldemar Brodkorb July 10, 2016, 6:25 a.m. UTC
Hi,                                                                                                                                                                                                         
                                                                                                                                                                                                            
I want to add following cleanup patch.                                                                                                                                                                      
No regressions found.                                                                                                                                                                                       
                                                                                                                                                                                                            
Okay? Comments?                                                                                                                                                                                             
                                                                                                                                                                                                            
best regards                                                                                                                                                                                                
 Waldemar
diff mbox

Patch

From d00f0f5df0cfde68f9047d39c216f7feb0368134 Mon Sep 17 00:00:00 2001
From: Waldemar Brodkorb <wbx@uclibc-ng.org>
Date: Fri, 8 Jul 2016 16:01:41 +0200
Subject: [PATCH] cleanup PTR_MANGLE/PTR_DEMANGLE support

As this is only implemented for a few architecture and not well
tested, just remove it.

Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
---
 libc/sysdeps/linux/arc/sysdep.h                    |    5 ---
 libc/sysdeps/linux/arm/sysdep.h                    |    5 ---
 libc/sysdeps/linux/i386/sysdep.h                   |   30 --------------
 libc/sysdeps/linux/metag/sysdep.h                  |    4 --
 libc/sysdeps/linux/mips/sysdep.h                   |    6 ---
 libc/sysdeps/linux/powerpc/bits/syscalls.h         |   26 -------------
 libc/sysdeps/linux/sh/sysdep.h                     |   20 ----------
 libc/sysdeps/linux/sparc/sysdep.h                  |    5 ---
 libc/sysdeps/linux/x86_64/sched_getcpu.S           |    1 -
 libc/sysdeps/linux/x86_64/sysdep.h                 |   41 --------------------
 libc/sysdeps/linux/xtensa/sysdep.h                 |    5 ---
 .../nptl/sysdeps/pthread/pthread-functions.h       |    8 ----
 .../nptl/sysdeps/pthread/unwind-forcedunwind.c     |    8 ----
 13 files changed, 164 deletions(-)

diff --git a/libc/sysdeps/linux/arc/sysdep.h b/libc/sysdeps/linux/arc/sysdep.h
index d75d891..5fcc63d 100644
--- a/libc/sysdeps/linux/arc/sysdep.h
+++ b/libc/sysdeps/linux/arc/sysdep.h
@@ -18,9 +18,4 @@  nm:
 #endif /* __ASSEMBLER __*/
 
 #include <common/sysdep.h>
-
-/* Pointer mangling is not yet supported  */
-#define PTR_MANGLE(var) (void) (var)
-#define PTR_DEMANGLE(var) (void) (var)
-
 #endif
diff --git a/libc/sysdeps/linux/arm/sysdep.h b/libc/sysdeps/linux/arm/sysdep.h
index cdc276c..208521f 100644
--- a/libc/sysdeps/linux/arm/sysdep.h
+++ b/libc/sysdeps/linux/arm/sysdep.h
@@ -277,9 +277,4 @@  __local_syscall_error:						\
 #define UNDOARGS_7 ldmfd sp!, {r4, r5, r6};
 
 #endif	/* __ASSEMBLER__ */
-
-/* Pointer mangling is not yet supported for ARM.  */
-#define PTR_MANGLE(var) (void) (var)
-#define PTR_DEMANGLE(var) (void) (var)
-
 #endif /* linux/arm/sysdep.h */
diff --git a/libc/sysdeps/linux/i386/sysdep.h b/libc/sysdeps/linux/i386/sysdep.h
index c92a106..4fa47fc 100644
--- a/libc/sysdeps/linux/i386/sysdep.h
+++ b/libc/sysdeps/linux/i386/sysdep.h
@@ -396,34 +396,4 @@  __x86.get_pc_thunk.reg:						      \
 			cfi_restore (ebp); L(POPBP1):
 
 #endif	/* __ASSEMBLER__ */
-
-
-/* Pointer mangling support.  */
-#if defined NOT_IN_libc && defined IS_IN_rtld
-/* We cannot use the thread descriptor because in ld.so we use setjmp
-   earlier than the descriptor is initialized.  Using a global variable
-   is too complicated here since we have no PC-relative addressing mode.  */
-#else
-# ifdef __ASSEMBLER__
-#  define PTR_MANGLE(reg)	xorl %gs:POINTER_GUARD, reg;		      \
-				roll $9, reg
-#  define PTR_DEMANGLE(reg)	rorl $9, reg;				      \
-				xorl %gs:POINTER_GUARD, reg
-# else
-#  include <stddef.h>
-#  define PTR_MANGLE(var)	__asm__ ("xorl %%gs:%c2, %0\n"		      \
-				     "roll $9, %0"			      \
-				     : "=r" (var)			      \
-				     : "0" (var),			      \
-				       "i" (offsetof (tcbhead_t,	      \
-						      pointer_guard)))
-#  define PTR_DEMANGLE(var)	__asm__ ("rorl $9, %0\n"			      \
-				     "xorl %%gs:%c2, %0"		      \
-				     : "=r" (var)			      \
-				     : "0" (var),			      \
-				       "i" (offsetof (tcbhead_t,	      \
-						      pointer_guard)))
-# endif
-#endif
-
 #endif /* linux/i386/sysdep.h */
diff --git a/libc/sysdeps/linux/metag/sysdep.h b/libc/sysdeps/linux/metag/sysdep.h
index a12f393..8750641 100644
--- a/libc/sysdeps/linux/metag/sysdep.h
+++ b/libc/sysdeps/linux/metag/sysdep.h
@@ -53,7 +53,3 @@  __local_syscall_error:						\
 #endif
 
 #endif /* __ASSEMBLER __*/
-
-/* Pointer mangling is not yet supported for META.  */
-#define PTR_MANGLE(var) (void) (var)
-#define PTR_DEMANGLE(var) (void) (var)
diff --git a/libc/sysdeps/linux/mips/sysdep.h b/libc/sysdeps/linux/mips/sysdep.h
index 86873ac..e0c5c94 100644
--- a/libc/sysdeps/linux/mips/sysdep.h
+++ b/libc/sysdeps/linux/mips/sysdep.h
@@ -128,11 +128,5 @@  L(syse1):
 # define SYSCALL_ERROR_LABEL 99b
 #endif
 
-#else   /* ! __ASSEMBLER__ */
-
-/* Pointer mangling is not yet supported for MIPS.  */
-#define PTR_MANGLE(var) (void) (var)
-#define PTR_DEMANGLE(var) (void) (var)
-
 #endif  /* __ASSEMBLER__ */
 #endif /* _LINUX_MIPS_SYSDEP_H */
diff --git a/libc/sysdeps/linux/powerpc/bits/syscalls.h b/libc/sysdeps/linux/powerpc/bits/syscalls.h
index c52d5dd..d0f78c3 100644
--- a/libc/sysdeps/linux/powerpc/bits/syscalls.h
+++ b/libc/sysdeps/linux/powerpc/bits/syscalls.h
@@ -226,30 +226,4 @@  extern void __illegally_sized_syscall_arg6(void);
 # define ASM_INPUT_6 ASM_INPUT_5, "6" (r8)
 
 #endif /* __ASSEMBLER__ */
-
-
-/* Pointer mangling support.  */
-#if defined NOT_IN_libc && defined IS_IN_rtld
-/* We cannot use the thread descriptor because in ld.so we use setjmp
-   earlier than the descriptor is initialized.  */
-#else
-# ifdef __ASSEMBLER__
-#  define PTR_MANGLE(reg, tmpreg) \
-	lwz	tmpreg,POINTER_GUARD(r2); \
-	xor	reg,tmpreg,reg
-#  define PTR_MANGLE2(reg, tmpreg) \
-	xor	reg,tmpreg,reg
-#  define PTR_MANGLE3(destreg, reg, tmpreg) \
-	lwz	tmpreg,POINTER_GUARD(r2); \
-	xor	destreg,tmpreg,reg
-#  define PTR_DEMANGLE(reg, tmpreg) PTR_MANGLE (reg, tmpreg)
-#  define PTR_DEMANGLE2(reg, tmpreg) PTR_MANGLE2 (reg, tmpreg)
-#  define PTR_DEMANGLE3(destreg, reg, tmpreg) PTR_MANGLE3 (destreg, reg, tmpreg)
-# else
-#  define PTR_MANGLE(var) \
-  (var) = (__typeof (var)) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ())
-#  define PTR_DEMANGLE(var)	PTR_MANGLE (var)
-# endif
-#endif
-
 #endif /* _BITS_SYSCALLS_H */
diff --git a/libc/sysdeps/linux/sh/sysdep.h b/libc/sysdeps/linux/sh/sysdep.h
index b9b0009..281c415 100644
--- a/libc/sysdeps/linux/sh/sysdep.h
+++ b/libc/sysdeps/linux/sh/sysdep.h
@@ -271,23 +271,3 @@ 
  1: .long SYS_ify (syscall_name);	\
  2:
 #endif	/* __ASSEMBLER__ */
-
-/* Pointer mangling support.  */
-#if defined NOT_IN_libc && defined IS_IN_rtld
-/* We cannot use the thread descriptor because in ld.so we use setjmp
-   earlier than the descriptor is initialized.  Using a global variable
-   is too complicated here since we have no PC-relative addressing mode.  */
-#else
-# ifdef __ASSEMBLER__
-#  define PTR_MANGLE(reg, tmp) \
-     stc gbr,tmp; mov.l @(POINTER_GUARD,tmp),tmp; xor tmp,reg
-#  define PTR_MANGLE2(reg, tmp)	xor tmp,reg
-#  define PTR_DEMANGLE(reg, tmp)	PTR_MANGLE (reg, tmp)
-#  define PTR_DEMANGLE2(reg, tmp)	PTR_MANGLE2 (reg, tmp)
-# else
-#  define PTR_MANGLE(var) \
-     (var) = (void *) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ())
-#  define PTR_DEMANGLE(var)	PTR_MANGLE (var)
-# endif
-#endif
-
diff --git a/libc/sysdeps/linux/sparc/sysdep.h b/libc/sysdeps/linux/sparc/sysdep.h
index cf3e3af..c3897ec 100644
--- a/libc/sysdeps/linux/sparc/sysdep.h
+++ b/libc/sysdeps/linux/sparc/sysdep.h
@@ -61,9 +61,4 @@  ENTRY(name);					\
 
 
 #endif /* __ASSEMBLER__ */
-
-/* Pointer mangling is not yet supported for SPARC.  */
-#define PTR_MANGLE(var) (void) (var)
-#define PTR_DEMANGLE(var) (void) (var)
-
 #endif
diff --git a/libc/sysdeps/linux/x86_64/sched_getcpu.S b/libc/sysdeps/linux/x86_64/sched_getcpu.S
index f8c09c0..1e0a344 100644
--- a/libc/sysdeps/linux/x86_64/sched_getcpu.S
+++ b/libc/sysdeps/linux/x86_64/sched_getcpu.S
@@ -37,7 +37,6 @@  ENTRY (sched_getcpu)
 
 #ifdef SHARED
 	movq	__vdso_getcpu(%rip), %rax
-	PTR_DEMANGLE (%rax)
 	callq	*%rax
 #else
 # ifdef __NR_getcpu
diff --git a/libc/sysdeps/linux/x86_64/sysdep.h b/libc/sysdeps/linux/x86_64/sysdep.h
index 3bfeaca..0e51001 100644
--- a/libc/sysdeps/linux/x86_64/sysdep.h
+++ b/libc/sysdeps/linux/x86_64/sysdep.h
@@ -286,45 +286,4 @@  lose:									      \
 # define DOARGS_6 DOARGS_5
 
 #endif	/* __ASSEMBLER__ */
-
-
-/* Pointer mangling support.  */
-#if defined NOT_IN_libc && defined IS_IN_rtld
-/* We cannot use the thread descriptor because in ld.so we use setjmp
-   earlier than the descriptor is initialized.  */
-# ifdef __ASSEMBLER__
-#  define PTR_MANGLE(reg)	xorq __pointer_chk_guard_local(%rip), reg;    \
-				rolq $17, reg
-#  define PTR_DEMANGLE(reg)	rorq $17, reg;				      \
-				xorq __pointer_chk_guard_local(%rip), reg
-# else
-#  define PTR_MANGLE(reg)	__asm__ ("xorq __pointer_chk_guard_local(%%rip), %0\n" \
-				     "rolq $17, %0"			      \
-				     : "=r" (reg) : "0" (reg))
-#  define PTR_DEMANGLE(reg)	__asm__ ("rorq $17, %0\n"			      \
-				     "xorq __pointer_chk_guard_local(%%rip), %0" \
-				     : "=r" (reg) : "0" (reg))
-# endif
-#else
-# ifdef __ASSEMBLER__
-#  define PTR_MANGLE(reg)	xorq %fs:POINTER_GUARD, reg;		      \
-				rolq $17, reg
-#  define PTR_DEMANGLE(reg)	rorq $17, reg;				      \
-				xorq %fs:POINTER_GUARD, reg
-# else
-#  define PTR_MANGLE(var)	__asm__ ("xorq %%fs:%c2, %0\n"		      \
-				     "rolq $17, %0"			      \
-				     : "=r" (var)			      \
-				     : "0" (var),			      \
-				       "i" (offsetof (tcbhead_t,	      \
-						      pointer_guard)))
-#  define PTR_DEMANGLE(var)	__asm__ ("rorq $17, %0\n"			      \
-				     "xorq %%fs:%c2, %0"		      \
-				     : "=r" (var)			      \
-				     : "0" (var),			      \
-				       "i" (offsetof (tcbhead_t,	      \
-						      pointer_guard)))
-# endif
-#endif
-
 #endif /* linux/x86_64/sysdep.h */
diff --git a/libc/sysdeps/linux/xtensa/sysdep.h b/libc/sysdeps/linux/xtensa/sysdep.h
index f5a40eb..060b9b9 100644
--- a/libc/sysdeps/linux/xtensa/sysdep.h
+++ b/libc/sysdeps/linux/xtensa/sysdep.h
@@ -207,9 +207,4 @@ 
 #endif /* _LIBC_REENTRANT */
 
 #endif	/* __ASSEMBLER__ */
-
-/* Pointer mangling is not yet supported for Xtensa.  */
-#define PTR_MANGLE(var) (void) (var)
-#define PTR_DEMANGLE(var) (void) (var)
-
 #endif	/* _LINUX_XTENSA_SYSDEP_H */
diff --git a/libpthread/nptl/sysdeps/pthread/pthread-functions.h b/libpthread/nptl/sysdeps/pthread/pthread-functions.h
index 119fe6b..9c78180 100644
--- a/libpthread/nptl/sysdeps/pthread/pthread-functions.h
+++ b/libpthread/nptl/sysdeps/pthread/pthread-functions.h
@@ -102,15 +102,7 @@  struct pthread_functions
 extern struct pthread_functions __libc_pthread_functions attribute_hidden;
 extern int __libc_pthread_functions_init attribute_hidden;
 
-#if 0 /* def PTR_DEMANGLE */ /* we did not mangle, so do not demangle */
-# define PTHFCT_CALL(fct, params) \
-  ({ __typeof (__libc_pthread_functions.fct) __p;			      \
-     __p = __libc_pthread_functions.fct;				      \
-     PTR_DEMANGLE (__p);						      \
-     __p params; })
-#else
 # define PTHFCT_CALL(fct, params) \
   __libc_pthread_functions.fct params
-#endif
 
 #endif	/* pthread-functions.h */
diff --git a/libpthread/nptl/sysdeps/pthread/unwind-forcedunwind.c b/libpthread/nptl/sysdeps/pthread/unwind-forcedunwind.c
index 6936a89..6b6ad6f 100644
--- a/libpthread/nptl/sysdeps/pthread/unwind-forcedunwind.c
+++ b/libpthread/nptl/sysdeps/pthread/unwind-forcedunwind.c
@@ -70,13 +70,9 @@  pthread_cancel_init (void)
     abort();
   }
 
-  PTR_MANGLE (resume);
   libgcc_s_resume = resume;
-  PTR_MANGLE (personality);
   libgcc_s_personality = personality;
-  PTR_MANGLE (forcedunwind);
   libgcc_s_forcedunwind = forcedunwind;
-  PTR_MANGLE (getcfa);
   libgcc_s_getcfa = getcfa;
   /* Make sure libgcc_s_handle is written last.  Otherwise,
      pthread_cancel_init might return early even when the pointer the
@@ -104,7 +100,6 @@  _Unwind_Resume (struct _Unwind_Exception *exc)
     pthread_cancel_init ();
 
   void (*resume) (struct _Unwind_Exception *exc) = libgcc_s_resume;
-  PTR_DEMANGLE (resume);
   resume (exc);
 }
 
@@ -125,7 +120,6 @@  __gcc_personality_v0 (int version, _Unwind_Action actions,
   _Unwind_Reason_Code (*personality)
     (int, _Unwind_Action, _Unwind_Exception_Class, struct _Unwind_Exception *,
      struct _Unwind_Context *) = libgcc_s_personality;
-  PTR_DEMANGLE (personality);
   return personality (version, actions, exception_class, ue_header, context);
 }
 
@@ -139,7 +133,6 @@  _Unwind_ForcedUnwind (struct _Unwind_Exception *exc, _Unwind_Stop_Fn stop,
   _Unwind_Reason_Code (*forcedunwind)
     (struct _Unwind_Exception *, _Unwind_Stop_Fn, void *)
     = libgcc_s_forcedunwind;
-  PTR_DEMANGLE (forcedunwind);
   return forcedunwind (exc, stop, stop_argument);
 }
 
@@ -150,6 +143,5 @@  _Unwind_GetCFA (struct _Unwind_Context *context)
     pthread_cancel_init ();
 
   _Unwind_Word (*getcfa) (struct _Unwind_Context *) = libgcc_s_getcfa;
-  PTR_DEMANGLE (getcfa);
   return getcfa (context);
 }
-- 
1.7.10.4