forked from pool/postgresql12
OBS-URL: https://build.opensuse.org/package/show/server:database:postgresql/postgresql12?expand=0&rev=52
This commit is contained in:
parent
9728ec8991
commit
f596acf83c
@ -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");
|
||||
|
||||
|
@ -457,7 +457,7 @@ touch -r configure tmp
|
||||
%patch9
|
||||
%if %{with llvm}
|
||||
%patch10
|
||||
%patch11 -p1
|
||||
%patch11
|
||||
%endif
|
||||
touch -r tmp configure
|
||||
rm tmp
|
||||
|
Loading…
Reference in New Issue
Block a user