diff --git a/mysql.spec b/mysql.spec index bf6952a55ca3f66137d68244cf90f52d4b5a3019..30fdf238e367c3d296c7772383ee77271c4428b6 100644 --- a/mysql.spec +++ b/mysql.spec @@ -1,4 +1,4 @@ -%define anolis_release 1 +%define anolis_release 2 # Name of the package without any prefixes %global pkg_name %{name} %global pkgnamepatch mysql @@ -120,6 +120,9 @@ Patch112: boost-1.58.0-pool.patch # Add support for loongarch64 Patch113: add-loongarch64-support-for-mysql.patch +#add support for riscv64 +Patch114: riscv-lock-free.patch + BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: libaio-devel @@ -380,6 +383,7 @@ pushd boost/boost_$(echo %{boost_bundled_version}| tr . _) %patch -P112 -p1 popd %patch -P113 -p1 +%patch -P114 -p1 # generate a list of tests that fail, but are not disabled by upstream cat %{SOURCE50} | tee -a mysql-test/%{skiplist} @@ -933,6 +937,9 @@ fi %endif %changelog +* Wed Jun 11 2025 Shangtong Guo - 8.0.42-2 +- Import patch from Ubuntu to fix build error on riscv64 + * Tue Apr 22 2025 tomcruiseqi <10762123+tomcruiseqi@user.noreply.gitee.com> - 8.0.42-1 - Update to 8.0.42 to fix CVE-2024-21134 CVE-2024-21130 CVE-2024-21179 CVE-2024-21177 CVE-2024-21173 CVE-2024-21171 CVE-2024-21165 CVE-2024-21163 CVE-2024-21162 CVE-2024-21142 CVE-2024-21125 CVE-2024-21129 CVE-2024-21127 CVE-2024-20996 CVE-2025-24375 CVE-2024-21198 CVE-2024-21203 diff --git a/riscv-lock-free.patch b/riscv-lock-free.patch new file mode 100644 index 0000000000000000000000000000000000000000..aba0565feb915d3f1ecbd1cc3d8839e6b58a129c --- /dev/null +++ b/riscv-lock-free.patch @@ -0,0 +1,66 @@ +From: Sergio Durigan Junior +Date: Mon, 27 Jul 2020 08:54:58 -0400 +Subject: Use Largest_lock_free_type_selector on RISC-V + +This patch is necessary because RISC-V doesn't guarantee the +always-lock-free property on certain types (like boolean), which +causes a static_assert to trigger when compiling MySQL on the +architecture. + +Author: Sergio Durigan Junior +Forwarded: no +Last-Updated: 2020-07-27 +--- + .../temptable/include/temptable/lock_free_type.h | 24 +++++++++++++++++++++- + 1 file changed, 23 insertions(+), 1 deletion(-) + +diff --color -urN mysql-8.0.30/storage/temptable/include/temptable/lock_free_type.h mysql-8.0.30-new/storage/temptable/include/temptable/lock_free_type.h +--- mysql-8.0.30/storage/temptable/include/temptable/lock_free_type.h 2021-12-18 00:07:27.000000000 +0800 ++++ mysql-8.0.30-new/storage/temptable/include/temptable/lock_free_type.h 2022-03-31 18:52:58.453257383 +0800 +@@ -102,6 +102,19 @@ + * More details and motivation can be found at: + * http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0152r0.html + * */ ++ ++/** Ubuntu patch for RISC-V: ++ ++ On RISC-V, some types are not always lock-free. For example, ++ ATOMIC_BOOL_LOCK_FREE is 1, meaning that it is sometimes ++ lock-free. This causes a compilation error of ++ Lock_free_type_selector because of the static_asserts below. For ++ this reason, we have to guard the Lock_free_type_selector code ++ with an ifndef when compiling for RISC-V. We also have to force ++ the use of Largest_lock_free_type_selector instead of ++ Lock_free_type_selector. */ ++ ++#ifndef __riscv + template + struct Lock_free_type_selector { + static_assert( +@@ -224,6 +237,13 @@ + "always-lock-free property. Bailing out ..."); + #endif + }; ++#else ++ /** As explained above, if we're compiling for RISC-V then we have ++ to force the use of Largest_lock_free_type_selector instead of ++ Lock_free_type_selector, because the former will work ++ normally, while the latter will fail to compile. */ ++#define Lock_free_type_selector Largest_lock_free_type_selector ++#endif /* ! __riscv */ + + /** Largest lock-free type selector, a helper utility very much similar + * to Lock_free_type_selector with the difference being that it tries hard +@@ -290,7 +310,9 @@ + * + * Always-lock-free guarantee is implemented through the means of + * Lock_free_type_selector or Largest_lock_free_type_selector. User code can +- * opt-in for any of those. By default, Lock_free_type_selector is used. ++ * opt-in for any of those. By default, Lock_free_type_selector is ++ * used, except on RISC-V, where Largest_lock_free_type_selector is ++ * used by default due to atomic type limitations. + * + * In addition, this type provides an ability to redefine the + * alignment-requirement of the underlying always-lock-free type, basically + +\ No newline at end of file