From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ciao.gmane.io (ciao.gmane.io [116.202.254.214]) by sourceware.org (Postfix) with ESMTPS id 202B83858C2F for ; Wed, 24 Jan 2024 17:23:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 202B83858C2F Authentication-Results: sourceware.org; dmarc=fail (p=quarantine dis=none) header.from=gmx.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=m.gmane-mx.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 202B83858C2F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=116.202.254.214 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706117037; cv=none; b=eZv6MUjPpkrsue3BmXSky471C1CvqiVVJfWtxImFoCZn3dA4+80d0Mnp8faigGve2ZFnYkecUwtfMS1uRafWW8m8YVKqy6ozBFFr0zCnvEqAVs6n1T+zhR/fqm1bZtpfyLHmqQ7DGLzdtoO3e798N5iDZLdQbi7oW70I2+exHuU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706117037; c=relaxed/simple; bh=MTnl0RTNBbL9p/c/i6X4+AH4Q8rcAo3bHL8uMdhhWIU=; h=To:From:Subject:Date:Message-ID:Mime-Version; b=qw3kb+w4MZPJ2yxvnyQfCvKe/o6aR+3MB4HIVT1SSubknDC9QfHkIigwhAWGlbbnpnOri46WCllNJAf1iM075ec0Uprpq8r0A0gRwE//zsOGtoO7DiS5exj9OY585gTw8KiQN8CfFitqL5MSBDMkMEgK8gpvzKH/8YF6c72H3Og= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1rSgyg-0007zS-Sd for gcc-patches@gcc.gnu.org; Wed, 24 Jan 2024 18:23:54 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: gcc-patches@gcc.gnu.org From: Harald Anlauf Subject: Re: [Fortran] half-cycle trig functions and atan[d] fixes Date: Wed, 24 Jan 2024 18:23:48 +0100 Message-ID: <9a16315d-8a5f-4059-9506-d82a7d8a2d6e@gmx.de> References: <0840023D-FF1D-47B5-B75F-806913399880@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit User-Agent: Mozilla Thunderbird Content-Language: en-US In-Reply-To: Cc: fortran@gcc.gnu.org X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Am 24.01.24 um 10:13 schrieb Janne Blomqvist: > On Wed, Jan 24, 2024 at 10:28 AM FX Coudert wrote: >>> Now, if >>> the OS adds cospi() to libm and it's in libm's symbol map, then the >>> cospi() used by gfortran depends on the search order of the loaded >>> libraries. >> >> We only include the fallback math functions in libgfortran when they are not available on the system. configure detects what is present in the libc being targeted, and conditionally compiles the necessary fallback functions (and only them). > > Exactly. However, there is the (corner?) case when libgfortran has > been compiled, and cospi() not found and thus the fallback > implementation is included, and then later libc is updated to a > version that does provide cospi(). I believe in that case which > version gets used is down to the library search order (i.e. the order > that "ldd /path/to/binary" prints the libs), it will use the first > symbol it finds. Also, it's not necessary to do some ifdef tricks > with gfortran.map, if a symbol listed there isn't found in the library > it's just ignored. So the *pi() trig functions can be unconditionally > added there, and then depending on whether the target libm includes > those or not they are then included in the exported symbol list. > > It's possible to override this to look for specific symbol versions > etc., but that probably goes deep into the weeds of target-specific > stuff (e.g. are we looking for cospi@FBSD_1.7, cospi@GLIBC_X.Y.Z, or > something else?). I'm sure you don't wanna go there. > Isn't this something that could be addressed by __attribute__(__weakref__)? From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by sourceware.org (Postfix) with ESMTPS id AC36C385841E; Wed, 24 Jan 2024 17:23:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AC36C385841E Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmx.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org AC36C385841E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=212.227.15.19 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706117040; cv=none; b=TEQUzlXxhjn3+IAelfnsjU28/uXFQFp+uMGhDEni4iyxFPdtAiMP8zvsrxcF2ekwxo6W/cJUIV0o1SMs7RaY3k81hyNzFDipt+U6ZOu98xcu5bH5KEJ0iZctNNftD03UfpZXR1+n0g9YmqgfxBPYjB9X3aRkV9CnsNcRwos5J3M= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706117040; c=relaxed/simple; bh=y/fM8wJALuSWh4pawx3DQtwUOrWpbkETFQNfltmj39E=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=gpeJAgaMVX5aInICKKMzF4Cwgly4/AfeRoQCgu4RicOJ12BKe6ML+rKo/OW8Ge4L//2fZV42oI51sq0r34NR3FHttzKhI22M3UEt/CSctI9GjcOEMg0N4+AzCniMPzMHvwpip2WOYZQqnofQ7qpOdQgvSge9fH8xmf90BZXr9/E= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1706117032; x=1706721832; i=anlauf@gmx.de; bh=y/fM8wJALuSWh4pawx3DQtwUOrWpbkETFQNfltmj39E=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From: In-Reply-To; b=FVqeeZEwl/donpl+5JZ5MhpbXk/6+5lG/zM6oiID/ZZZECTtXpkhZWTqFAlkfHgG ZEuVS6UeLDPQc7PUWoO8080DRURBKFh+lehtiT7urtR73R6pIwyPwqKEEcop/nWO4 wJG0bQzqekcP3NDmVXYN/yt8iRCfpX+D7Z37lXSKaAfVlVXe6XQupcKuMVDaARIc4 D2qEd4jRwZ8EP0PptTcmnhnpKy7Az3o6dZENmDZkGe/Pm03f+ueFz7FpA5dxgh5nT jAQWr8Q1N8MKjIhF1M4ttwWsOW1okxMNvOkXvUFusiQzu/MtOwDOAE+04nB1hCTHk AKX1D7UMkcFvLGPKvQ== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [192.168.178.29] ([79.232.150.163]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MTABZ-1rf27b1iFb-00Uepk; Wed, 24 Jan 2024 18:23:52 +0100 Message-ID: <9a16315d-8a5f-4059-9506-d82a7d8a2d6e@gmx.de> Date: Wed, 24 Jan 2024 18:23:48 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [Fortran] half-cycle trig functions and atan[d] fixes To: Janne Blomqvist , FX Coudert Cc: Steve Kargl , fortran , gcc-patches@gcc.gnu.org Newsgroups: gmane.comp.gcc.patches,gmane.comp.gcc.fortran References: <0840023D-FF1D-47B5-B75F-806913399880@gmail.com> Content-Language: en-US From: Harald Anlauf In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:LxbsuWZn06Q3UGQYcnq1T+VKPXw9q50xaJb8I95SKoLqXkGXHLE IiotY/NEtHj/3f15k8Moitm3u/8MFxlEsO10WI0yi68eG9wK9jTX1l7v1eUbXv2DQ3Q9gEw HVfVIWt7nW8B6LlizajfNZDRYDXMZkVqNiQzZy3BYPOcd4yRwAgec+LYAChzqn4SAQBGt7D t2A51sfj2k5p/lkE0L5lQ== UI-OutboundReport: notjunk:1;M01:P0:f2vQPY4vb4g=;h52Tf9EJjs7/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SWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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: Message-ID: <20240124172348.1JF5N6EP1xFr1HTVJ7E96PX-D7LKhgQeq4vU61Z1Dl0@z> Am 24.01.24 um 10:13 schrieb Janne Blomqvist: > On Wed, Jan 24, 2024 at 10:28=E2=80=AFAM FX Coudert wrote: >>> Now, if >>> the OS adds cospi() to libm and it's in libm's symbol map, then the >>> cospi() used by gfortran depends on the search order of the loaded >>> libraries. >> >> We only include the fallback math functions in libgfortran when they ar= e not available on the system. configure detects what is present in the li= bc being targeted, and conditionally compiles the necessary fallback funct= ions (and only them). > > Exactly. However, there is the (corner?) case when libgfortran has > been compiled, and cospi() not found and thus the fallback > implementation is included, and then later libc is updated to a > version that does provide cospi(). I believe in that case which > version gets used is down to the library search order (i.e. the order > that "ldd /path/to/binary" prints the libs), it will use the first > symbol it finds. Also, it's not necessary to do some ifdef tricks > with gfortran.map, if a symbol listed there isn't found in the library > it's just ignored. So the *pi() trig functions can be unconditionally > added there, and then depending on whether the target libm includes > those or not they are then included in the exported symbol list. > > It's possible to override this to look for specific symbol versions > etc., but that probably goes deep into the weeds of target-specific > stuff (e.g. are we looking for cospi@FBSD_1.7, cospi@GLIBC_X.Y.Z, or > something else?). I'm sure you don't wanna go there. > Isn't this something that could be addressed by __attribute__(__weakref__)?