1 /* 2 * This file is subject to the terms and conditions of the LGPL V2.1 3 * License. See the file "COPYING" in the main directory of this archive 4 * for more details. 5 * 6 * Copyright (C) 2020 Kalray Inc. 7 */ 8 9 #include <sysdeps/generic/libc-tls.c> 10 #include <dl-tls.h> 11 12 #if defined(USE_TLS) && USE_TLS 13 14 /* On kvx, linker optimizations are not required, so __tls_get_addr 15 can be called even in statically linked binaries. In this case module 16 must be always 1 and PT_TLS segment exist in the binary, otherwise it 17 would not link. */ 18 19 void * __tls_get_addr(tls_index * ti)20__tls_get_addr (tls_index *ti) 21 { 22 dtv_t *dtv = THREAD_DTV (); 23 return (char *) dtv[1].pointer.val + ti->ti_offset; 24 } 25 26 #endif 27