From 0d930af039869f6c3bc6600c5fa48c50a44583d3 Mon Sep 17 00:00:00 2001 From: mintsuki Date: Sun, 22 Sep 2024 06:04:44 +0200 Subject: [PATCH] Backport managarm/gcc@61271f4791185686062498d006f46495b5143dab into clang compat patch --- .github/workflows/run.yml | 3 +++ patches/clang-compat.patch | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 patches/clang-compat.patch diff --git a/.github/workflows/run.yml b/.github/workflows/run.yml index 9cf8206..2b67e00 100644 --- a/.github/workflows/run.yml +++ b/.github/workflows/run.yml @@ -37,6 +37,9 @@ jobs: mv toolchain/include/c++/* ${{matrix.target_arch}}/include cp -rp ${{matrix.target_arch}}/include/${{matrix.target_arch}}-elf/* ${{matrix.target_arch}}/include/ rm -rf ${{matrix.target_arch}}/include/${{matrix.target_arch}}-elf + for f in patches/*; do \ + ( cd ${{matrix.target_arch}} && patch -p0 <../$f ); \ + done - name: Push run: | diff --git a/patches/clang-compat.patch b/patches/clang-compat.patch new file mode 100644 index 0000000..ffc2c2e --- /dev/null +++ b/patches/clang-compat.patch @@ -0,0 +1,33 @@ +diff '--color=auto' -urN include/atomic include-patched/atomic +--- include/atomic 2024-09-22 05:50:48.546122362 +0200 ++++ include-patched/atomic 2024-09-22 05:59:15.115746337 +0200 +@@ -1650,6 +1650,7 @@ + using __atomic_float::operator=; + }; + ++#if !(defined(__clang__) && !__STDC_HOSTED__) // clang in kernel context + template<> + struct atomic : __atomic_float + { +@@ -1664,6 +1665,7 @@ + + using __atomic_float::operator=; + }; ++#endif + + #ifdef __STDCPP_FLOAT16_T__ + template<> +diff '--color=auto' -urN include/bits/stl_algobase.h include-patched/bits/stl_algobase.h +--- include/bits/stl_algobase.h 2024-09-22 05:50:48.546122362 +0200 ++++ include-patched/bits/stl_algobase.h 2024-09-22 05:58:04.080067281 +0200 +@@ -1072,8 +1072,10 @@ + __size_to_integer(float __n) { return (long long)__n; } + inline _GLIBCXX_CONSTEXPR long long + __size_to_integer(double __n) { return (long long)__n; } ++#if !(defined(__clang__) && !__STDC_HOSTED__) // clang in kernel context + inline _GLIBCXX_CONSTEXPR long long + __size_to_integer(long double __n) { return (long long)__n; } ++#endif + #if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_FLOAT128) + __extension__ inline _GLIBCXX_CONSTEXPR long long + __size_to_integer(__float128 __n) { return (long long)__n; }