From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27634 invoked by alias); 27 Jun 2011 09:05:19 -0000 Received: (qmail 27624 invoked by uid 22791); 27 Jun 2011 09:05:19 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_LG X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 27 Jun 2011 09:05:04 +0000 From: "ebotcazou at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/49541] New: [4.6/4.7 regression] TLS support partially broken in 64-bit mode X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ebotcazou at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Mon, 27 Jun 2011 09:05:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-06/txt/msg02291.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49541 Summary: [4.6/4.7 regression] TLS support partially broken in 64-bit mode Product: gcc Version: 4.6.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassigned@gcc.gnu.org ReportedBy: ebotcazou@gcc.gnu.org Target: sparc-sun-solaris2.8 The new TLS support on SPARC/Solaris 8 is partially broken in 64-bit mode. This is visible with gcc.dg/tls/opt-12.c: (botcazou@nile) /nile.build/botcazou/gcc-4.6/sparc-sun-solaris2.8 $ gcc/xgcc -Bgcc -o opt-12 opt-12.c -fpic -O2 -pthread (botcazou@nile) /nile.build/botcazou/gcc-4.6/sparc-sun-solaris2.8 $ gcc/xgcc -Bgcc -o opt-12 opt-12.c -fpic -O2 -pthread -m64 Undefined first referenced symbol in file __tls_get_addr /var/tmp//cc0nZy21.o ld: fatal: Symbol referencing errors. No output written to opt-12 collect2: ld returned 1 exit status This is with the Sun linker. The difference between 32-bit and 64-bit mode is that the driver inserts -L entries on the link line: gcc/collect2 -V -Y P,/usr/ccs/lib:/usr/lib -Qy -o opt-12 gcc/crt1.o gcc/crti.o /usr/ccs/lib/values-Xa.o gcc/crtbegin.o -Lgcc -L/usr/ccs/lib /var/tmp//ccLfjSjm.o -lgcc -lgcc_eh -L/usr/lib/lwp -R/usr/lib/lwp -lpthread -lthread -lc -lgcc -lgcc_eh -L/usr/lib/lwp -R/usr/lib/lwp -lpthread -lthread -lc gcc/crtend.o gcc/crtn.o gcc/collect2 -V -Y P,/usr/lib/sparcv9 -Qy -o opt-12 gcc/sparcv9/crt1.o gcc/sparcv9/crti.o /usr/ccs/lib/sparcv9/values-Xa.o gcc/sparcv9/crtbegin.o -Lgcc/sparcv9 -L/usr/ccs/lib/sparcv9 -L/lib/sparcv9 -L/usr/lib/sparcv9 -Lgcc -L/usr/ccs/lib /var/tmp//ccMywo2Z.o -lgcc -lgcc_eh -L/usr/lib/lwp/64 -R/usr/lib/lwp/64 -lpthread -lthread -lc -lgcc -lgcc_eh -L/usr/lib/lwp/64 -R/usr/lib/lwp/64 -lpthread -lthread -lc gcc/sparcv9/crtend.o gcc/sparcv9/crtn.o The problematic one is /lib/sparcv9. It causes /lib/sparcv9/libthread.so to be seen before /usr/lib/lwp/sparcv9/libthread.so. Now the latter provides the missing symbol __tls_get_addr while the former doesn't (we have the same setup with /lib/libthread.so and /usr/lib/lwp/libthread.so in 32-bit mode). This is a regression in the sense that the testcase links with GCC 4.5.x.