From d051b143f73189311faf9cd311cc53c6f6a145db Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Wed, 17 Jun 2015 20:11:58 +0000 Subject: Fix sem_* tdelete, tfind, tsearch, twalk namespace (bug 18536). The sem_* functions bring in references to tdelete, tfind, tsearch and twalk. But the t* functions are XSI-shaded, while sem_* aren't. This patch fixes this by using __t* instead, exporting those functions from libc at version GLIBC_PRIVATE (since sem_* are in libpthread) and using libc_hidden_* for the benefit of calls within libc. Tested for x86_64 and x86 (testsuite, and comparison of disassembly of installed stripped shared libraries). libpthread gets changes from PLT reordering; addresses in libc change because of PLT / dynamic symbol table changes. [BZ #18536] * misc/tsearch.c (__tsearch): Use libc_hidden_def. (__tfind): Likewise. (__tdelete): Likewise. (__twalk): Likewise. * misc/Versions (libc): Add __tdelete, __tfind, __tsearch and __twalk to GLIBC_PRIVATE. * include/search.h (__tsearch): Use libc_hidden_proto. (__tfind): Likewise. (__tdelete): Likewise. (__twalk): Likewise. * nptl/sem_close.c (sem_close): Call __twalk instead of twalk. Call __tdelete instead of tdelete. * nptl/sem_open.c (check_add_mapping): Call __tfind instead of tfind. Call __tsearch instead of tsearch. * sysdeps/sparc/sparc32/sem_open.c (check_add_mapping): Likewise. * conform/Makefile (test-xfail-POSIX/semaphore.h/linknamespace): Remove variable. (test-xfail-POSIX2008/semaphore.h/linknamespace): Likewise. --- include/search.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/search.h b/include/search.h index 24eafc0..a941959 100644 --- a/include/search.h +++ b/include/search.h @@ -14,11 +14,15 @@ libc_hidden_proto (lfind) extern void __hdestroy (void); extern void *__tsearch (const void *__key, void **__rootp, __compar_fn_t compar); +libc_hidden_proto (__tsearch) extern void *__tfind (const void *__key, void *const *__rootp, __compar_fn_t compar); +libc_hidden_proto (__tfind) extern void *__tdelete (const void *__key, void **__rootp, __compar_fn_t compar); +libc_hidden_proto (__tdelete) extern void __twalk (const void *__root, __action_fn_t action); +libc_hidden_proto (__twalk) extern void __tdestroy (void *__root, __free_fn_t freefct); #endif #endif -- cgit v1.1