On Mon, Sep 27, 2021 at 10:54 AM Thomas Munro <thomas.mu...@gmail.com> wrote:
> And pushed.  Probably won't be the last change and seawasp only tests
> master, so no back-patch for now.

According to my crystal ball, seawasp will shortly break again[1][2]
and the attached patch will fix it.

[1] 
https://github.com/llvm/llvm-project/commit/f6fa95b77f33c3690e4201e505cb8dce1433abd9
[2] 
https://github.com/llvm/llvm-project/commit/e463b69736da8b0a950ecd937cf990401bdfcdeb
diff --git a/src/backend/jit/llvm/llvmjit_error.cpp b/src/backend/jit/llvm/llvmjit_error.cpp
index daefb3e1fd..ee9ff5e571 100644
--- a/src/backend/jit/llvm/llvmjit_error.cpp
+++ b/src/backend/jit/llvm/llvmjit_error.cpp
@@ -28,10 +28,15 @@ static int fatal_new_handler_depth = 0;
 static std::new_handler old_new_handler = NULL;
 
 static void fatal_system_new_handler(void);
+#if LLVM_VERSION_MAJOR >= 14
+static void fatal_llvm_new_handler(void *user_data, const char *reason, bool gen_crash_diag);
+static void fatal_llvm_error_handler(void *user_data, const char *reason, bool gen_crash_diag);
+#else
 #if LLVM_VERSION_MAJOR > 4
 static void fatal_llvm_new_handler(void *user_data, const std::string& reason, bool gen_crash_diag);
 #endif
 static void fatal_llvm_error_handler(void *user_data, const std::string& reason, bool gen_crash_diag);
+#endif
 
 
 /*
@@ -126,7 +131,18 @@ fatal_system_new_handler(void)
 			 errdetail("while in LLVM")));
 }
 
-#if LLVM_VERSION_MAJOR > 4
+#if LLVM_VERSION_MAJOR >= 14
+static void
+fatal_llvm_new_handler(void *user_data,
+					   const char *reason,
+					   bool gen_crash_diag)
+{
+	ereport(FATAL,
+			(errcode(ERRCODE_OUT_OF_MEMORY),
+			 errmsg("out of memory"),
+			 errdetail("While in LLVM: %s", reason)));
+}
+#elif LLVM_VERSION_MAJOR > 4
 static void
 fatal_llvm_new_handler(void *user_data,
 					   const std::string& reason,
@@ -139,6 +155,18 @@ fatal_llvm_new_handler(void *user_data,
 }
 #endif
 
+#if LLVM_VERSION_MAJOR >= 14
+static void
+fatal_llvm_error_handler(void *user_data,
+						 const char *reason,
+						 bool gen_crash_diag)
+{
+	ereport(FATAL,
+			(errcode(ERRCODE_OUT_OF_MEMORY),
+			 errmsg("fatal llvm error: %s",
+					reason)));
+}
+#else
 static void
 fatal_llvm_error_handler(void *user_data,
 						 const std::string& reason,
@@ -149,3 +177,4 @@ fatal_llvm_error_handler(void *user_data,
 			 errmsg("fatal llvm error: %s",
 					reason.c_str())));
 }
+#endif

Reply via email to