Bug 1080660

Summary: [Fedora] Can't access TLS variables in statically linked binaries
Product: [Fedora] Fedora Reporter: Ben Woodard <woodard>
Component: gdbAssignee: Jan Kratochvil <jan.kratochvil>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 20CC: gbenson, jan.kratochvil, mfranc, palves, pmuldoon, sergiodj, tgummels, tromey
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: gdb-7.7.1-13.fc20 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1080656 Environment:
Last Closed: 2014-05-21 23:20:46 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 975551    
Attachments:
Description Flags
reproducer none

Description Ben Woodard 2014-03-25 21:41:57 UTC
Created attachment 878705 [details]
reproducer

+++ This bug was initially created as a clone of Bug #1080656 +++

Description of problem:
When you have a statically linked binary you can't access the tls data through gdb

Version-Release number of selected component (if applicable):
All. This problem exists in 6.4, 6.5, rhel7, F20 and even the upstream trunk version GDB

How reproducible:
always everywhere


Steps to Reproduce:
sierra648{jdelsign}82: gcc -g -o tls tls.c -pthread -static
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/libpthread.a(libpthread.o): In function `sem_open':
(.text+0x764d): warning: the use of `mktemp' is dangerous, better use `mkstemp'
sierra648{jdelsign}83: gdb tls
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-60.el6_4.1)
...
Reading symbols from /g/g0/jdelsign/tls...done.
(gdb) b 12
Breakpoint 1 at 0x400511: file tls.c, line 12.
(gdb) run
Starting program: /g/g0/jdelsign/tls 
[Thread debugging using libthread_db enabled]
[New Thread 0x2aaaaacac700 (LWP 6735)]
thread_local_p: & == 00002aaaaacac6c0, . == 00002aaaaacabd1c, * == 1
[Switching to Thread 0x2aaaaacac700 (LWP 6735)]

Breakpoint 1, start_routine (arg=0x1) at tls.c:12
12        return arg;

Actual results:
(gdb) p thread_local_p
Cannot find executable file `/g/g0/jdelsign/tls' in dynamic linker's load module list

Expected results:
It print's the variable

Additional info:

--- Additional comment from Ben Woodard on 2014-03-25 17:40:32 EDT ---

Comment 1 Jan Kratochvil 2014-05-05 20:41:38 UTC
Rawhide: gdb-7.7-8.fc21

Comment 2 Fedora Update System 2014-05-09 20:47:30 UTC
gdb-7.7.1-11.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/gdb-7.7.1-11.fc20

Comment 3 Fedora Update System 2014-05-12 05:24:33 UTC
Package gdb-7.7.1-11.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing gdb-7.7.1-11.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-6252/gdb-7.7.1-11.fc20
then log in and leave karma (feedback).

Comment 4 Fedora Update System 2014-05-12 20:14:11 UTC
gdb-7.7.1-12.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/gdb-7.7.1-12.fc20

Comment 5 Fedora Update System 2014-05-14 19:52:15 UTC
gdb-7.7.1-13.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/gdb-7.7.1-13.fc20

Comment 6 Fedora Update System 2014-05-21 23:20:46 UTC
gdb-7.7.1-13.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.