From c78aca21d618e5c390aa459734b03b008b6084ec Mon Sep 17 00:00:00 2001 From: Omair Majid Date: Fri, 11 Nov 2022 16:53:20 -0500 Subject: [PATCH] Add a patch to fix clang 15 compat on ppc64le --- dotnet7.0.spec | 4 +++ runtime-mono-ppc64le-clang15.patch | 39 ++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 runtime-mono-ppc64le-clang15.patch diff --git a/dotnet7.0.spec b/dotnet7.0.spec index 9a0e30e..1acd5e3 100644 --- a/dotnet7.0.spec +++ b/dotnet7.0.spec @@ -96,6 +96,9 @@ Patch8: runtime-77270-ppc64le-fsharp-crash.patch Patch9: runtime-77308-ppc64le-delegate.patch # Disable apphost; there's no net6.0 apphost for ppc64le Patch10: roslyn-analyzers-ppc64le-apphost.patch +# Fix ppc64le build with clang 15 +# TODO upstream this +Patch11: runtime-mono-ppc64le-clang15.patch %if 0%{?fedora} || 0%{?rhel} >= 8 @@ -426,6 +429,7 @@ popd %patch8 -p1 %patch9 -p1 %patch10 -p1 +%patch11 -p1 # Fix bad hardcoded path in build sed -i 's|/usr/share/dotnet|%{_libdir}/dotnet|' src/runtime/src/native/corehost/hostmisc/pal.unix.cpp diff --git a/runtime-mono-ppc64le-clang15.patch b/runtime-mono-ppc64le-clang15.patch new file mode 100644 index 0000000..32bf3f9 --- /dev/null +++ b/runtime-mono-ppc64le-clang15.patch @@ -0,0 +1,39 @@ +diff --git a/src/runtime/src/mono/mono/mini/mini-ppc.c b/src/runtime/src/mono/mono/mini/mini-ppc.c +index bc97b497af9..cc5e5ccc0e6 100644 +--- a/src/runtime/src/mono/mono/mini/mini-ppc.c ++++ b/src/runtime/src/mono/mono/mini/mini-ppc.c +@@ -2733,7 +2733,7 @@ handle_thunk (MonoCompile *cfg, guchar *code, const guchar *target) + cfg->arch.thunks = cfg->thunks; + cfg->arch.thunks_size = cfg->thunk_area; + #ifdef THUNK_ADDR_ALIGNMENT +- cfg->arch.thunks = ALIGN_TO(cfg->arch.thunks, THUNK_ADDR_ALIGNMENT); ++ cfg->arch.thunks = (guint8 *)ALIGN_TO(cfg->arch.thunks, THUNK_ADDR_ALIGNMENT); + #endif + } + thunks = cfg->arch.thunks; +@@ -5886,7 +5886,7 @@ host_mgreg_t* + mono_arch_context_get_int_reg_address (MonoContext *ctx, int reg) + { + if (reg == ppc_r1) +- return (host_mgreg_t)(gsize)MONO_CONTEXT_GET_SP (ctx); ++ return (host_mgreg_t *)(gsize)&ctx->sc_sp; + + return &ctx->regs [reg]; + } +diff --git a/src/runtime/src/mono/mono/mini/tramp-ppc.c b/src/runtime/src/mono/mono/mini/tramp-ppc.c +index 59bcb275a48..e0bc7f8eca4 100644 +--- a/src/runtime/src/mono/mono/mini/tramp-ppc.c ++++ b/src/runtime/src/mono/mono/mini/tramp-ppc.c +@@ -672,10 +672,10 @@ mono_arch_get_call_target (guint8 *code) + } + #if defined(TARGET_POWERPC64) && !defined(PPC_USES_FUNCTION_DESCRIPTOR) + else if (((guint32*)(code - 32)) [0] >> 26 == 15) { +- guint8 *thunk = GET_MEMORY_SLOT_THUNK_ADDRESS((guint32*)(code - 32)); ++ guint8 *thunk = (guint8 *)GET_MEMORY_SLOT_THUNK_ADDRESS((guint32*)(code - 32)); + return thunk; + } else if (((guint32*)(code - 4)) [0] >> 26 == 15) { +- guint8 *thunk = GET_MEMORY_SLOT_THUNK_ADDRESS((guint32*)(code - 4)); ++ guint8 *thunk = (guint8 *)GET_MEMORY_SLOT_THUNK_ADDRESS((guint32*)(code - 4)); + return thunk; + } + #endif