File: libc-tls.c

package info (click to toggle)
uclibc 1.0.20-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 27,440 kB
  • ctags: 52,299
  • sloc: ansic: 218,051; asm: 35,518; cpp: 4,378; makefile: 2,781; sh: 618; yacc: 610; perl: 562; lex: 364; awk: 40
file content (31 lines) | stat: -rw-r--r-- 859 bytes parent folder | download | duplicates (5)
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
26
27
28
29
30
31
/*
 * Thread-local storage handling in statically linked binaries.  SH version.
 * Copyright (C) 2009 Free Software Foundation, Inc.
 *
 * Based on GNU C Library (file: libc/sysdeps/sh/libc-tls.c)
 *
 * Copyright (C) 2010 STMicroelectronics Ltd.
 * Author: Filippo Arcidiacono <filippo.arcidiacono@st.com>
 *
 * Licensed under the LGPL v2.1, 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 SH, 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