/* * Thread-local storage handling in statically linked binaries. Meta 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. * Copyright (C) 2013 Imagination Technologies Ltd. * * Author: Filippo Arcidiacono * * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball. * */ #include #include #if defined (USE_TLS) && (USE_TLS) /* On Meta, 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