public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: Xi Ruoyao <xry111@xry111.site>
Cc: caiyinyu <caiyinyu@loongson.cn>,
	 josmyers@redhat.com, libc-alpha@sourceware.org,
	 adhemerval.zanella@linaro.org
Subject: Re: [PATCH] LoongArch: Add soft floating-point fe* function implementations.
Date: Tue, 02 Apr 2024 13:45:17 +0200	[thread overview]
Message-ID: <87y19wxa2a.fsf@oldenburg3.str.redhat.com> (raw)
In-Reply-To: <98f2d5adc158e05a3fa487a8a3a3899734b97a45.camel@xry111.site> (Xi Ruoyao's message of "Tue, 02 Apr 2024 18:40:06 +0800")

* Xi Ruoyao:

> On Tue, 2024-04-02 at 11:40 +0800, caiyinyu wrote:
>> The LoongArch soft ABI was added to glibc in version 2.37[1], but it was 
>> not fully implemented,
>> lacking functions for handling soft float exceptions/rounding modes. 
>> This patch fills in
>> the missing functions and fixes related failed test cases.
>> Therefore, would backporting this patch to 2.37 be sufficient?
>
> The problem is this change is breaking ABI.  The behavior of
> feenableexcept etc. *is* a part of the ABI.  For example, if a not so
> careful programmer invokes feenableexcept(FE_INVALID) and then
> mistakenly invokes something like acos(1.0000001), before this change
> the program will continue to run with a NaN, but after this change it'll
> crash with SIGFPE.

That's a behavioral change, not an ABI change.

> You may argue such a program is buggy, but ABI stability requires that
> even such a buggy program should still behave, unless it's invoking an
> undefined behavior per the specification **when the program was built**.
> For example, on x86_64 Glibc still have memcpy@GLIBC_2.2.5 which is
> actually memmove, to support programs built before ISO C (invoking
> memcpy with overlapping ranges, doing so was well defined before ISO C
> but an undefined behavior today).

No, this was done to keep Adobe Flash working:

  Strange sound on mp3 flash website  
  <https://bugzilla.redhat.com/show_bug.cgi?id=638477>

In general, we do not promise bug-for-bug compatibility.

> In this case, the specification before Glibc 2.40 is well defined as
> "feenableexcept will do nothing and return an error": there is even a
> linker warning actively tells the user this definition!

On the other hand, if an application keeps using the stub despite this
warning, I think it should be prepared for turning into a real
implementation.

> Or maybe we can provide both feenableexcept@GLIBC_2_37 and
> feenableexcept@GLIBC_2_40 in libm.so.6?  I don't know if doing so is
> really possible.

Yes, it's possible to add a compat symbol for that and keep the
do-nothing behavior for old applications.

Wouldn't the issue manifest on other architectures with a working
(non-stub) feenableexcept implementation?

Thanks,
Florian


  reply	other threads:[~2024-04-02 11:45 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-26 12:46 caiyinyu
2024-03-26 17:34 ` Joseph Myers
2024-03-27  8:42   ` caiyinyu
2024-03-27 17:10     ` Joseph Myers
2024-03-31 10:14       ` caiyinyu
2024-04-01 13:19         ` Florian Weimer
2024-04-02  3:40           ` caiyinyu
2024-04-02 10:40             ` Xi Ruoyao
2024-04-02 11:45               ` Florian Weimer [this message]
2024-04-02 12:02                 ` Xi Ruoyao
2024-04-02 12:34                   ` Florian Weimer
2024-04-02 12:12               ` Andreas Schwab
2024-04-02 21:18             ` Joseph Myers
2024-03-31 10:31       ` caiyinyu
2024-04-02 21:10         ` Joseph Myers
2024-04-02 14:46 caiyinyu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y19wxa2a.fsf@oldenburg3.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=caiyinyu@loongson.cn \
    --cc=josmyers@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=xry111@xry111.site \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).