예제 #1
0
파일: tls.c 프로젝트: AgamAgarwal/minix
void
__libc_static_tls_setup(void)
{
	struct tls_tcb *tcb;

	if (&rtld_DYNAMIC != NULL) {
#ifdef __powerpc__
		/*
		 * Old powerpc crt0's are going to overwrite r2 so we need to
		 * restore it but only do so if the saved value isn't NULL (if
		 * it is NULL, ld.elf_so doesn't have the matching change).
		 */
		if ((tcb = _lwp_getprivate()) != NULL)
			__lwp_settcb(tcb);
#endif
		return;
	}

	dl_iterate_phdr(__libc_static_tls_setup_cb, NULL);

	tcb = _rtld_tls_allocate();
#ifdef __HAVE___LWP_SETTCB
	__lwp_settcb(tcb);
#else
	_lwp_setprivate(tcb);
#endif
}
예제 #2
0
파일: tls.c 프로젝트: Hooman3/minix
void
_rtld_tls_initial_allocation(void)
{
	struct tls_tcb *tcb;

	_rtld_tls_static_space = _rtld_tls_static_offset +
	    RTLD_STATIC_TLS_RESERVATION;

#ifndef __HAVE_TLS_VARIANT_I
	_rtld_tls_static_space = roundup2(_rtld_tls_static_space,
	    sizeof(void *));
#endif
	dbg(("_rtld_tls_static_space %zu", _rtld_tls_static_space));

	tcb = _rtld_tls_allocate_locked();
#ifdef __HAVE___LWP_SETTCB
	__lwp_settcb(tcb);
#ifdef __powerpc__
	/*
	 * Save the tcb pointer so that libc can retrieve it.  Older
	 * crt0 will obliterate r2 so there is code in libc to restore it.
	 */
	_lwp_setprivate(tcb);
#endif
#else
	_lwp_setprivate(tcb);
#endif
}