From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by sourceware.org (Postfix) with ESMTPS id 6A0663858C36; Wed, 24 Jan 2024 09:13:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6A0663858C36 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6A0663858C36 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::432 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706087600; cv=none; b=ESsI26PLPHNeIqd18VG5TWY9d2NMUHLGObaS43e2ZtN2dyppFISAocAgP8lP3PRW/V9bxiy9mQqhPQD3jLuhdFvnSCho013KUjKDxiblRmIDZfAxEifOYIz5UW8705U/4c/7pMK1vqEO7Hya/AphzaIxPfoTdu62iy0QUabZzpU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706087600; c=relaxed/simple; bh=ugd7JDgPMPrBJN1shojITevji55F9NZ1t2m0Ahw0ANE=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=ihUCg/BScsXLEORdvvTI4uBjxVJrbVfJqs8713GU4n+3BGYcVydu0wQt4gJj0brKCYr+jmf0RxvY3Vs1g/qyRYXmX+0Jf1yzmqVOOTyzCgIYO7E56cLw6uumOyVMbRMqvibqoAr29wQ6cuGpITaGlZBujnvqKd+N0zuoMUEmw+0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-3392b12dd21so3252379f8f.0; Wed, 24 Jan 2024 01:13:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706087597; x=1706692397; darn=gcc.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=yPmqa8wMoDKBe+GqwAUrjntKriyLmt2PjQuxKS7B4A8=; b=Tw48OXxIJbG9nWqfaPZr+1veve0Xnvg053uELKwRNWCAp+M/uwzEDdZIMm70nRbfrH sSND6s9NpVv2YOy9vlddUtfis2/DoWCxXq8M9ybAF0NBy2qMWbHbLuZr2aXMQjIZpmbI DHtYRuQhDRrjelTm0fLnxTj/7i9317BxgAtwkAMRNgICaw9ACJvFjeP1bCi9tilVjoV8 1370T1IffYTc1LBizg4uXhsmXqoVovnmvb979xQXCjdKhXO96c9Z7byfMJH4VaxKIV8Q 7bQxfXEEpNSFrQlyaY88B20ZLGS/yloJHrJLHb8I34/YCbHYGhcEqF32zIT1X/YkWXwA hmIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706087597; x=1706692397; h=content-transfer-encoding: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=yPmqa8wMoDKBe+GqwAUrjntKriyLmt2PjQuxKS7B4A8=; b=lWexGn165Oo0hNkfTSQD6xBhcf50BlO/7emgnbv2veNw3GGMpb2Ife/2gE9bDFTEHz wGoI44xvppnOT4/jAPAGj1kaiGu2NI4ujHeEIiIM7orkA7FqG3QMU046gSfRPjhR/pXI 8OvLJ8PvBCfFOqK46p4OuQ+5WUV1s2JpelMnGz581R8q49qzpEpc6NRMI+CtybU6Akd1 SUPeQ//LrD6GOGXCFH0C+ge2g3i9E3m+1GzdDfWrvf6gXt7a6D1D8BgxOKWoWRsYCTbR POWhaTje7bx/5XL/UY3QgJ6R4ATspqCPeSSYphEUzajqdmSEmzrdVgOI9aGcY53cx/W5 y62A== X-Gm-Message-State: AOJu0YyTraIY574zXkk+2ABm6gb7cNS3Fsp/4MchP2H1uvjKZrEoeyh6 SmyICUQ9QVkSjwjOMZ8JlPrBW84+ZHgTsCye8/9fs0hrMYhidJMJ4t1I0XY6uJYa2uG37UO9Wde BkoUrCKDUBYoPey+7negfvCztgXzr13mI X-Google-Smtp-Source: AGHT+IG4mZvtA6SyY/CLdgLeGOqyTXWDfLVNUBbuiv6YGKKXJPP6WN4r5nxMD4kZ8zBJf7QWH1UKNuHrwcKzzoCFy8c= X-Received: by 2002:a05:6000:1789:b0:337:b38d:6070 with SMTP id e9-20020a056000178900b00337b38d6070mr368740wrg.2.1706087596611; Wed, 24 Jan 2024 01:13:16 -0800 (PST) MIME-Version: 1.0 References: <0840023D-FF1D-47B5-B75F-806913399880@gmail.com> In-Reply-To: <0840023D-FF1D-47B5-B75F-806913399880@gmail.com> From: Janne Blomqvist Date: Wed, 24 Jan 2024 11:13:05 +0200 Message-ID: Subject: Re: [Fortran] half-cycle trig functions and atan[d] fixes To: FX Coudert Cc: Steve Kargl , fortran , gcc-patches@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,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: On Wed, Jan 24, 2024 at 10:28=E2=80=AFAM FX Coudert w= rote: > > 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. --=20 Janne Blomqvist