From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id A1C433858D20 for ; Fri, 3 Feb 2023 12:37:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A1C433858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675427826; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0RZpJ88Fj3zqLpiw3talWQwQWxSdBKy8VMP4XRXGkV0=; b=Ans6f73XL5BlHp9Dq2vAg4WsYUi9gdwOzbSJgvUJQ2YaV4WP3yuFsqRjGXaiTJ1hsx5GxY iie3SKv2GoPNKd9yyvmkH25OOOCKUWk8ng9ALcWo3OABbuIM7zC8Ue2Xg9jHFkJhJOlXKD pvUsPQaSclsk3YtQo13/QsaOjMD99u4= Received: from mail-lj1-f200.google.com (mail-lj1-f200.google.com [209.85.208.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-642-aiCORRKsNPS1OITBtby_LQ-1; Fri, 03 Feb 2023 07:37:05 -0500 X-MC-Unique: aiCORRKsNPS1OITBtby_LQ-1 Received: by mail-lj1-f200.google.com with SMTP id y7-20020a05651c154700b002907d8e46e4so1231659ljp.6 for ; Fri, 03 Feb 2023 04:37:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=0RZpJ88Fj3zqLpiw3talWQwQWxSdBKy8VMP4XRXGkV0=; b=Q22VYAv3SvSd1VZPhFxqssX87ciTPM9E0QZ6+UIUCwcX10jIL3J8cXNavtpsP4PVp2 OoIFubA8CtAj1UXfYQ2my/qoo8kj4dbMl6q25NgKIdYCflw9ZCYuUrcNax8m6I9DCpnY x2Aa2lmIhMTAKfC1kwGVF1FSp/A4dYqgg0IRFY3jm/MscDS74DjLCQxYQMcy3Li0Din+ orDF6j9Uu00DwqszXEQjFz5B+s8wZj89p+YoERWEJ+CLq31lmPD7aCXiymZahuzaWeOh LZoRbG63QYZWNfX3Whj3DOQmTHbbNbcWATi9oHhSDxbJgDEIEtnTbrnkjz4hKI2BSpdE G5zQ== X-Gm-Message-State: AO0yUKXp3O+0uObiaefGMponvKb5lCP4hcC45kt5DUnz+ndPGYWm0Okk DXJTSq1j2VIU8fhGx1eA1+aWW4nITS0z2ANF67wzbLR663syNg3vj8ABSg73xjFZR19hbCYK1q5 9xG9270rE9t5EN5d7rJ3e7gZcbS9Aekk= X-Received: by 2002:a05:6512:3585:b0:4cd:24e8:911c with SMTP id m5-20020a056512358500b004cd24e8911cmr1751812lfr.209.1675427823877; Fri, 03 Feb 2023 04:37:03 -0800 (PST) X-Google-Smtp-Source: AK7set97pR3tOKwRS33n/JL+/g1hYaOQ81j4h1VX66PJ1hERUUYT5Qj0QETAYTKjGhdV6WgswJGNeGb0gs1I1HjPhG0= X-Received: by 2002:a05:6512:3585:b0:4cd:24e8:911c with SMTP id m5-20020a056512358500b004cd24e8911cmr1751806lfr.209.1675427823633; Fri, 03 Feb 2023 04:37:03 -0800 (PST) MIME-Version: 1.0 References: <20221007204506.cokw3lkkn5aequ5h@begin> In-Reply-To: <20221007204506.cokw3lkkn5aequ5h@begin> From: Jonathan Wakely Date: Fri, 3 Feb 2023 12:36:52 +0000 Message-ID: Subject: Re: [PATCHv2] libstdc++: Mark pieces of gnu-linux/os_support.h linux-specific To: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org, Jonathan Wakely , bug-hurd@gnu.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,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: On Fri, 7 Oct 2022 at 21:45, Samuel Thibault wrote: > > This is notably needed because in glibc 2.34, the move of pthread functions > into libc.so happened for Linux only, not GNU/Hurd. > > The pthread_self() function can also always be used fine as it is on > GNU/Hurd. Sorry for the delay, I'm going to push this to trunk today. > > libstdc++-v3/ChangeLog: > > * config/os/gnu-linux/os_defines.h [!__linux__] > (_GLIBCXX_NATIVE_THREAD_ID, _GLIBCXX_GTHREAD_USE_WEAK): Do not define. > > diff --git a/libstdc++-v3/config/os/gnu-linux/os_defines.h b/libstdc++-v3/config/os/gnu-linux/os_defines.h > index c0caa21a013..4de93d752e1 100644 > --- a/libstdc++-v3/config/os/gnu-linux/os_defines.h > +++ b/libstdc++-v3/config/os/gnu-linux/os_defines.h > @@ -49,22 +49,24 @@ > // version dynamically in case it has changed since libstdc++ was configured. > #define _GLIBCXX_NO_OBSOLETE_ISINF_ISNAN_DYNAMIC __GLIBC_PREREQ(2,23) > > -#if __GLIBC_PREREQ(2, 27) > -// Since glibc 2.27 pthread_self() is usable without linking to libpthread. > -# define _GLIBCXX_NATIVE_THREAD_ID pthread_self() > -#else > +#ifdef __linux__ > +# if __GLIBC_PREREQ(2, 27) > +// Since glibc 2.27 Linux' pthread_self() is usable without linking to libpthread. > +# define _GLIBCXX_NATIVE_THREAD_ID pthread_self() > +# else > // Before then it was in libc.so.6 but not libc.a, and always returns 0, > // which breaks the invariant this_thread::get_id() != thread::id{}. > // So only use it if we know the libpthread version is available. > // Otherwise use (__gthread_t)1 as the ID of the main (and only) thread. > -# define _GLIBCXX_NATIVE_THREAD_ID \ > - (__gthread_active_p() ? __gthread_self() : (__gthread_t)1) > -#endif > +# define _GLIBCXX_NATIVE_THREAD_ID \ > + (__gthread_active_p() ? __gthread_self() : (__gthread_t)1) > +# endif > > -#if __GLIBC_PREREQ(2, 34) > -// Since glibc 2.34 all pthreads functions are usable without linking to > +# if __GLIBC_PREREQ(2, 34) > +// Since glibc 2.34 all Linux pthreads functions are usable without linking to > // libpthread. > -# define _GLIBCXX_GTHREAD_USE_WEAK 0 > +# define _GLIBCXX_GTHREAD_USE_WEAK 0 > +# endif > #endif > > #endif >