public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "罗百科" <patrick@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-db/postgresql/files/, dev-db/postgresql/
Date: Thu, 24 Mar 2022 06:28:33 +0000 (UTC)	[thread overview]
Message-ID: <1648103291.d49fccf6cbbbdab563c1d38718f9dc177548659b.patrick@gentoo> (raw)

commit:     d49fccf6cbbbdab563c1d38718f9dc177548659b
Author:     Patrick Lauer <patrick <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 24 06:28:11 2022 +0000
Commit:     罗百科 <patrick <AT> gentoo <DOT> org>
CommitDate: Thu Mar 24 06:28:11 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d49fccf6

dev-db/postgresql: llvm14 support

Upstream patch applies to v.12+
Restrict max llvm version to 13 for v.11 as patch fails
(this should be rectified in next upstream release)

Bug: https://bugs.gentoo.org/835861
Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Patrick Lauer <patrick <AT> gentoo.org>

 dev-db/postgresql/files/postgres-llvm14.patch | 154 ++++++++++++++++++++++++++
 dev-db/postgresql/postgresql-11.14-r1.ebuild  |   9 +-
 dev-db/postgresql/postgresql-11.15-r1.ebuild  |   9 +-
 dev-db/postgresql/postgresql-12.10-r1.ebuild  |   1 +
 dev-db/postgresql/postgresql-12.9-r1.ebuild   |   1 +
 dev-db/postgresql/postgresql-13.5-r1.ebuild   |   1 +
 dev-db/postgresql/postgresql-13.6-r1.ebuild   |   1 +
 dev-db/postgresql/postgresql-14.1-r1.ebuild   |   1 +
 dev-db/postgresql/postgresql-14.2-r1.ebuild   |   1 +
 9 files changed, 172 insertions(+), 6 deletions(-)

diff --git a/dev-db/postgresql/files/postgres-llvm14.patch b/dev-db/postgresql/files/postgres-llvm14.patch
new file mode 100644
index 000000000000..2c7b91d75153
--- /dev/null
+++ b/dev-db/postgresql/files/postgres-llvm14.patch
@@ -0,0 +1,154 @@
+From d9f7ad54e552262ee0090e88d5abd3e04fcdeac8 Mon Sep 17 00:00:00 2001
+From: Thomas Munro <tmunro@postgresql.org>
+Date: Wed, 16 Mar 2022 11:35:00 +1300
+Subject: [PATCH] Back-patch LLVM 14 API changes.
+
+Since LLVM 14 has stopped changing and is about to be released,
+back-patch the following changes from the master branch:
+
+  e6a7600202105919bffd62b3dfd941f4a94e082b
+  807fee1a39de6bb8184082012e643951abb9ad1d
+  a56e7b66010f330782243de9e25ac2a6596be0e1
+
+Back-patch to 11, where LLVM JIT support came in.
+---
+ src/backend/jit/llvm/Makefile           |  6 +++++
+ src/backend/jit/llvm/llvmjit_error.cpp  | 35 +++++++++++++++++++++----
+ src/backend/jit/llvm/llvmjit_inline.cpp | 12 ++++++++-
+ 3 files changed, 47 insertions(+), 6 deletions(-)
+
+diff --git a/src/backend/jit/llvm/Makefile b/src/backend/jit/llvm/Makefile
+index 0268bd46d5..2da122a391 100644
+--- a/src/backend/jit/llvm/Makefile
++++ b/src/backend/jit/llvm/Makefile
+@@ -22,6 +22,12 @@ endif
+ PGFILEDESC = "llvmjit - JIT using LLVM"
+ NAME = llvmjit
+ 
++# LLVM 14 produces deprecation warnings.  We'll need to make some changes
++# before the relevant functions are removed, but for now silence the warnings.
++ifeq ($(GCC), yes)
++LLVM_CFLAGS += -Wno-deprecated-declarations
++endif
++
+ # All files in this directory use LLVM.
+ CFLAGS += $(LLVM_CFLAGS)
+ CXXFLAGS += $(LLVM_CXXFLAGS)
+diff --git a/src/backend/jit/llvm/llvmjit_error.cpp b/src/backend/jit/llvm/llvmjit_error.cpp
+index f4720732a3..5ad92f3090 100644
+--- a/src/backend/jit/llvm/llvmjit_error.cpp
++++ b/src/backend/jit/llvm/llvmjit_error.cpp
+@@ -23,15 +23,22 @@ extern "C"
+ 
+ #include "jit/llvmjit.h"
+ 
++#include <new>
+ 
+ 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 > 4
++static void fatal_llvm_new_handler(void *user_data, const char *reason, bool gen_crash_diag);
++#if LLVM_VERSION_MAJOR < 14
+ static void fatal_llvm_new_handler(void *user_data, const std::string& reason, bool gen_crash_diag);
+ #endif
++#endif
++static void fatal_llvm_error_handler(void *user_data, const char *reason, bool gen_crash_diag);
++#if LLVM_VERSION_MAJOR < 14
+ static void fatal_llvm_error_handler(void *user_data, const std::string& reason, bool gen_crash_diag);
++#endif
+ 
+ 
+ /*
+@@ -129,23 +136,41 @@ fatal_system_new_handler(void)
+ #if LLVM_VERSION_MAJOR > 4
+ static void
+ fatal_llvm_new_handler(void *user_data,
+-					   const std::string& reason,
++					   const char *reason,
+ 					   bool gen_crash_diag)
+ {
+ 	ereport(FATAL,
+ 			(errcode(ERRCODE_OUT_OF_MEMORY),
+ 			 errmsg("out of memory"),
+-			 errdetail("While in LLVM: %s", reason.c_str())));
++			 errdetail("While in LLVM: %s", reason)));
++}
++#if LLVM_VERSION_MAJOR < 14
++static void
++fatal_llvm_new_handler(void *user_data,
++					   const std::string& reason,
++					   bool gen_crash_diag)
++{
++	fatal_llvm_new_handler(user_data, reason.c_str(), gen_crash_diag);
+ }
+ #endif
++#endif
+ 
+ static void
+ fatal_llvm_error_handler(void *user_data,
+-						 const std::string& reason,
++						 const char *reason,
+ 						 bool gen_crash_diag)
+ {
+ 	ereport(FATAL,
+ 			(errcode(ERRCODE_OUT_OF_MEMORY),
+-			 errmsg("fatal llvm error: %s",
+-					reason.c_str())));
++			 errmsg("fatal llvm error: %s", reason)));
+ }
++
++#if LLVM_VERSION_MAJOR < 14
++static void
++fatal_llvm_error_handler(void *user_data,
++						 const std::string& reason,
++						 bool gen_crash_diag)
++{
++	fatal_llvm_error_handler(user_data, reason.c_str(), gen_crash_diag);
++}
++#endif
+diff --git a/src/backend/jit/llvm/llvmjit_inline.cpp b/src/backend/jit/llvm/llvmjit_inline.cpp
+index 6f03595db5..9bb4b672a7 100644
+--- a/src/backend/jit/llvm/llvmjit_inline.cpp
++++ b/src/backend/jit/llvm/llvmjit_inline.cpp
+@@ -594,7 +594,11 @@ function_inlinable(llvm::Function &F,
+ 	if (F.materialize())
+ 		elog(FATAL, "failed to materialize metadata");
+ 
+-	if (F.getAttributes().hasFnAttribute(llvm::Attribute::NoInline))
++#if LLVM_VERSION_MAJOR < 14
++#define hasFnAttr hasFnAttribute
++#endif
++
++	if (F.getAttributes().hasFnAttr(llvm::Attribute::NoInline))
+ 	{
+ 		ilog(DEBUG1, "ineligibile to import %s due to noinline",
+ 			 F.getName().data());
+@@ -871,7 +875,9 @@ create_redirection_function(std::unique_ptr<llvm::Module> &importMod,
+ 	llvm::Function *AF;
+ 	llvm::BasicBlock *BB;
+ 	llvm::CallInst *fwdcall;
++#if LLVM_VERSION_MAJOR < 14
+ 	llvm::Attribute inlineAttribute;
++#endif
+ 
+ 	AF = llvm::Function::Create(F->getFunctionType(),
+ 								LinkageTypes::AvailableExternallyLinkage,
+@@ -880,9 +886,13 @@ create_redirection_function(std::unique_ptr<llvm::Module> &importMod,
+ 
+ 	Builder.SetInsertPoint(BB);
+ 	fwdcall = Builder.CreateCall(F, &*AF->arg_begin());
++#if LLVM_VERSION_MAJOR < 14
+ 	inlineAttribute = llvm::Attribute::get(Context,
+ 										   llvm::Attribute::AlwaysInline);
+ 	fwdcall->addAttribute(~0U, inlineAttribute);
++#else
++	fwdcall->addFnAttr(llvm::Attribute::AlwaysInline);
++#endif
+ 	Builder.CreateRet(fwdcall);
+ 
+ 	return AF;
+-- 
+2.30.2
+

diff --git a/dev-db/postgresql/postgresql-11.14-r1.ebuild b/dev-db/postgresql/postgresql-11.14-r1.ebuild
index 87ce14e8127a..8ec21798e0ae 100644
--- a/dev-db/postgresql/postgresql-11.14-r1.ebuild
+++ b/dev-db/postgresql/postgresql-11.14-r1.ebuild
@@ -4,8 +4,9 @@
 EAPI=7
 
 PYTHON_COMPAT=( python3_{8,9,10} )
+LLVM_MAX_SLOT=13
 
-inherit flag-o-matic linux-info multilib pam prefix python-single-r1 systemd tmpfiles
+inherit flag-o-matic linux-info llvm multilib pam prefix python-single-r1 systemd tmpfiles
 
 KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~mips ppc ppc64 ~s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
 
@@ -36,8 +37,8 @@ icu? ( dev-libs/icu:= )
 kerberos? ( virtual/krb5 )
 ldap? ( net-nds/openldap:= )
 llvm? (
-	sys-devel/llvm:=
-	sys-devel/clang:=
+	<sys-devel/llvm-14:=
+	<sys-devel/clang-14:=
 )
 pam? ( sys-libs/pam )
 perl? ( >=dev-lang/perl-5.8:= )
@@ -83,6 +84,8 @@ selinux? ( sec-policy/selinux-postgresql )
 "
 
 pkg_setup() {
+	use llvm && llvm_pkg_setup
+
 	use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
 
 	use python && python-single-r1_pkg_setup

diff --git a/dev-db/postgresql/postgresql-11.15-r1.ebuild b/dev-db/postgresql/postgresql-11.15-r1.ebuild
index c39ca2b3e87a..4be0a8926b5d 100644
--- a/dev-db/postgresql/postgresql-11.15-r1.ebuild
+++ b/dev-db/postgresql/postgresql-11.15-r1.ebuild
@@ -4,8 +4,9 @@
 EAPI=7
 
 PYTHON_COMPAT=( python3_{8,9,10} )
+LLVM_MAX_SLOT=13
 
-inherit flag-o-matic linux-info multilib pam prefix python-single-r1 systemd tmpfiles
+inherit flag-o-matic linux-info llvm multilib pam prefix python-single-r1 systemd tmpfiles
 
 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
 
@@ -36,8 +37,8 @@ icu? ( dev-libs/icu:= )
 kerberos? ( virtual/krb5 )
 ldap? ( net-nds/openldap:= )
 llvm? (
-	sys-devel/llvm:=
-	sys-devel/clang:=
+	<sys-devel/llvm-14:=
+	<sys-devel/clang-14:=
 )
 pam? ( sys-libs/pam )
 perl? ( >=dev-lang/perl-5.8:= )
@@ -83,6 +84,8 @@ selinux? ( sec-policy/selinux-postgresql )
 "
 
 pkg_setup() {
+	use llvm && llvm_pkg_setup
+
 	use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
 
 	use python && python-single-r1_pkg_setup

diff --git a/dev-db/postgresql/postgresql-12.10-r1.ebuild b/dev-db/postgresql/postgresql-12.10-r1.ebuild
index bbbce9e61a2a..614645d2a890 100644
--- a/dev-db/postgresql/postgresql-12.10-r1.ebuild
+++ b/dev-db/postgresql/postgresql-12.10-r1.ebuild
@@ -99,6 +99,7 @@ src_prepare() {
 	sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die
 
 	use server || eapply "${FILESDIR}/${PN}-12.1-no-server.patch"
+	use server && eapply "${FILESDIR}/postgres-llvm14.patch"
 
 	if use pam ; then
 		sed "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \

diff --git a/dev-db/postgresql/postgresql-12.9-r1.ebuild b/dev-db/postgresql/postgresql-12.9-r1.ebuild
index e6b25b4e5b42..c011d4b2a894 100644
--- a/dev-db/postgresql/postgresql-12.9-r1.ebuild
+++ b/dev-db/postgresql/postgresql-12.9-r1.ebuild
@@ -99,6 +99,7 @@ src_prepare() {
 	sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die
 
 	use server || eapply "${FILESDIR}/${PN}-12.1-no-server.patch"
+	use server && eapply "${FILESDIR}/postgres-llvm14.patch"
 
 	if use pam ; then
 		sed "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \

diff --git a/dev-db/postgresql/postgresql-13.5-r1.ebuild b/dev-db/postgresql/postgresql-13.5-r1.ebuild
index d66f1944a5b6..71f1f9853dea 100644
--- a/dev-db/postgresql/postgresql-13.5-r1.ebuild
+++ b/dev-db/postgresql/postgresql-13.5-r1.ebuild
@@ -101,6 +101,7 @@ src_prepare() {
 	sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die
 
 	use server || eapply "${FILESDIR}/${PN}-13_beta1-no-server.patch"
+	use server && eapply "${FILESDIR}/postgres-llvm14.patch"
 
 	if use pam ; then
 		sed "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \

diff --git a/dev-db/postgresql/postgresql-13.6-r1.ebuild b/dev-db/postgresql/postgresql-13.6-r1.ebuild
index 57825100e068..b40f660c6477 100644
--- a/dev-db/postgresql/postgresql-13.6-r1.ebuild
+++ b/dev-db/postgresql/postgresql-13.6-r1.ebuild
@@ -101,6 +101,7 @@ src_prepare() {
 	sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die
 
 	use server || eapply "${FILESDIR}/${PN}-13_beta1-no-server.patch"
+	use server && eapply "${FILESDIR}/postgres-llvm14.patch"
 
 	if use pam ; then
 		sed "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \

diff --git a/dev-db/postgresql/postgresql-14.1-r1.ebuild b/dev-db/postgresql/postgresql-14.1-r1.ebuild
index c40034ddaf1b..5d0ca44d23aa 100644
--- a/dev-db/postgresql/postgresql-14.1-r1.ebuild
+++ b/dev-db/postgresql/postgresql-14.1-r1.ebuild
@@ -100,6 +100,7 @@ src_prepare() {
 	sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die
 
 	use server || eapply "${FILESDIR}/${PN}-14_rc1-no-server.patch"
+	use server && eapply "${FILESDIR}/postgres-llvm14.patch"
 
 	if use pam ; then
 		sed "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \

diff --git a/dev-db/postgresql/postgresql-14.2-r1.ebuild b/dev-db/postgresql/postgresql-14.2-r1.ebuild
index c40034ddaf1b..5d0ca44d23aa 100644
--- a/dev-db/postgresql/postgresql-14.2-r1.ebuild
+++ b/dev-db/postgresql/postgresql-14.2-r1.ebuild
@@ -100,6 +100,7 @@ src_prepare() {
 	sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die
 
 	use server || eapply "${FILESDIR}/${PN}-14_rc1-no-server.patch"
+	use server && eapply "${FILESDIR}/postgres-llvm14.patch"
 
 	if use pam ; then
 		sed "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \


             reply	other threads:[~2022-03-24  6:28 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-24  6:28 罗百科 [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-08-18 11:26 [gentoo-commits] repo/gentoo:master commit in: dev-db/postgresql/files/, dev-db/postgresql/ Aaron W. Swenson
2022-08-15 16:53 Aaron W. Swenson
2021-08-13 11:37 Marek Szuba
2020-08-14  1:59 Aaron W. Swenson
2020-08-14  0:53 Aaron W. Swenson
2019-06-15 10:58 Aaron W. Swenson
2018-05-20  9:42 Aaron Swenson
2018-02-11 15:55 Aaron Swenson
2017-08-10 15:16 Aaron Swenson
2017-07-13 15:34 Aaron Swenson
2017-05-31 16:48 Patrice Clement
2017-04-17 15:48 Aaron Swenson
2015-10-25 21:10 Michał Górny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1648103291.d49fccf6cbbbdab563c1d38718f9dc177548659b.patrick@gentoo \
    --to=patrick@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox