From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp002.apm-internet.net (smtp002.apm-internet.net [85.119.248.221]) by sourceware.org (Postfix) with ESMTPS id BFB873858D1E for ; Tue, 3 Jan 2023 20:07:43 +0000 (GMT) Received: (qmail 36868 invoked from network); 3 Jan 2023 20:07:42 -0000 X-APM-Out-ID: 16727764623686 X-APM-Authkey: 257869/1(257869/1) 7 Received: from unknown (HELO smtpclient.apple) (81.138.1.83) by smtp002.apm-internet.net with SMTP; 3 Jan 2023 20:07:42 -0000 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Subject: Re: [PATCH] Darwin, crts: Provide scalb and significand as a crt [PR107631] From: Iain Sandoe In-Reply-To: <44a1c1e5-c1b0-604c-aca5-bc42d93ee5ba@codesourcery.com> Date: Tue, 3 Jan 2023 20:07:41 +0000 Cc: GCC Patches , "" Content-Transfer-Encoding: quoted-printable Message-Id: <77D8A0F8-2831-4A24-AF23-D39511BDC89E@sandoe.co.uk> References: <20221230102046.8287-1-iain@sandoe.co.uk> <83b1e9f-1b4f-5fc2-90b2-8cf6e97d35db@codesourcery.com> <22D76CA0-7716-4646-9216-2D507AD1F7B2@sandoe.co.uk> <44a1c1e5-c1b0-604c-aca5-bc42d93ee5ba@codesourcery.com> To: Joseph Myers , Gaius Mulley X-Mailer: Apple Mail (2.3696.120.41.1.1) X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00,KAM_COUK,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,TXREP 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: Thanks Joseph, > On 3 Jan 2023, at 18:15, Joseph Myers wrote: >=20 > On Sat, 31 Dec 2022, Iain Sandoe wrote: >=20 >> builtins.def unconditionally defines these builtins to be = DEF_EXT_LIB_BUILTIN >> which expands to the libcall, this is currently hard-wired to = FALLBACK_P =3D true. >>=20 >> but, AFAIU the builtins.def descriptions: >>=20 >> FALLBACK_P should be false if the libc (or libm, I suppose, if = that=E2=80=99s different) >> does not have the function, perhaps that=E2=80=99s an underlying bug = or at least an >> oversight? >>=20 >> (or, of course, I misunderstood the intent of that param) >=20 > FALLBACK_P true means that it's the user's responsibility, if calling=20= > __builtin_X, to make sure the library function X is also available in=20= > cases where the call doesn't get expected inline - that is, that the = API=20 > for that __builtin_X function is that it may call an underlying = library=20 > function X, which is expected to exist and have a compatible = interface. >=20 > Information about whether a function is present in libc / libm is=20 > generally only relevant when __builtin_X might expand to call Y = instead of=20 > X; then GCC needs to know whether Y is available. Ah I had misunderstood the param. Since the mechanism used by Modula-2 =E2=80=98forwards=E2=80=99 the = builins by using them, that means that it always produces the libcalls which results in link = errors when the m2 libraries are used (i.e. the user is not in control of the = use/non-use). >> - at present, it seems that this crt might be the least invasive=20 >> solution (since =E2=80=98significand*()=E2=80=99 are not obsolete = AFAIU, we still need=20 >> to provide those implementations, regardless of any subsitution of=20 >> scalbn*() in Modula-2). >=20 > The significand functions can be considered obsolete and were never in = any=20 > standard (thus glibc does not provide a version for _Float128, for=20 > example). So, it seems that either: 1. Modula-2 should not forward the builtins unless the target supports = them, either by expansion or the relevant lib functions. So that would = need some configury and conditional build code. 2. Preferrably it should not forward the obsolete/obsolescent cases: scalb*() significand*() Additionally, if there is an actual use in the Modula-2 runtime (as = opposed to forwarding the functionality to the end user), then it should implement = that avoiding these obsolete functions. I will withdraw my Darwin patch, and discuss with Gaius how to resolve = this in Modula-2. thanks Iain >=20 > --=20 > Joseph S. Myers > joseph@codesourcery.com