From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by sourceware.org (Postfix) with ESMTPS id D4A9F3851893; Sun, 4 Dec 2022 12:36:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D4A9F3851893 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-ej1-x62c.google.com with SMTP id bj12so21743419ejb.13; Sun, 04 Dec 2022 04:36:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=fBsRJ7Awaq7AWMAEA4g96pLxxCFGo0VgMa5gUkDjPyY=; b=M3USMeGPe0XFXSBAGo9FuF9MC1IGmCZeg9agv6wGH0yuy5g93BN70sAEIse7VrIMdZ /RDPyQK0hGFEHUjPJtHAGY/nqG+ZbpyFstqZ7r7r7c8FVIr9iumJjOtpy62RXSCiO61q 5xs7QPXOsEX9wvJONtTejFKvVRQROyckUrhOezEYs9UcB1NVOoqZAp3aeeWmHV/6h9ch yK0bfXlaDY8iFULSRUhRQ0qDYidA2+TiUS0G1c9pjzIaW287BIhYy3/OGaqK5fieMudi w8Zk4NPlT530xYs92aHKOIzHFnPWcmF9p0KYfJtOknhOWHGhSulVjwwNDUhgosATjD6s fPOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=fBsRJ7Awaq7AWMAEA4g96pLxxCFGo0VgMa5gUkDjPyY=; b=rqlGqY2IxmrpPS5+XxGDaqCkz1ZLF/5TkpCYmwGdm1WhAs5kMjZFoXMZVqLv3Bzfdl eDQm54y5K7ogaNnw7y6PQV5ve3kbm3WGEVa3s/RFOYVOommAF5AAJnlRcbeeGy0YbgtN Aor66lKMSQMCg2XZ3/F/eOrMCUDUSL4C7d0f27iDF4P1ZwWd2PME8PD16zYOdD+Ruo4Y MxRjrQGsjGQmy5aRUtRrd5LZB5grP/Kr1FB6k6BgyaNjsDyY0pf+MmhQV9hgeZsSX9uF l2GhdHN75RLfJfLECay6Oo5WAteuqm2qSPkrnkbPnIQZZvJnjZBOsHauhqOHsYPJ4jSo Kmwg== X-Gm-Message-State: ANoB5plEIHH9O3mIyJBuHbgwa4Q+2t9uWYDxVLJ3dVJbNO+vSdMaL2Q1 r6QLyAAxs0IRleBdZ5bALT46lvv1OhkMnCYQGyD4K3vq X-Google-Smtp-Source: AA0mqf4fOUr0zo8ewKbL7AheOqrNnLch9v7+2bTCV9/KUXkl82PQQmIvyMaCDFEzEAqx0O7Ng65BJlbB3r4unMb0m1Q= X-Received: by 2002:a17:907:77ce:b0:7c0:8225:54d with SMTP id kz14-20020a17090777ce00b007c08225054dmr22042564ejc.286.1670157399804; Sun, 04 Dec 2022 04:36:39 -0800 (PST) MIME-Version: 1.0 References: <20221204110815.34872-1-iain@sandoe.co.uk> In-Reply-To: <20221204110815.34872-1-iain@sandoe.co.uk> From: Jonathan Wakely Date: Sun, 4 Dec 2022 12:36:28 +0000 Message-ID: Subject: Re: [PATCH] libstdc++, Darwin: Limit recursive mutex init to OS versions needing it. To: Iain Sandoe Cc: "libstdc++" , gcc-patches , Iain Sandoe Content-Type: multipart/alternative; boundary="00000000000088d2e205eeffd214" X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP 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: --00000000000088d2e205eeffd214 Content-Type: text/plain; charset="UTF-8" On Sun, 4 Dec 2022, 11:08 Iain Sandoe via Libstdc++, wrote: > While looking at Darwin's os_defines, I wondered whether > _GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC was really still necessary. On > checking > the OS, it seems that it was a transient problem that only appears in > Darwin11. > Earlier versions do not have the initializer, and the operation is fixed in > Darwin12+. So, I figure we still need the workaround for Darwin8-11 but > not > later versions (patch implements this). > > Testing on both earlier and later systems does not (as one might expect) > reveal > any differences (we still have some lock-related tests that 'twinkle' so > that > there can be something still hidden by that). > > Anyway. the question is. "is there any reason not to use the system > version of > this where it works, or should I just leave the status quo?" If the > former, > then "ok for master?". > Using the initializer seems preferable when it works, so ok for master, thanks. > thanks > Iain > > -- >8 -- > > The problem described in pr 51906 was fixed in the next OS release. Limit > the > workaround to systems that need it. > > Signed-off-by: Iain Sandoe > > libstdc++-v3/ChangeLog: > > * config/os/bsd/darwin/os_defines.h > (_GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC): Limit use of this macro > to OS versions that need it. > --- > libstdc++-v3/config/os/bsd/darwin/os_defines.h | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/libstdc++-v3/config/os/bsd/darwin/os_defines.h > b/libstdc++-v3/config/os/bsd/darwin/os_defines.h > index 38fdfb5f6f0..5b611d32e0d 100644 > --- a/libstdc++-v3/config/os/bsd/darwin/os_defines.h > +++ b/libstdc++-v3/config/os/bsd/darwin/os_defines.h > @@ -39,8 +39,12 @@ > // implementation is not itself a weak definition). > #define _GLIBCXX_WEAK_DEFINITION __attribute__ ((__weak__)) > > -// Static initializer macro is buggy in darwin, see libstdc++/51906 > +#if defined (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) \ > + && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1080) > +// Static initializer macro is absent for Darwin < 11 and buggy in Darwin > 11, > +// see libstdc++/51906. Fixed in Darwin 12 (OS X 10.8). > #define _GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC > +#endif > > // Configure checks for nanosleep fail on Darwin, but nanosleep and > // sched_yield are always available, so use them. > -- > 2.37.1 (Apple Git-137.1) > > --00000000000088d2e205eeffd214--