qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] host-utils: Drop workaround for buggy Apple Clang __builtin_subcll()
@ 2025-07-14 14:50 Peter Maydell
  2025-07-14 15:27 ` Thomas Huth
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Peter Maydell @ 2025-07-14 14:50 UTC (permalink / raw)
  To: qemu-devel; +Cc: Thomas Huth

In commit b0438861efe ("host-utils: Avoid using __builtin_subcll on
buggy versions of Apple Clang") we added a workaround for a bug in
Apple Clang 14 where its __builtin_subcll() implementation was wrong.
This bug was only present in Apple Clang 14, not in upstream clang,
and is not present in Apple Clang versions 15 and newer.

Since commit 4e035201 we have required at least Apple Clang 15, so we
no longer build with the buggy versions.  We can therefore drop the
workaround. This is effectively a revert of b0438861efe.

This should not be backported to stable branches, which may still
need to support Apple Clang 14.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3030
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 include/qemu/compiler.h   | 13 -------------
 include/qemu/host-utils.h |  2 +-
 2 files changed, 1 insertion(+), 14 deletions(-)

diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h
index 65b89958d36..1c2b673c058 100644
--- a/include/qemu/compiler.h
+++ b/include/qemu/compiler.h
@@ -182,19 +182,6 @@
 #define QEMU_DISABLE_CFI
 #endif
 
-/*
- * Apple clang version 14 has a bug in its __builtin_subcll(); define
- * BUILTIN_SUBCLL_BROKEN for the offending versions so we can avoid it.
- * When a version of Apple clang which has this bug fixed is released
- * we can add an upper bound to this check.
- * See https://gitlab.com/qemu-project/qemu/-/issues/1631
- * and https://gitlab.com/qemu-project/qemu/-/issues/1659 for details.
- * The bug never made it into any upstream LLVM releases, only Apple ones.
- */
-#if defined(__apple_build_version__) && __clang_major__ >= 14
-#define BUILTIN_SUBCLL_BROKEN
-#endif
-
 #if __has_attribute(annotate)
 #define QEMU_ANNOTATE(x) __attribute__((annotate(x)))
 #else
diff --git a/include/qemu/host-utils.h b/include/qemu/host-utils.h
index 4d28fa22cfa..dd558589cb5 100644
--- a/include/qemu/host-utils.h
+++ b/include/qemu/host-utils.h
@@ -677,7 +677,7 @@ static inline uint64_t uadd64_carry(uint64_t x, uint64_t y, bool *pcarry)
  */
 static inline uint64_t usub64_borrow(uint64_t x, uint64_t y, bool *pborrow)
 {
-#if __has_builtin(__builtin_subcll) && !defined(BUILTIN_SUBCLL_BROKEN)
+#if __has_builtin(__builtin_subcll)
     unsigned long long b = *pborrow;
     x = __builtin_subcll(x, y, b, &b);
     *pborrow = b & 1;
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] host-utils: Drop workaround for buggy Apple Clang __builtin_subcll()
  2025-07-14 14:50 [PATCH] host-utils: Drop workaround for buggy Apple Clang __builtin_subcll() Peter Maydell
@ 2025-07-14 15:27 ` Thomas Huth
  2025-07-14 16:02 ` Richard Henderson
  2025-07-14 19:52 ` Philippe Mathieu-Daudé
  2 siblings, 0 replies; 5+ messages in thread
From: Thomas Huth @ 2025-07-14 15:27 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel

On 14/07/2025 16.50, Peter Maydell wrote:
> In commit b0438861efe ("host-utils: Avoid using __builtin_subcll on
> buggy versions of Apple Clang") we added a workaround for a bug in
> Apple Clang 14 where its __builtin_subcll() implementation was wrong.
> This bug was only present in Apple Clang 14, not in upstream clang,
> and is not present in Apple Clang versions 15 and newer.
> 
> Since commit 4e035201 we have required at least Apple Clang 15, so we
> no longer build with the buggy versions.  We can therefore drop the
> workaround. This is effectively a revert of b0438861efe.
> 
> This should not be backported to stable branches, which may still
> need to support Apple Clang 14.
> 
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3030
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>   include/qemu/compiler.h   | 13 -------------
>   include/qemu/host-utils.h |  2 +-
>   2 files changed, 1 insertion(+), 14 deletions(-)

Reviewed-by: Thomas Huth <thuth@redhat.com>



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] host-utils: Drop workaround for buggy Apple Clang __builtin_subcll()
  2025-07-14 14:50 [PATCH] host-utils: Drop workaround for buggy Apple Clang __builtin_subcll() Peter Maydell
  2025-07-14 15:27 ` Thomas Huth
@ 2025-07-14 16:02 ` Richard Henderson
  2025-07-14 19:52 ` Philippe Mathieu-Daudé
  2 siblings, 0 replies; 5+ messages in thread
From: Richard Henderson @ 2025-07-14 16:02 UTC (permalink / raw)
  To: qemu-devel

On 7/14/25 08:50, Peter Maydell wrote:
> In commit b0438861efe ("host-utils: Avoid using __builtin_subcll on
> buggy versions of Apple Clang") we added a workaround for a bug in
> Apple Clang 14 where its __builtin_subcll() implementation was wrong.
> This bug was only present in Apple Clang 14, not in upstream clang,
> and is not present in Apple Clang versions 15 and newer.
> 
> Since commit 4e035201 we have required at least Apple Clang 15, so we
> no longer build with the buggy versions.  We can therefore drop the
> workaround. This is effectively a revert of b0438861efe.
> 
> This should not be backported to stable branches, which may still
> need to support Apple Clang 14.
> 
> Resolves:https://gitlab.com/qemu-project/qemu/-/issues/3030
> Signed-off-by: Peter Maydell<peter.maydell@linaro.org>
> ---
>   include/qemu/compiler.h   | 13 -------------
>   include/qemu/host-utils.h |  2 +-
>   2 files changed, 1 insertion(+), 14 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

Commit 4e035201 was in 9.2.0, but indeed there's no point in backporting to any stable branch.


r~


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] host-utils: Drop workaround for buggy Apple Clang __builtin_subcll()
  2025-07-14 14:50 [PATCH] host-utils: Drop workaround for buggy Apple Clang __builtin_subcll() Peter Maydell
  2025-07-14 15:27 ` Thomas Huth
  2025-07-14 16:02 ` Richard Henderson
@ 2025-07-14 19:52 ` Philippe Mathieu-Daudé
  2025-07-17 16:59   ` Peter Maydell
  2 siblings, 1 reply; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-07-14 19:52 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel; +Cc: Thomas Huth

On 14/7/25 16:50, Peter Maydell wrote:
> In commit b0438861efe ("host-utils: Avoid using __builtin_subcll on
> buggy versions of Apple Clang") we added a workaround for a bug in
> Apple Clang 14 where its __builtin_subcll() implementation was wrong.
> This bug was only present in Apple Clang 14, not in upstream clang,
> and is not present in Apple Clang versions 15 and newer.
> 
> Since commit 4e035201 we have required at least Apple Clang 15, so we
> no longer build with the buggy versions.  We can therefore drop the
> workaround. This is effectively a revert of b0438861efe.
> 
> This should not be backported to stable branches, which may still
> need to support Apple Clang 14.
> 
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3030
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>   include/qemu/compiler.h   | 13 -------------
>   include/qemu/host-utils.h |  2 +-
>   2 files changed, 1 insertion(+), 14 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] host-utils: Drop workaround for buggy Apple Clang __builtin_subcll()
  2025-07-14 19:52 ` Philippe Mathieu-Daudé
@ 2025-07-17 16:59   ` Peter Maydell
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2025-07-17 16:59 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé; +Cc: qemu-devel, Thomas Huth

On Mon, 14 Jul 2025 at 20:52, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> On 14/7/25 16:50, Peter Maydell wrote:
> > In commit b0438861efe ("host-utils: Avoid using __builtin_subcll on
> > buggy versions of Apple Clang") we added a workaround for a bug in
> > Apple Clang 14 where its __builtin_subcll() implementation was wrong.
> > This bug was only present in Apple Clang 14, not in upstream clang,
> > and is not present in Apple Clang versions 15 and newer.
> >
> > Since commit 4e035201 we have required at least Apple Clang 15, so we
> > no longer build with the buggy versions.  We can therefore drop the
> > workaround. This is effectively a revert of b0438861efe.
> >
> > This should not be backported to stable branches, which may still
> > need to support Apple Clang 14.
> >
> > Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3030
> > Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> > ---
> >   include/qemu/compiler.h   | 13 -------------
> >   include/qemu/host-utils.h |  2 +-
> >   2 files changed, 1 insertion(+), 14 deletions(-)
>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Thanks all for the review; I'll pick this up via target-arm.next.

-- PMM


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-07-17 19:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-14 14:50 [PATCH] host-utils: Drop workaround for buggy Apple Clang __builtin_subcll() Peter Maydell
2025-07-14 15:27 ` Thomas Huth
2025-07-14 16:02 ` Richard Henderson
2025-07-14 19:52 ` Philippe Mathieu-Daudé
2025-07-17 16:59   ` Peter Maydell

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 NNTP newsgroup(s).