public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] mach, hurd: Drop __libc_lock_self0
@ 2023-04-02 23:28 Samuel Thibault
  0 siblings, 0 replies; only message in thread
From: Samuel Thibault @ 2023-04-02 23:28 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=af2942cc622809650b3158fe61d73a0de952a10a

commit af2942cc622809650b3158fe61d73a0de952a10a
Author: Sergey Bugaev <bugaevc@gmail.com>
Date:   Sun Mar 19 18:09:54 2023 +0300

    mach, hurd: Drop __libc_lock_self0
    
    This was used for the value of libc-lock's owner when TLS is not yet set
    up, so THREAD_SELF can not be used. Since the value need not be anything
    specific -- it just has to be non-NULL -- we can just use a plain
    constant, such as (void *) 1, for this. This avoids accessing the symbol
    through GOT, and exporting it from libc.so in the first place.
    
    Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
    Message-Id: <20230319151017.531737-12-bugaevc@gmail.com>

Diff:
---
 sysdeps/mach/hurd/Versions   | 4 ++--
 sysdeps/mach/hurd/cthreads.c | 4 ----
 sysdeps/mach/libc-lock.h     | 3 +--
 3 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/sysdeps/mach/hurd/Versions b/sysdeps/mach/hurd/Versions
index bf2e870a2a..20ac0067c7 100644
--- a/sysdeps/mach/hurd/Versions
+++ b/sysdeps/mach/hurd/Versions
@@ -20,7 +20,7 @@ libc {
     __open_nocancel;
     __read_nocancel; __pread64_nocancel;
     __write_nocancel;
-    __libc_lock_self0; __getcwd;
+    __getcwd;
     __stat64;
 
     _dl_init_first;
@@ -61,7 +61,7 @@ ld {
     __open_nocancel;
     __read_nocancel; __pread64_nocancel;
     __write_nocancel;
-    __libc_lock_self0; __getcwd;
+    __getcwd;
     __stat64; __fstat64;
   }
 }
diff --git a/sysdeps/mach/hurd/cthreads.c b/sysdeps/mach/hurd/cthreads.c
index 9f17cfe489..87b6c06b67 100644
--- a/sysdeps/mach/hurd/cthreads.c
+++ b/sysdeps/mach/hurd/cthreads.c
@@ -20,10 +20,6 @@
 #include <stdlib.h>
 #include <pthreadP.h>
 
-/* This serves as stub "self" pointer for libc locks when TLS is not initialized
-   yet.  */
-char __libc_lock_self0[0];
-
 /* Placeholder for key creation routine from Hurd cthreads library.  */
 int
 weak_function
diff --git a/sysdeps/mach/libc-lock.h b/sysdeps/mach/libc-lock.h
index 14248a0538..c5c2553c7b 100644
--- a/sysdeps/mach/libc-lock.h
+++ b/sysdeps/mach/libc-lock.h
@@ -34,9 +34,8 @@ typedef struct
 
 typedef __libc_lock_recursive_t __rtld_lock_recursive_t;
 
-extern char __libc_lock_self0[0];
 #define __libc_lock_owner_self()   \
-  (__LIBC_NO_TLS () ? (void *)&__libc_lock_self0 : THREAD_SELF)
+  (__LIBC_NO_TLS () ? (void *) 1 : THREAD_SELF)
 
 #else
 typedef struct __libc_lock_opaque__ __libc_lock_t;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-04-02 23:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-02 23:28 [glibc] mach, hurd: Drop __libc_lock_self0 Samuel Thibault

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).