summaryrefslogtreecommitdiff
path: root/libpthread/nptl/sysdeps/csky/libc-tls.c
blob: 21aacec905c05fc6a69f27a1b5cf94e600406123 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/*
 * Copyright (C) 2017 Hangzhou C-SKY Microsystems co.,ltd.
 *
 * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB
 * in this tarball.
 */

#include <sysdeps/generic/libc-tls.c>
#include <dl-tls.h>

#if defined(USE_TLS) && USE_TLS

/* On CSKY, linker optimizations are not required, so __tls_get_addr
   can be called even in statically linked binaries.  In this case module
   must be always 1 and PT_TLS segment exist in the binary, otherwise it
   would not link.  */

void *
__tls_get_addr (tls_index *ti)
{
	dtv_t *dtv = THREAD_DTV ();
	return (char *) dtv[1].pointer.val + ti->ti_offset;
}

#endif