]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
mach, hurd: Drop __libc_lock_self0
authorSergey Bugaev <bugaevc@gmail.com>
Sun, 19 Mar 2023 15:09:54 +0000 (18:09 +0300)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Sun, 2 Apr 2023 23:02:44 +0000 (01:02 +0200)
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>

sysdeps/mach/hurd/Versions
sysdeps/mach/hurd/cthreads.c
sysdeps/mach/libc-lock.h

index bf2e870a2a8303ad33bf191ab2eae9fe14512c78..20ac0067c7b7479571a92fd53cea1ac695a29309 100644 (file)
@@ -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;
   }
 }
index 9f17cfe489bcc3439f66dce95ff8220649e57fc5..87b6c06b67a37a12d39e7731a031d335d36bd22b 100644 (file)
 #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
index 14248a05386f4570c28b34fd63bebf5f19e89ced..c5c2553c7b9d589cbec35ffa70aca59a704235fd 100644 (file)
@@ -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;