diff options
author | Florian Weimer <fweimer@redhat.com> | 2022-10-18 17:00:07 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2022-10-18 17:04:10 +0200 |
commit | 58548b9d689fb9bba67bdc5b59c8d2fa47f4f8ec (patch) | |
tree | 0aea307f4cf761952fbdf15fd67fc3b09b43707c | |
parent | Introduce <pointer_guard.h>, extracted from <sysdep.h> (diff) | |
download | glibc-58548b9d689fb9bba67bdc5b59c8d2fa47f4f8ec.tar.gz glibc-58548b9d689fb9bba67bdc5b59c8d2fa47f4f8ec.tar.bz2 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>
50 files changed, 20 insertions, 158 deletions
diff --git a/hurd/sigunwind.c b/hurd/sigunwind.c index 28213091e3..f114990b6f 100644 --- a/hurd/sigunwind.c +++ b/hurd/sigunwind.c @@ -73,9 +73,7 @@ _hurdsig_longjmp_from_handler (void *data, jmp_buf env, int val) inline uintptr_t demangle_ptr (uintptr_t x) { -# ifdef PTR_DEMANGLE PTR_DEMANGLE (x); -# endif return x; } diff --git a/iconv/gconv.c b/iconv/gconv.c index dea9c80fee..592a75956c 100644 --- a/iconv/gconv.c +++ b/iconv/gconv.c @@ -46,10 +46,8 @@ __gconv (__gconv_t cd, const unsigned char **inbuf, cd->__data[last_step].__outbufend = outbufend; __gconv_fct fct = cd->__steps->__fct; -#ifdef PTR_DEMANGLE if (cd->__steps->__shlib_handle != NULL) PTR_DEMANGLE (fct); -#endif if (inbuf == NULL || *inbuf == NULL) { diff --git a/iconv/gconv_cache.c b/iconv/gconv_cache.c index 5dbf596b8d..8d47545c41 100644 --- a/iconv/gconv_cache.c +++ b/iconv/gconv_cache.c @@ -205,16 +205,11 @@ find_module (const char *directory, const char *filename, /* Call the init function. */ __gconv_init_fct init_fct = result->__init_fct; -#ifdef PTR_DEMANGLE PTR_DEMANGLE (init_fct); -#endif if (init_fct != NULL) { status = DL_CALL_FCT (init_fct, (result)); - -#ifdef PTR_MANGLE PTR_MANGLE (result->__btowc_fct); -#endif } } diff --git a/iconv/gconv_db.c b/iconv/gconv_db.c index 90037fdf58..4943c954a3 100644 --- a/iconv/gconv_db.c +++ b/iconv/gconv_db.c @@ -180,9 +180,7 @@ free_derivation (void *p) && deriv->steps[cnt].__shlib_handle != NULL) { __gconv_end_fct end_fct = deriv->steps[cnt].__end_fct; -#ifdef PTR_DEMANGLE PTR_DEMANGLE (end_fct); -#endif if (end_fct != NULL) DL_CALL_FCT (end_fct, (&deriv->steps[cnt])); } @@ -208,9 +206,7 @@ __gconv_release_step (struct __gconv_step *step) { /* Call the destructor. */ __gconv_end_fct end_fct = step->__end_fct; -#ifdef PTR_DEMANGLE PTR_DEMANGLE (end_fct); -#endif if (end_fct != NULL) DL_CALL_FCT (end_fct, (step)); @@ -303,9 +299,7 @@ gen_steps (struct derivation_step *best, const char *toset, /* Call the init function. */ __gconv_init_fct init_fct = result[step_cnt].__init_fct; -# ifdef PTR_DEMANGLE PTR_DEMANGLE (init_fct); -# endif if (init_fct != NULL) { status = DL_CALL_FCT (init_fct, (&result[step_cnt])); @@ -316,17 +310,13 @@ gen_steps (struct derivation_step *best, const char *toset, /* Do not call the end function because the init function has failed. */ result[step_cnt].__end_fct = NULL; -# ifdef PTR_MANGLE PTR_MANGLE (result[step_cnt].__end_fct); -# endif /* Make sure we unload this module. */ --step_cnt; break; } } -# ifdef PTR_MANGLE PTR_MANGLE (result[step_cnt].__btowc_fct); -# endif } else #endif @@ -404,15 +394,10 @@ increment_counter (struct __gconv_step *steps, size_t nsteps) /* Call the init function. */ __gconv_init_fct init_fct = step->__init_fct; -#ifdef PTR_DEMANGLE PTR_DEMANGLE (init_fct); -#endif if (init_fct != NULL) DL_CALL_FCT (init_fct, (step)); - -#ifdef PTR_MANGLE PTR_MANGLE (step->__btowc_fct); -#endif } } } diff --git a/iconv/gconv_dl.c b/iconv/gconv_dl.c index c93c5dd380..5ed982636a 100644 --- a/iconv/gconv_dl.c +++ b/iconv/gconv_dl.c @@ -127,11 +127,9 @@ __gconv_find_shlib (const char *name) found->init_fct = __libc_dlsym (found->handle, "gconv_init"); found->end_fct = __libc_dlsym (found->handle, "gconv_end"); -#ifdef PTR_MANGLE PTR_MANGLE (found->fct); PTR_MANGLE (found->init_fct); PTR_MANGLE (found->end_fct); -#endif /* We have succeeded in loading the shared object. */ found->counter = 1; diff --git a/iconv/gconv_trans.c b/iconv/gconv_trans.c index 0f4ce10996..2255531452 100644 --- a/iconv/gconv_trans.c +++ b/iconv/gconv_trans.c @@ -53,10 +53,8 @@ __gconv_transliterate (struct __gconv_step *step, winbufend = (const uint32_t *) inbufend; __gconv_fct fct = step->__fct; -#ifdef PTR_DEMANGLE if (step->__shlib_handle != NULL) PTR_DEMANGLE (fct); -#endif /* If there is no transliteration information in the locale don't do anything and return the error. */ diff --git a/iconv/skeleton.c b/iconv/skeleton.c index 42ee0b6508..9eaf9a4948 100644 --- a/iconv/skeleton.c +++ b/iconv/skeleton.c @@ -404,10 +404,8 @@ FUNCTION_NAME (struct __gconv_step *step, struct __gconv_step_data *data, if ((data->__flags & __GCONV_IS_LAST) == 0) { fct = next_step->__fct; -#ifdef PTR_DEMANGLE if (next_step->__shlib_handle != NULL) PTR_DEMANGLE (fct); -#endif } /* If the function is called with no input this means we have to reset diff --git a/inet/idna.c b/inet/idna.c index df5811fd6a..2243d3e7d9 100644 --- a/inet/idna.c +++ b/inet/idna.c @@ -73,10 +73,8 @@ functions_allocate (void *closure) result->handle = handle; result->lookup_ul = ptr_lookup_ul; result->to_unicode_lzlz = ptr_to_unicode_lzlz; -#ifdef PTR_MANGLE PTR_MANGLE (result->lookup_ul); PTR_MANGLE (result->to_unicode_lzlz); -#endif return result; } @@ -138,9 +136,7 @@ __idna_to_dns_encoding (const char *name, char **result) return EAI_IDN_ENCODE; char *ptr = NULL; __typeof__ (functions->lookup_ul) fptr = functions->lookup_ul; -#ifdef PTR_DEMANGLE PTR_DEMANGLE (fptr); -#endif int ret = fptr (name, &ptr, 0); if (ret == 0) { @@ -165,9 +161,7 @@ __idna_from_dns_encoding (const char *name, char **result) return gai_strdup (name, result); char *ptr = NULL; __typeof__ (functions->to_unicode_lzlz) fptr = functions->to_unicode_lzlz; -#ifdef PTR_DEMANGLE PTR_DEMANGLE (fptr); -#endif int ret = fptr (name, &ptr, 0); if (ret == 0) { diff --git a/libio/iofopncook.c b/libio/iofopncook.c index a7db4ef1c9..6c27610319 100644 --- a/libio/iofopncook.c +++ b/libio/iofopncook.c @@ -35,9 +35,7 @@ _IO_cookie_read (FILE *fp, void *buf, ssize_t size) { struct _IO_cookie_file *cfile = (struct _IO_cookie_file *) fp; cookie_read_function_t *read_cb = cfile->__io_functions.read; -#ifdef PTR_DEMANGLE PTR_DEMANGLE (read_cb); -#endif if (read_cb == NULL) return -1; @@ -50,9 +48,7 @@ _IO_cookie_write (FILE *fp, const void *buf, ssize_t size) { struct _IO_cookie_file *cfile = (struct _IO_cookie_file *) fp; cookie_write_function_t *write_cb = cfile->__io_functions.write; -#ifdef PTR_DEMANGLE PTR_DEMANGLE (write_cb); -#endif if (write_cb == NULL) { @@ -72,9 +68,7 @@ _IO_cookie_seek (FILE *fp, off64_t offset, int dir) { struct _IO_cookie_file *cfile = (struct _IO_cookie_file *) fp; cookie_seek_function_t *seek_cb = cfile->__io_functions.seek; -#ifdef PTR_DEMANGLE PTR_DEMANGLE (seek_cb); -#endif return ((seek_cb == NULL || (seek_cb (cfile->__cookie, &offset, dir) @@ -88,9 +82,7 @@ _IO_cookie_close (FILE *fp) { struct _IO_cookie_file *cfile = (struct _IO_cookie_file *) fp; cookie_close_function_t *close_cb = cfile->__io_functions.close; -#ifdef PTR_DEMANGLE PTR_DEMANGLE (close_cb); -#endif if (close_cb == NULL) return 0; @@ -139,12 +131,10 @@ static void set_callbacks (cookie_io_functions_t *target, cookie_io_functions_t source) { -#ifdef PTR_MANGLE PTR_MANGLE (source.read); PTR_MANGLE (source.write); PTR_MANGLE (source.seek); PTR_MANGLE (source.close); -#endif *target = source; } @@ -226,9 +216,7 @@ _IO_old_cookie_seek (FILE *fp, off64_t offset, int dir) struct _IO_cookie_file *cfile = (struct _IO_cookie_file *) fp; int (*seek_cb) (FILE *, off_t, int) = (int (*) (FILE *, off_t, int)) cfile->__io_functions.seek; -#ifdef PTR_DEMANGLE PTR_DEMANGLE (seek_cb); -#endif if (seek_cb == NULL) return _IO_pos_BAD; diff --git a/libio/iofwide.c b/libio/iofwide.c index 1ce685f48a..37c353e3aa 100644 --- a/libio/iofwide.c +++ b/libio/iofwide.c @@ -124,10 +124,8 @@ __libio_codecvt_out (struct _IO_codecvt *codecvt, __mbstate_t *statep, codecvt->__cd_out.step_data.__statep = statep; __gconv_fct fct = gs->__fct; -#ifdef PTR_DEMANGLE if (gs->__shlib_handle != NULL) PTR_DEMANGLE (fct); -#endif status = DL_CALL_FCT (fct, (gs, &codecvt->__cd_out.step_data, &from_start_copy, @@ -176,10 +174,8 @@ __libio_codecvt_in (struct _IO_codecvt *codecvt, __mbstate_t *statep, codecvt->__cd_in.step_data.__statep = statep; __gconv_fct fct = gs->__fct; -#ifdef PTR_DEMANGLE if (gs->__shlib_handle != NULL) PTR_DEMANGLE (fct); -#endif status = DL_CALL_FCT (fct, (gs, &codecvt->__cd_in.step_data, &from_start_copy, @@ -243,10 +239,8 @@ __libio_codecvt_length (struct _IO_codecvt *codecvt, __mbstate_t *statep, codecvt->__cd_in.step_data.__statep = statep; __gconv_fct fct = gs->__fct; -#ifdef PTR_DEMANGLE if (gs->__shlib_handle != NULL) PTR_DEMANGLE (fct); -#endif DL_CALL_FCT (fct, (gs, &codecvt->__cd_in.step_data, &cp, diff --git a/libio/libioP.h b/libio/libioP.h index dac3de73a1..3a5498bd65 100644 --- a/libio/libioP.h +++ b/libio/libioP.h @@ -911,9 +911,7 @@ extern void (*IO_accept_foreign_vtables) (void) attribute_hidden; static inline void IO_set_accept_foreign_vtables (void (*flag) (void)) { -#ifdef PTR_MANGLE PTR_MANGLE (flag); -#endif atomic_store_relaxed (&IO_accept_foreign_vtables, flag); } diff --git a/libio/vtables.c b/libio/vtables.c index 32459e4fac..e3809c28ce 100644 --- a/libio/vtables.c +++ b/libio/vtables.c @@ -39,9 +39,7 @@ _IO_vtable_check (void) #ifdef SHARED /* Honor the compatibility flag. */ void (*flag) (void) = atomic_load_relaxed (&IO_accept_foreign_vtables); -#ifdef PTR_DEMANGLE PTR_DEMANGLE (flag); -#endif if (flag == &_IO_vtable_check) return; diff --git a/misc/unwind-link.c b/misc/unwind-link.c index 45b7886b46..e8653bbaf1 100644 --- a/misc/unwind-link.c +++ b/misc/unwind-link.c @@ -86,19 +86,17 @@ __libc_unwind_link_get (void) assert (local.ptr__Unwind_Resume != NULL); assert (local.ptr_personality != NULL); -#ifdef PTR_MANGLE PTR_MANGLE (local.ptr__Unwind_Backtrace); PTR_MANGLE (local.ptr__Unwind_ForcedUnwind); PTR_MANGLE (local.ptr__Unwind_GetCFA); -# if UNWIND_LINK_GETIP +#if UNWIND_LINK_GETIP PTR_MANGLE (local.ptr__Unwind_GetIP); -# endif +#endif PTR_MANGLE (local.ptr__Unwind_Resume); -# if UNWIND_LINK_FRAME_STATE_FOR +#if UNWIND_LINK_FRAME_STATE_FOR PTR_MANGLE (local.ptr___frame_state_for); -# endif - PTR_MANGLE (local.ptr_personality); #endif + PTR_MANGLE (local.ptr_personality); __libc_lock_lock (lock); if (atomic_load_relaxed (&global_libgcc_handle) != NULL) diff --git a/nss/nss_module.c b/nss/nss_module.c index 9a8f3ddf94..444facb9b8 100644 --- a/nss/nss_module.c +++ b/nss/nss_module.c @@ -128,10 +128,8 @@ module_load_builtin (struct nss_module *module, case nss_module_failed: bind (module->functions.untyped); -#ifdef PTR_MANGLE for (int i = 0; i < nss_module_functions_count; ++i) PTR_MANGLE (module->functions.untyped[i]); -#endif module->handle = NULL; /* Synchronizes with unlocked __nss_module_load atomic_load_acquire. */ @@ -153,9 +151,7 @@ module_load_nss_files (struct nss_module *module) if (is_nscd) { void (*cb) (size_t, struct traced_file *) = nscd_init_cb; -# ifdef PTR_DEMANGLE PTR_DEMANGLE (cb); -# endif _nss_files_init (cb); } #endif @@ -239,9 +235,7 @@ module_load (struct nss_module *module) } pointers[idx] = __libc_dlsym (handle, function_name); free (function_name); -#ifdef PTR_MANGLE PTR_MANGLE (pointers[idx]); -#endif } # ifdef USE_NSCD @@ -264,9 +258,7 @@ module_load (struct nss_module *module) if (ifct != NULL) { void (*cb) (size_t, struct traced_file *) = nscd_init_cb; -# ifdef PTR_DEMANGLE PTR_DEMANGLE (cb); -# endif ifct (cb); } } @@ -349,9 +341,7 @@ __nss_module_get_function (struct nss_module *module, const char *name) assert (name_entry != NULL); size_t idx = name_entry - nss_function_name_array; void *fptr = module->functions.untyped[idx]; -#ifdef PTR_DEMANGLE PTR_DEMANGLE (fptr); -#endif return fptr; } @@ -382,9 +372,7 @@ __nss_disable_nscd (void (*cb) (size_t, struct traced_file *)) { void (*cb1) (size_t, struct traced_file *); cb1 = cb; -# ifdef PTR_MANGLE PTR_MANGLE (cb); -# endif nscd_init_cb = cb; is_nscd = true; diff --git a/stdlib/cxa_atexit.c b/stdlib/cxa_atexit.c index adf89e93f5..fad2d2b4e0 100644 --- a/stdlib/cxa_atexit.c +++ b/stdlib/cxa_atexit.c @@ -49,9 +49,7 @@ __internal_atexit (void (*func) (void *), void *arg, void *d, return -1; } -#ifdef PTR_MANGLE PTR_MANGLE (func); -#endif new->func.cxa.fn = (void (*) (void *, int)) func; new->func.cxa.arg = arg; new->func.cxa.dso_handle = d; diff --git a/stdlib/cxa_finalize.c b/stdlib/cxa_finalize.c index f2479569a5..1958c28801 100644 --- a/stdlib/cxa_finalize.c +++ b/stdlib/cxa_finalize.c @@ -75,9 +75,8 @@ __cxa_finalize (void *d) parallel. */ f->flavor = ef_free; -#ifdef PTR_DEMANGLE PTR_DEMANGLE (cxafn); -#endif + /* Unlock the list while we call a foreign function. */ __libc_lock_unlock (__exit_funcs_lock); cxafn (cxaarg, 0); diff --git a/stdlib/cxa_thread_atexit_impl.c b/stdlib/cxa_thread_atexit_impl.c index faacab3990..b5ecfee10c 100644 --- a/stdlib/cxa_thread_atexit_impl.c +++ b/stdlib/cxa_thread_atexit_impl.c @@ -100,9 +100,7 @@ static __thread struct link_map *lm_cache; int __cxa_thread_atexit_impl (dtor_func func, void *obj, void *dso_symbol) { -#ifdef PTR_MANGLE PTR_MANGLE (func); -#endif /* Prepend. */ struct dtor_list *new = calloc (1, sizeof (struct dtor_list)); @@ -152,9 +150,7 @@ __call_tls_dtors (void) { struct dtor_list *cur = tls_dtor_list; dtor_func func = cur->func; -#ifdef PTR_DEMANGLE PTR_DEMANGLE (func); -#endif tls_dtor_list = tls_dtor_list->next; func (cur->obj); diff --git a/stdlib/exit.c b/stdlib/exit.c index e59156bbf6..10c44e1449 100644 --- a/stdlib/exit.c +++ b/stdlib/exit.c @@ -81,9 +81,8 @@ __run_exit_handlers (int status, struct exit_function_list **listp, case ef_on: onfct = f->func.on.fn; arg = f->func.on.arg; -#ifdef PTR_DEMANGLE PTR_DEMANGLE (onfct); -#endif + /* Unlock the list while we call a foreign function. */ __libc_lock_unlock (__exit_funcs_lock); onfct (status, arg); @@ -91,9 +90,8 @@ __run_exit_handlers (int status, struct exit_function_list **listp, break; case ef_at: atfct = f->func.at; -#ifdef PTR_DEMANGLE PTR_DEMANGLE (atfct); -#endif + /* Unlock the list while we call a foreign function. */ __libc_lock_unlock (__exit_funcs_lock); atfct (); @@ -105,9 +103,8 @@ __run_exit_handlers (int status, struct exit_function_list **listp, f->flavor = ef_free; cxafct = f->func.cxa.fn; arg = f->func.cxa.arg; -#ifdef PTR_DEMANGLE PTR_DEMANGLE (cxafct); -#endif + /* Unlock the list while we call a foreign function. */ __libc_lock_unlock (__exit_funcs_lock); cxafct (arg, status); diff --git a/stdlib/on_exit.c b/stdlib/on_exit.c index fb59db20ca..2ac70e18bd 100644 --- a/stdlib/on_exit.c +++ b/stdlib/on_exit.c @@ -39,9 +39,7 @@ __on_exit (void (*func) (int status, void *arg), void *arg) return -1; } -#ifdef PTR_MANGLE PTR_MANGLE (func); -#endif new->func.on.fn = func; new->func.on.arg = arg; new->flavor = ef_on; 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; } diff --git a/wcsmbs/btowc.c b/wcsmbs/btowc.c index 7023ec99f1..da1c28732f 100644 --- a/wcsmbs/btowc.c +++ b/wcsmbs/btowc.c @@ -45,10 +45,8 @@ __btowc (int c) /* Get the conversion functions. */ fcts = get_gconv_fcts (_NL_CURRENT_DATA (LC_CTYPE)); __gconv_btowc_fct btowc_fct = fcts->towc->__btowc_fct; -#ifdef PTR_DEMANGLE if (fcts->towc->__shlib_handle != NULL) PTR_DEMANGLE (btowc_fct); -#endif if (__builtin_expect (fcts->towc_nsteps == 1, 1) && __builtin_expect (btowc_fct != NULL, 1)) @@ -81,10 +79,8 @@ __btowc (int c) inbuf[0] = c; __gconv_fct fct = fcts->towc->__fct; -#ifdef PTR_DEMANGLE if (fcts->towc->__shlib_handle != NULL) PTR_DEMANGLE (fct); -#endif status = DL_CALL_FCT (fct, (fcts->towc, &data, &inptr, inptr + 1, NULL, &dummy, 0, 1)); diff --git a/wcsmbs/mbrtoc16.c b/wcsmbs/mbrtoc16.c index f8b029b58a..f45f73e246 100644 --- a/wcsmbs/mbrtoc16.c +++ b/wcsmbs/mbrtoc16.c @@ -96,10 +96,8 @@ mbrtoc16 (char16_t *pc16, const char *s, size_t n, mbstate_t *ps) goto ilseq; } __gconv_fct fct = fcts->towc->__fct; -#ifdef PTR_DEMANGLE if (fcts->towc->__shlib_handle != NULL) PTR_DEMANGLE (fct); -#endif status = DL_CALL_FCT (fct, (fcts->towc, &data, &inbuf, endbuf, NULL, &dummy, 0, 1)); diff --git a/wcsmbs/mbrtowc.c b/wcsmbs/mbrtowc.c index 46a1cc38df..3d06acbd5a 100644 --- a/wcsmbs/mbrtowc.c +++ b/wcsmbs/mbrtowc.c @@ -78,10 +78,8 @@ __mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) goto ilseq; } __gconv_fct fct = fcts->towc->__fct; -#ifdef PTR_DEMANGLE if (fcts->towc->__shlib_handle != NULL) PTR_DEMANGLE (fct); -#endif status = DL_CALL_FCT (fct, (fcts->towc, &data, &inbuf, endbuf, NULL, &dummy, 0, 1)); diff --git a/wcsmbs/mbsnrtowcs.c b/wcsmbs/mbsnrtowcs.c index 06a1f2d36f..47f5de408a 100644 --- a/wcsmbs/mbsnrtowcs.c +++ b/wcsmbs/mbsnrtowcs.c @@ -64,10 +64,8 @@ __mbsnrtowcs (wchar_t *dst, const char **src, size_t nmc, size_t len, /* Get the structure with the function pointers. */ towc = fcts->towc; __gconv_fct fct = towc->__fct; -#ifdef PTR_DEMANGLE if (towc->__shlib_handle != NULL) PTR_DEMANGLE (fct); -#endif /* We have to handle DST == NULL special. */ if (dst == NULL) diff --git a/wcsmbs/mbsrtowcs_l.c b/wcsmbs/mbsrtowcs_l.c index 526b88e1dd..5fe70cb8a1 100644 --- a/wcsmbs/mbsrtowcs_l.c +++ b/wcsmbs/mbsrtowcs_l.c @@ -58,10 +58,8 @@ __mbsrtowcs_l (wchar_t *dst, const char **src, size_t len, mbstate_t *ps, /* Get the structure with the function pointers. */ towc = fcts->towc; __gconv_fct fct = towc->__fct; -#ifdef PTR_DEMANGLE if (towc->__shlib_handle != NULL) PTR_DEMANGLE (fct); -#endif /* We have to handle DST == NULL special. */ if (dst == NULL) diff --git a/wcsmbs/wcrtomb.c b/wcsmbs/wcrtomb.c index 42690f2efd..b71ca79de7 100644 --- a/wcsmbs/wcrtomb.c +++ b/wcsmbs/wcrtomb.c @@ -63,10 +63,8 @@ __wcrtomb_internal (char *s, wchar_t wc, mbstate_t *ps, size_t s_size) /* Get the conversion functions. */ fcts = get_gconv_fcts (_NL_CURRENT_DATA (LC_CTYPE)); __gconv_fct fct = fcts->tomb->__fct; -#ifdef PTR_DEMANGLE if (fcts->tomb->__shlib_handle != NULL) PTR_DEMANGLE (fct); -#endif /* If WC is the NUL character we write into the output buffer the byte sequence necessary for PS to get into the initial state, followed diff --git a/wcsmbs/wcsnrtombs.c b/wcsmbs/wcsnrtombs.c index 6ba180cdc2..12b116a837 100644 --- a/wcsmbs/wcsnrtombs.c +++ b/wcsmbs/wcsnrtombs.c @@ -62,10 +62,8 @@ __wcsnrtombs (char *dst, const wchar_t **src, size_t nwc, size_t len, /* Get the structure with the function pointers. */ tomb = fcts->tomb; __gconv_fct fct = tomb->__fct; -#ifdef PTR_DEMANGLE if (tomb->__shlib_handle != NULL) PTR_DEMANGLE (fct); -#endif /* We have to handle DST == NULL special. */ if (dst == NULL) diff --git a/wcsmbs/wcsrtombs.c b/wcsmbs/wcsrtombs.c index 7db2b181b3..962176c183 100644 --- a/wcsmbs/wcsrtombs.c +++ b/wcsmbs/wcsrtombs.c @@ -54,10 +54,8 @@ __wcsrtombs (char *dst, const wchar_t **src, size_t len, mbstate_t *ps) /* Get the structure with the function pointers. */ tomb = fcts->tomb; __gconv_fct fct = tomb->__fct; -#ifdef PTR_DEMANGLE if (tomb->__shlib_handle != NULL) PTR_DEMANGLE (fct); -#endif /* We have to handle DST == NULL special. */ if (dst == NULL) diff --git a/wcsmbs/wctob.c b/wcsmbs/wctob.c index 5dfbd7ab7e..63764d1425 100644 --- a/wcsmbs/wctob.c +++ b/wcsmbs/wctob.c @@ -63,10 +63,8 @@ wctob (wint_t c) const unsigned char *argptr = (const unsigned char *) inptr; __gconv_fct fct = fcts->tomb->__fct; -#ifdef PTR_DEMANGLE if (fcts->tomb->__shlib_handle != NULL) PTR_DEMANGLE (fct); -#endif status = DL_CALL_FCT (fct, (fcts->tomb, &data, &argptr, argptr + sizeof (inbuf[0]), NULL, &dummy, 0, 1)); |