From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by sourceware.org (Postfix) with ESMTPS id 29287385482E for ; Sun, 19 Mar 2023 15:11:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 29287385482E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-x12d.google.com with SMTP id x17so12032389lfu.5 for ; Sun, 19 Mar 2023 08:11:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679238666; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=n5qnjamGL6L50YLtkivx/HLikKh0TeiapuAPgEY9ank=; b=f+TMYhJtbt60d6G0bfwh4/nA44P6sppqpPHIr63rfMy+/4CP8HzpamqmWQJksTeQ4I EvsA2++C9VSHAm2UMsmMkAydTQOzuOP1Ap6aKDOYVWDaYWjJoKFhbmgMtDhNW5HWI8Ia N6WIpiUj8gcs2CNoCXuByN6hY91eIeW8E3/x/xjuAAdXevpSgbDHbSnf/MLn249T8poo ISbOytmv+OQQzOOri+3E4kbjDZGcJBDkLwskYdmIwkn4Nkqtvj4g6VDDeq7Ui10LzJmT Wl5fiNJfLdtpgfxjPjGtsTXiMaXXDu3Qjslk8BcKJqcJT8ibUYTWuHUANgYXk7yVdCva AmHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679238666; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=n5qnjamGL6L50YLtkivx/HLikKh0TeiapuAPgEY9ank=; b=dY/TzBQsFMJKcbNoC6xUNaX1YPVHR/c8gTAnw6IvZIiRkhh7572E4R9Coz2uSIL8fk Jhb1ylN9AqAlia4UYhW0Ny6XCAK2irsFl12zsjbh1HcCfWdY2BMY6zWC31QC8iFjzpUW +wqVx3cXh1qwJBiPx3oJr8PhwQrRk9gUvcfaAm3NwU9gbFekR9K2qcPfsQrjJ6bBBxKT WK5WfP8ckLnbxoHmY7M1tdg00Z2Rjy9eVcu0PYko597KABmsu5upUR3WevcwbG3QHpfB gfLlIfSnBaiQCBNsW/sOimILHlu9NPLV1toIZJetVD6cpkAOm5EBbH2bNOSVrjinXSzS hiTw== X-Gm-Message-State: AO0yUKW+sm0hPvCXro1hrkzFPtPchFiGkIgjCdO9Z411iptwIsNC7GW8 eoqqa1nS4FvaJjAEloESAEQBp3cIZm5nGA== X-Google-Smtp-Source: AK7set89ftJKNFQq907Z65dPk+aZG0GlmKUhmmKdunVjVbs9h1723gmxGjGWiLzk+MErVyus7spdfQ== X-Received: by 2002:ac2:4145:0:b0:4b5:2cf4:cc1d with SMTP id c5-20020ac24145000000b004b52cf4cc1dmr5636180lfi.68.1679238666453; Sun, 19 Mar 2023 08:11:06 -0700 (PDT) Received: from surface-pro-6.. ([2a00:1370:818c:4a57:577a:76f4:df43:5e66]) by smtp.gmail.com with ESMTPSA id m19-20020ac24253000000b004e90dee5469sm1274089lfl.157.2023.03.19.08.11.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Mar 2023 08:11:06 -0700 (PDT) From: Sergey Bugaev To: libc-alpha@sourceware.org, bug-hurd@gnu.org Cc: Samuel Thibault , Sergey Bugaev Subject: [RFC PATCH glibc 11/34] mach, hurd: Drop __libc_lock_self0 Date: Sun, 19 Mar 2023 18:09:54 +0300 Message-Id: <20230319151017.531737-12-bugaevc@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230319151017.531737-1-bugaevc@gmail.com> References: <20230319151017.531737-1-bugaevc@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,KAM_NUMSUBJECT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,URIBL_BLACK autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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 --- 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 #include -/* 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