From f596acf83c9a66d2c9c6df575ae4ce643de4cbb89ea1e91a73ba3ef64cc94b10 Mon Sep 17 00:00:00 2001 From: Reinhard Max Date: Tue, 31 Aug 2021 16:14:13 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/server:database:postgresql/postgresql12?expand=0&rev=52 --- ...otential-datalayout-mismatch-on-s390.patch | 43 ++++++++++++------- postgresql12.spec | 2 +- 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/0001-jit-Workaround-potential-datalayout-mismatch-on-s390.patch b/0001-jit-Workaround-potential-datalayout-mismatch-on-s390.patch index 1d11412..911374c 100644 --- a/0001-jit-Workaround-potential-datalayout-mismatch-on-s390.patch +++ b/0001-jit-Workaround-potential-datalayout-mismatch-on-s390.patch @@ -12,18 +12,23 @@ causes the JIT to fail at runtime. src/backend/jit/llvm/llvmjit.c | 46 ++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) -diff --git a/src/backend/jit/llvm/llvmjit.c b/src/backend/jit/llvm/llvmjit.c -index 98a27f08bf..05b6438ba8 100644 ---- a/src/backend/jit/llvm/llvmjit.c -+++ b/src/backend/jit/llvm/llvmjit.c -@@ -776,6 +776,35 @@ llvm_compile_module(LLVMJitContext *context) - errhidecontext(true))); +--- src/backend/jit/llvm/llvmjit.c.orig ++++ src/backend/jit/llvm/llvmjit.c +@@ -101,6 +101,7 @@ LLVMValueRef FuncExecEvalSysVar; + LLVMValueRef FuncExecAggTransReparent; + LLVMValueRef FuncExecAggInitGroup; + ++LLVMModuleRef mod = NULL; + + static bool llvm_session_initialized = false; + static size_t llvm_generation = 0; +@@ -742,6 +743,35 @@ llvm_compile_module(LLVMJitContext *cont } -+/* + /* + * For the systemz target, LLVM uses a different datalayout for z13 and newer + * CPUs than it does for older CPUs. This can cause a mismatch in datalayouts -+ * in the case where the llvm_types_module is compiled with a pre-z13 CPU ++ * in the case where the llvm_types_module (mod) is compiled with a pre-z13 CPU + * and the JIT is running on z13 or newer. + * See computeDataLayout() function in + * llvm/lib/Target/SystemZ/SystemZTargetMachine.cpp for information on the @@ -41,7 +46,7 @@ index 98a27f08bf..05b6438ba8 100644 + return false; + } + -+ llvm_context = LLVMGetModuleContext(llvm_types_module); ++ llvm_context = LLVMGetModuleContext(mod); + vec_type = LLVMVectorType(LLVMIntTypeInContext(llvm_context, 32), 4); + llvm_layoutref = LLVMCreateTargetData(llvm_layout); + ret = (LLVMABIAlignmentOfType(llvm_layoutref, vec_type) == 16); @@ -49,10 +54,11 @@ index 98a27f08bf..05b6438ba8 100644 + return ret; +} + - /* ++/* * Per session initialization. */ -@@ -785,6 +814,7 @@ llvm_session_initialize(void) + static void +@@ -750,6 +780,7 @@ llvm_session_initialize(void) MemoryContext oldcontext; char *error = NULL; char *cpu = NULL; @@ -60,7 +66,7 @@ index 98a27f08bf..05b6438ba8 100644 char *features = NULL; LLVMTargetMachineRef opt0_tm; LLVMTargetMachineRef opt3_tm; -@@ -816,10 +846,17 @@ llvm_session_initialize(void) +@@ -781,10 +812,17 @@ llvm_session_initialize(void) * features not all CPUs have (weird, huh). */ cpu = LLVMGetHostCPUName(); @@ -79,7 +85,7 @@ index 98a27f08bf..05b6438ba8 100644 opt0_tm = LLVMCreateTargetMachine(llvm_targetref, llvm_triple, cpu, features, LLVMCodeGenLevelNone, -@@ -833,8 +870,13 @@ llvm_session_initialize(void) +@@ -798,8 +836,13 @@ llvm_session_initialize(void) LLVMDisposeMessage(cpu); cpu = NULL; @@ -94,6 +100,11 @@ index 98a27f08bf..05b6438ba8 100644 /* force symbols in main binary to be loaded */ LLVMLoadLibraryPermanently(NULL); --- -2.27.0 - +@@ -952,7 +995,6 @@ llvm_create_types(void) + char path[MAXPGPATH]; + LLVMMemoryBufferRef buf; + char *msg; +- LLVMModuleRef mod = NULL; + + snprintf(path, MAXPGPATH, "%s/%s", pkglib_path, "llvmjit_types.bc"); + diff --git a/postgresql12.spec b/postgresql12.spec index 636325a..56ca7af 100644 --- a/postgresql12.spec +++ b/postgresql12.spec @@ -457,7 +457,7 @@ touch -r configure tmp %patch9 %if %{with llvm} %patch10 -%patch11 -p1 +%patch11 %endif touch -r tmp configure rm tmp