From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4520 invoked by alias); 6 Aug 2013 23:14:41 -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 Received: (qmail 4413 invoked by uid 48); 6 Aug 2013 23:14:36 -0000 From: "ppluzhnikov at google dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/58066] GCC mis-compiles access to TLS variable with -fPIC on x86_64 Date: Tue, 06 Aug 2013 23:14:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ppluzhnikov at google dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-08/txt/msg00405.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58066 --- Comment #3 from Paul Pluzhnikov --- (In reply to Paul Pluzhnikov from comment #2) > What is the way to turn it on? Compiling test case with -mtls-dialect=gnu2 does appear to improve the picture: g++ -fPIC -O2 -S t.cc -mtls-dialect=gnu2 __cxa_get_globals: leaq _ZL3ccc@TLSDESC(%rip), %rax call *_ZL3ccc@TLSCALL(%rax) addq %fs:0, %rax ret The indirect call goes to _dl_tlsdesc_dynamic in ld-linux-x86-64.so.2 with misaligned stack, and the latter re-aligns it.