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 B65FA3858296 for ; Thu, 9 Nov 2023 08:21:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B65FA3858296 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B65FA3858296 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699518074; cv=none; b=JT0OtRMHL7uKPyJDJ0tBXDCh8V55aGc4xNWcyAgr7orrtIa82K7XfH1oTNkCCpih6AXFb8mm8Cd7aWxKC3+uIgbgepx+K3i0jDxiSDvLmlPQ2AGDk7wZSEmrXFrydUZIkcY554rRUdXpLRXlCiQMg0pL4iZjAneFmDjoe6KYmrw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699518074; c=relaxed/simple; bh=rTWWAPNRfBFLC2N2XOfpniwDydc93DIs3Hyn3zkGtGo=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=u+NRhWf6lKSgDK2f78QDRbvyO7e39Xq/AMeZ8ci+iK1mF3gPzcmWb3q+Xi1xcSc6KPW1YHQ3auqi7Gz/JQ8bKIjYgtpCW6k4K5LuRP8wGqnPPWILbV5/299TDyQQMPtyqyv66Bsy2NqLawHifOEgqeeBbAgf4EVSiJP9goV02gw= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1699518072; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=hLLjkzL4NSN3MyfcGV4M61jrZndYHVHNO3S8KEuuQkw=; b=iiLHT1F8PDNg6oo/on707AFxr8H4Uuz1JQ5W28m+5Knp/LVd3WInn7POuhc4fYod26n0bM J2Wp3xTk1UVDgZOmVooP/f7rpv0FBlcwr/jOqP+moOfGISKa/ykxHjaduq1O2jW9s38tUR Itq1gy3X1BSyjyKdzCZ6drSLhYyEx0k= Received: from mail-yw1-f199.google.com (mail-yw1-f199.google.com [209.85.128.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-664-oSrbCj6IO9-LvEVEP-J3fA-1; Thu, 09 Nov 2023 03:21:11 -0500 X-MC-Unique: oSrbCj6IO9-LvEVEP-J3fA-1 Received: by mail-yw1-f199.google.com with SMTP id 00721157ae682-5b02ed0f886so8866957b3.0 for ; Thu, 09 Nov 2023 00:21:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699518070; x=1700122870; 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=hLLjkzL4NSN3MyfcGV4M61jrZndYHVHNO3S8KEuuQkw=; b=P+JWNEdD5NyYpITXsy5kA3wd9q2DefJoVA6XrZfF/CdMV1EzV2lzvedVeFaQOqDmw6 1zYNPK8OEVYAZNvANLDDy2GisRr7hIo0SZQyJRCIEs8HSE37ALWAM4zp/rriBkvB3tP5 B6v2CCaFkF4JJRbXvjBOpJgAxSkmyBGMJcg6mlhHwbH2jAGGp9ruM6rsnrYvaf8gdjom fKwCQ2vpjf1tRUS7zGQv6cuirzwWpFiABsonCcwNWMDcgCSGXzrWeO+kE5banWNy4jXx JXg+Db+HLcFwDyUzd72gII1e/lW9j1GvKneTpT+Dky74yQ2hjjiVnctIeJS/sR5ZDYw0 7pyQ== X-Gm-Message-State: AOJu0Yy8gRnUPtE9CjCX1iaxAOSuxwhzRDFfwT0S5yfmEbEvz57nA1gF RJCqg6H88asjZnyAahpOkzRP6UY1ySPeTiT3swE8z15J0duoRBusrM7SJps8ZRLM/ekZtMUodOR ExnBlQ263chbhtMCjccGE/ftN8OQB1XopQA== X-Received: by 2002:a81:a00b:0:b0:5a7:ba53:6544 with SMTP id x11-20020a81a00b000000b005a7ba536544mr4590659ywg.12.1699518070672; Thu, 09 Nov 2023 00:21:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IHfIX/J5Ebx0Q+YvKP+miStIqi6mHGpClgHPXVUpKCIKk7AapZEjMzG1eKDp9ALVXmKepwO7VpWtiBNyzUrchY= X-Received: by 2002:a81:a00b:0:b0:5a7:ba53:6544 with SMTP id x11-20020a81a00b000000b005a7ba536544mr4590650ywg.12.1699518070443; Thu, 09 Nov 2023 00:21:10 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Jonathan Wakely Date: Thu, 9 Nov 2023 08:20:59 +0000 Message-ID: Subject: Re: [PATCH] libsupc++: try cxa_thread_atexit_impl at runtime To: Alexandre Oliva Cc: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org, Jason Merrill X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-12.2 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_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE,WEIRD_QUOTING 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 Thu, 9 Nov 2023 at 01:56, Alexandre Oliva wrote: > > > g++.dg/tls/thread_local-order2.C fails when the toolchain is built for > a platform that lacks __cxa_thread_atexit_impl, even if the program is > built and run using that toolchain on a (later) platform that offers > __cxa_thread_atexit_impl. > > This patch adds runtime testing for __cxa_thread_atexit_impl on > platforms that support weak symbols. > > Regstrapped on x86_64-linux-gnu, also tested with gcc-13 on i686- and > x86_64-, and with ac_cv_func___cxa_thread_atexit_impl=no, that, on a > distro that lacks __cxa_thread_atexit in libc, forces the newly-added > code to be exercised, and that enabled thread_local-order2.C to pass > where the runtime libc has __cxa_thread_atexit_impl. Ok to install? Seems fine to me. Any objections, Jason? > > > for libstdc++-v3/ChangeLog > > * libsupc++/atexit_thread.cc [__GXX_WEAK__]: Add dynamic > detection of __cxa_thread_atexit_impl. > --- > libstdc++-v3/libsupc++/atexit_thread.cc | 15 ++++++++++++++- > 1 file changed, 14 insertions(+), 1 deletion(-) > > diff --git a/libstdc++-v3/libsupc++/atexit_thread.cc b/libstdc++-v3/libsupc++/atexit_thread.cc > index 9346d50f5dafe..cabd7c0a4a057 100644 > --- a/libstdc++-v3/libsupc++/atexit_thread.cc > +++ b/libstdc++-v3/libsupc++/atexit_thread.cc > @@ -138,11 +138,24 @@ namespace { > } > } > > +#if __GXX_WEAK__ > +extern "C" > +int __attribute__ ((__weak__)) > +__cxa_thread_atexit_impl (void (_GLIBCXX_CDTOR_CALLABI *func) (void *), > + void *arg, void *d); > +#endif > + > +// ??? We can't make it an ifunc, can we? > extern "C" int > __cxxabiv1::__cxa_thread_atexit (void (_GLIBCXX_CDTOR_CALLABI *dtor)(void *), > - void *obj, void */*dso_handle*/) > + void *obj, void *dso_handle) > _GLIBCXX_NOTHROW > { > +#if __GXX_WEAK__ > + if (__cxa_thread_atexit_impl) > + return __cxa_thread_atexit_impl (dtor, obj, dso_handle); > +#endif > + > // Do this initialization once. > if (__gthread_active_p ()) > { > > -- > Alexandre Oliva, happy hacker https://FSFLA.org/blogs/lxo/ > Free Software Activist GNU Toolchain Engineer > More tolerance and less prejudice are key for inclusion and diversity > Excluding neuro-others for not behaving ""normal"" is *not* inclusive >