This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/14898] New: Unable to create small static TLS block in shared library


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]