This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Finding the source code for ___tls_get_addr_internal()
On Fri, Jan 18, 2013 at 12:43 AM, Ian Lance Taylor <iant@google.com> wrote:
>
> On Thu, Jan 17, 2013 at 2:11 PM, Saul Tamari <stamari@gmail.com> wrote:
> > Is there a way to verify if there are wrongly initialized TLS
> > variables in some application or I can only detect such cases when the
> > application fails?
>
> You could probably look at the dynamic relocations and see if there
> are any TLS relocations in the shared library that are not global
> dynamic.
I tried the following:
[root@vm0 ~]# readelf -s ./mylib.so | grep TLS
808: 00000418 4 TLS GLOBAL DEFAULT 16 _ZN24MonitorWorkItemOpera
914: 00000008 4 TLS GLOBAL DEFAULT 16 _ZN12TQQQScheduler9_instan
1176: 00000414 4 TLS GLOBAL DEFAULT 16 time_monitor_list
2577: 00000000 4 TLS WEAK DEFAULT 16 _ZZN6Remote23MultiplexCli
2788: 00000004 4 TLS WEAK DEFAULT 16 _ZZN6Remote23MultiplexCli
249: 0000000c 4 TLS LOCAL DEFAULT 16 _ZL17pthread_qqq_owner
435: 00000010 1 TLS LOCAL DEFAULT 16 _ZL11g_in_syslog
436: 00000011 1024 TLS LOCAL DEFAULT 16 _ZL9g_tls_buf
2230: 00000418 4 TLS GLOBAL DEFAULT 16 _ZN24MonitorWorkItemOpera
2467: 00000000 4 TLS WEAK DEFAULT 16 _ZZN6Remote23MultiplexCli
3375: 00000008 4 TLS GLOBAL DEFAULT 16 _ZN12QQQScheduler9_instan
3660: 00000414 4 TLS GLOBAL DEFAULT 16 time_monitor_list
3766: 00000004 4 TLS WEAK DEFAULT 16 _ZZN6Remote23MultiplexCli
So I see several TLS entries reported as WEAK and LOCAL and they could
cause the TLS issues I was experiencing?
I should probably read your blog to get a better understanding of this.
Thanks,
Saul