From df9bc4850f3a6aef289d53c0c3d1fc78d63bdda2 Mon Sep 17 00:00:00 2001 From: kib Date: Mon, 23 Aug 2010 15:38:02 +0000 Subject: On shared object unload, in __cxa_finalize, call and clear all installed atexit and __cxa_atexit handlers that are either installed by unloaded dso, or points to the functions provided by the dso. Use _rtld_addr_phdr to locate segment information from the address of private variable belonging to the dso, supplied by crtstuff.c. Provide utility function __elf_phdr_match_addr to do the match of address against dso executable segment. Call back into libthr from __cxa_finalize using weak __pthread_cxa_finalize symbol to remove any atfork handler which function points into unloaded object. The rtld needs private __pthread_cxa_finalize symbol to not require resolution of the weak undefined symbol at initialization time. This cannot work, since rtld is relocated before sym_zero is set up. Idea by: kan Reviewed by: kan (previous version) MFC after: 3 weeks --- lib/libc/include/libc_private.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/libc/include/libc_private.h') diff --git a/lib/libc/include/libc_private.h b/lib/libc/include/libc_private.h index 570441b..c5f6eb3 100644 --- a/lib/libc/include/libc_private.h +++ b/lib/libc/include/libc_private.h @@ -214,5 +214,7 @@ extern int __sys_fcntl(int, int, ...); int _execvpe(const char *, char * const *, char * const *); int _elf_aux_info(int aux, void *buf, int buflen); +struct dl_phdr_info; +int __elf_phdr_match_addr(struct dl_phdr_info *, void *); #endif /* _LIBC_PRIVATE_H_ */ -- cgit v1.1