public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/14898] New: Unable to create small static TLS block in shared library
@ 2012-11-30 17:12 bramesh.dev at gmail dot com
  2012-11-30 17:25 ` [Bug libc/14898] " carlos_odonell at mentor dot com
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: bramesh.dev at gmail dot com @ 2012-11-30 17:12 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=14898

             Bug #: 14898
           Summary: Unable to create small static TLS block in shared
                    library
           Product: glibc
           Version: 2.15
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: unassigned@sourceware.org
        ReportedBy: bramesh.dev@gmail.com
                CC: drepper.fsp@gmail.com
    Classification: Unclassified


Created attachment 6766
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6766
tarball to reproduce bug

If shared library declease a single TLS global variable of size 1 (one) byte,
and this TLS variable is accessed by the binary linking against it the shared
library doesnt get loaded because there is an error creating the static TLS
block. The attached test case shows both the failed and expected behavior.

Untar the files from the tar ball. To reproduce the bug please compile the
shared library as follows:

libfoo:
gcc -g -Wall -Wextra -fPIC -pthread -shared -DBUG -o libfoo.so  foo.c

test:
gcc -g -Wall -Wextra -DBUG -o test test.c -Wl,-rpath . -L . -lfoo

$ ./test
./test: error while loading shared libraries: ./libfoo.so: cannot allocate
memory in static TLS block

To get the expected behavior recompile the tests as follows

libfoo:
gcc -g -Wall -Wextra -fPIC -pthread -shared -o libfoo.so  foo.c

test:
gcc -g -Wall -Wextra -o test test.c -Wl,-rpath . -L . -lfoo

$ ./test
foo: 1
address of foo: 0x7f3d359c56fe

The behavior is same if the library is compiled without -pthread. I have tested
this bug in my system running Ubuntu precise using eglibc-2.15.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2014-06-14  7:44 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-30 17:12 [Bug libc/14898] New: Unable to create small static TLS block in shared library bramesh.dev at gmail dot com
2012-11-30 17:25 ` [Bug libc/14898] " carlos_odonell at mentor dot com
2012-11-30 20:21 ` schwab@linux-m68k.org
2012-12-02 23:05 ` maxim.kuvyrkov at gmail dot com
2012-12-04  0:01 ` carlos at systemhalted dot org
2012-12-04  2:40 ` maxim.kuvyrkov at gmail dot com
2012-12-04  2:47 ` maxim.kuvyrkov at gmail dot com
2012-12-04  3:46 ` bramesh.dev at gmail dot com
2012-12-04  9:23 ` schwab@linux-m68k.org
2012-12-04 22:49 ` bramesh.dev at gmail dot com
2012-12-05  6:24 ` maxim.kuvyrkov at gmail dot com
2012-12-05 21:40 ` bramesh.dev at gmail dot com
2012-12-05 22:49 ` law at redhat dot com
2013-01-14 14:13 ` schwab@linux-m68k.org
2014-06-14  7:44 ` fweimer at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).