[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#211610: gcc-3.3: Simple TLS code segfaults



Thanks for the help.

GOTO Masanori <gotom@debian.or.jp> writes:

> severity 211610 wishlist
> reassign 211610 glibc
> thanks
>
> At Thu, 18 Sep 2003 18:17:42 -0500,
> Andr�Rold�wrote:
>> When trying to executing a binary with the __thread keywork, the program
>> segfaults. Below is the output.
>> 
>> [pts/0]
>> aroldan@volatile:~$ cat tls.c
>> __thread int a;
>> 
>> int 
>> main (void)
>> {
>>         return a;
>> }
>> [pts/0]
>> aroldan@volatile:~$ gcc-3.3 -Wall -o tls tls.c
>> [pts/0]
>> aroldan@volatile:~$ ./tls
>> Segmentation fault (core dumped)
>> [pts/0]
>> aroldan@volatile:~$ gdb tls core
>> GNU gdb 5.3.90_2003-08-24-cvs-debian
>> Copyright 2003 Free Software Foundation, Inc.
>> GDB is free software, covered by the GNU General Public License, and you are
>> welcome to change it and/or distribute copies of it under certain conditions.
>> Type "show copying" to see the conditions.
>> There is absolutely no warranty for GDB.  Type "show warranty" for details.
>> This GDB was configured as "i386-linux"...(no debugging symbols found)...
>> Core was generated by `./tls'.
>> Program terminated with signal 11, Segmentation fault.
>> Reading symbols from /lib/libc.so.6...(no debugging symbols found)...done.
>> Loaded symbols for /lib/libc.so.6
>> Reading symbols from /lib/ld-linux.so.2...(no debugging symbols found)...done.
>> Loaded symbols for /lib/ld-linux.so.2
>> #0  0x08048344 in main ()
>> (gdb) disas main
>> Dump of assembler code for function main:
>> 0x08048334 <main+0>:    push   %ebp
>> 0x08048335 <main+1>:    mov    %esp,%ebp
>> 0x08048337 <main+3>:    sub    $0x8,%esp
>> 0x0804833a <main+6>:    and    $0xfffffff0,%esp
>> 0x0804833d <main+9>:    mov    $0x0,%eax
>> 0x08048342 <main+14>:   sub    %eax,%esp
>> 0x08048344 <main+16>:   mov    %gs:0x0,%eax
>
> This is because glibc's dl does not support tls currently on i386, so
> %gs:0 does not setup correctly for this purpose.
>
> Regards,
> -- gotom
>

-- 
Andres Roldan <aroldan@fluidsignal.com>
GPG Key-ID: 0xB29396EB

Attachment: pgpg6sOcKAv4T.pgp
Description: PGP signature


Reply to: