public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hjl.tools at gmail dot com" <sourceware-bugzilla@sourceware.org>
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	[thread overview]
Message-ID: <bug-27004-131-9y3b79Csj5@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-27004-131@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=27004

--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> ---
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) ==
0x80,
    assignments like
        pthread_descr self = thread_self();
    do not get optimized away.  */
-# define THREAD_SELF \
+# if __GNUC_PREREQ (11, 0)
+#  define THREAD_SELF \
+  ({ struct pthread *__self;                                                 \
+     __self = (struct pthread *) (__builtin_thread_pointer ()                \
+                                 + offsetof (struct pthread, header.self));  \
+     __self;})
+# else
+#  define THREAD_SELF \
   ({ struct pthread *__self;                                                 \
      asm ("mov %%fs:%c1,%0" : "=r" (__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  <sys/reg.h> /* For the FS constant.  */

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2020-12-03 12:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-02 23:06 [Bug dynamic-link/27004] New: " hjl.tools at gmail dot com
2020-12-02 23:51 ` [Bug dynamic-link/27004] " hjl.tools at gmail dot com
2020-12-03  3:47 ` carlos at redhat dot com
2020-12-03 10:16 ` fweimer at redhat dot com
2020-12-03 11:24 ` jakub at redhat dot com
2020-12-03 12:37 ` hjl.tools at gmail dot com [this message]
2020-12-03 12:43 ` fweimer at redhat dot com
2020-12-03 12:51 ` jakub at redhat dot com
2020-12-03 12:51 ` hjl.tools at gmail dot com
2020-12-03 12:52 ` fweimer at redhat dot com
2020-12-03 12:53 ` fweimer at redhat dot com
2020-12-08  0:46 ` hjl.tools at gmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-27004-131-9y3b79Csj5@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).