qemu-kvm/kvm-fix-clang17-s390x.patch

58 lines
2.1 KiB
Diff
Raw Normal View History

From 90733c05b4fe0c55b6427a812ca262d7121fbaa4 Mon Sep 17 00:00:00 2001
From: Miroslav Rezanina <mrezanin@redhat.com>
Date: Thu, 19 Oct 2023 02:55:22 -0400
Subject: [PATCH] Fix build s390x build issue with Clang 17
When using Clang 17, s390x build fails due to unaligned variables.
This is fix for the issue.
Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
host/include/generic/host/atomic128-cas.h | 2 +-
host/include/generic/host/atomic128-ldst.h | 2 +-
include/qemu/int128.h | 1 +
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/host/include/generic/host/atomic128-cas.h b/host/include/generic/host/atomic128-cas.h
index 991d3da082..6b40cc2271 100644
--- a/host/include/generic/host/atomic128-cas.h
+++ b/host/include/generic/host/atomic128-cas.h
@@ -28,7 +28,7 @@ atomic16_cmpxchg(Int128 *ptr, Int128 cmp, Int128 new)
static inline Int128 ATTRIBUTE_ATOMIC128_OPT
atomic16_cmpxchg(Int128 *ptr, Int128 cmp, Int128 new)
{
- __int128_t *ptr_align = __builtin_assume_aligned(ptr, 16);
+ Int128Aligned *ptr_align = __builtin_assume_aligned(ptr, 16);
Int128Alias r, c, n;
c.s = cmp;
diff --git a/host/include/generic/host/atomic128-ldst.h b/host/include/generic/host/atomic128-ldst.h
index 80fff0643a..691e6a8531 100644
--- a/host/include/generic/host/atomic128-ldst.h
+++ b/host/include/generic/host/atomic128-ldst.h
@@ -58,7 +58,7 @@ atomic16_read_rw(Int128 *ptr)
static inline void ATTRIBUTE_ATOMIC128_OPT
atomic16_set(Int128 *ptr, Int128 val)
{
- __int128_t *ptr_align = __builtin_assume_aligned(ptr, 16);
+ Int128Aligned *ptr_align = __builtin_assume_aligned(ptr, 16);
__int128_t old;
Int128Alias new;
diff --git a/include/qemu/int128.h b/include/qemu/int128.h
index 73624e8be7..44530d3e10 100644
--- a/include/qemu/int128.h
+++ b/include/qemu/int128.h
@@ -10,6 +10,7 @@
*/
#if defined(CONFIG_INT128) && !defined(CONFIG_TCG_INTERPRETER)
typedef __int128_t Int128;
+typedef __int128_t __attribute__((aligned(16))) Int128Aligned;
static inline Int128 int128_make64(uint64_t a)
{
--
2.39.3