[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH glibc 11/34] mach, hurd: Drop __libc_lock_self0
From: |
Sergey Bugaev |
Subject: |
[RFC PATCH glibc 11/34] mach, hurd: Drop __libc_lock_self0 |
Date: |
Sun, 19 Mar 2023 18:09:54 +0300 |
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>
---
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 bf2e870a..20ac0067 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 9f17cfe4..87b6c06b 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 14248a05..c5c2553c 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;
--
2.39.2
- [RFC PATCH glibc 04/34] hurd: Make exception subcode a long, (continued)
- [RFC PATCH glibc 04/34] hurd: Make exception subcode a long, Sergey Bugaev, 2023/03/19
- [RFC PATCH glibc 05/34] hurd: Remove __hurd_threadvar_stack_{offset, mask}, Sergey Bugaev, 2023/03/19
- [RFC PATCH glibc 09/34] hurd: Fix _hurd_setup_sighandler () signature, Sergey Bugaev, 2023/03/19
- [RFC PATCH glibc 06/34] hurd: Swap around two function calls, Sergey Bugaev, 2023/03/19
- [RFC PATCH glibc 07/34] hurd: Fix file name in #error, Sergey Bugaev, 2023/03/19
- [RFC PATCH glibc 12/34] hurd: More 64-bit integer casting fixes, Sergey Bugaev, 2023/03/19
- [RFC PATCH glibc 13/34] x86-64: Disable prefer_map_32bit_exec tunable on non-Linux, Sergey Bugaev, 2023/03/19
- [RFC PATCH glibc 14/34] hurd: Move rtld-strncpy-c.c out of mach/hurd/, Sergey Bugaev, 2023/03/19
- [RFC PATCH glibc 15/34] hurd: Use uintptr_t for register values in trampoline.c, Sergey Bugaev, 2023/03/19
- [RFC PATCH glibc 10/34] stdio-common: Fix building when !IS_IN (libc), Sergey Bugaev, 2023/03/19
- [RFC PATCH glibc 11/34] mach, hurd: Drop __libc_lock_self0,
Sergey Bugaev <=
- [RFC PATCH glibc 08/34] hurd: Disable O_TRUNC and FS_RETRY_MAGICAL in rtld, Sergey Bugaev, 2023/03/19
- [RFC PATCH glibc 17/34] hurd: Implement x86_64/intr-msg.h, Sergey Bugaev, 2023/03/19
- [RFC PATCH glibc 16/34] hurd: Add sys/ucontext.h and sigcontext.h for x86_64, Sergey Bugaev, 2023/03/19
- [RFC PATCH glibc 18/34] hurd: Port trampoline.c to x86_64, Sergey Bugaev, 2023/03/19
- [RFC PATCH glibc 19/34] hurd: Move a couple of singal-related files to x86, Sergey Bugaev, 2023/03/19
- [RFC PATCH glibc 24/34] hurd: Only check for TLS initialization inside rtld or in static builds, Sergey Bugaev, 2023/03/19
- [RFC PATCH glibc 21/34] x86_64: Add rtld-stpncpy & rtld-strncpy, Sergey Bugaev, 2023/03/19
- [RFC PATCH glibc 23/34] elf: Stop including tls.h in ldsodefs.h, Sergey Bugaev, 2023/03/19
- [RFC PATCH glibc 25/34] hurd: Improve reply port handling when exiting signal handlers, Sergey Bugaev, 2023/03/19
- [RFC PATCH glibc 22/34] htl: Implement thread_set_pcsptp for x86_64, Sergey Bugaev, 2023/03/19