From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6483 invoked by alias); 30 Nov 2012 17:12:24 -0000 Received: (qmail 6351 invoked by uid 48); 30 Nov 2012 17:12:01 -0000 From: "bramesh.dev at gmail dot com" To: glibc-bugs@sources.redhat.com Subject: [Bug libc/14898] New: Unable to create small static TLS block in shared library Date: Fri, 30 Nov 2012 17:12:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: libc X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: bramesh.dev at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org X-SW-Source: 2012-11/txt/msg00278.txt.bz2 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.