From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 121573858023; Thu, 3 Dec 2020 12:37:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 121573858023 From: "hjl.tools at gmail dot com" To: glibc-bugs@sourceware.org Subject: [Bug dynamic-link/27004] ld.so is miscompiled by GCC 11 Date: Thu, 03 Dec 2020 12:37:15 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: dynamic-link X-Bugzilla-Version: 2.33 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: hjl.tools at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: security- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: glibc-bugs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-bugs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2020 12:37:16 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D27004 --- Comment #3 from H.J. Lu --- How about this diff --git a/sysdeps/x86_64/nptl/tls.h b/sysdeps/x86_64/nptl/tls.h index a08bf972de..4eeab0e7a9 100644 --- a/sysdeps/x86_64/nptl/tls.h +++ b/sysdeps/x86_64/nptl/tls.h @@ -180,11 +180,19 @@ _Static_assert (offsetof (tcbhead_t, __glibc_unused2)= =3D=3D 0x80, assignments like pthread_descr self =3D thread_self(); do not get optimized away. */ -# define THREAD_SELF \ +# if __GNUC_PREREQ (11, 0) +# define THREAD_SELF \ + ({ struct pthread *__self; = \ + __self =3D (struct pthread *) (__builtin_thread_pointer () = \ + + offsetof (struct pthread, header.self))= ; \ + __self;}) +# else +# define THREAD_SELF \ ({ struct pthread *__self; = \ asm ("mov %%fs:%c1,%0" : "=3Dr" (__self) = \ : "i" (offsetof (struct pthread, header.self))); = \ __self;}) +# endif /* Magic for libthread_db to know how to do THREAD_SELF. */ # define DB_THREAD_SELF_INCLUDE /* For the FS constant. */ --=20 You are receiving this mail because: You are on the CC list for the bug.=