From 46748b2993c8667133fc911d51b3e8c57d0282c558d9ebc0b5a53d98f5c65d69 Mon Sep 17 00:00:00 2001 From: Marcus Rueckert Date: Tue, 24 Aug 2021 13:27:45 +0000 Subject: [PATCH 1/8] https://www.postgresql.org/about/news/postgresql-134-128-1113-1018-9623-and-14-beta-3-released-2277/ OBS-URL: https://build.opensuse.org/package/show/server:database:postgresql/postgresql12?expand=0&rev=45 --- postgresql-12.7.tar.bz2 | 3 --- postgresql-12.7.tar.bz2.sha256 | 1 - postgresql-12.8.tar.bz2 | 3 +++ postgresql-12.8.tar.bz2.sha256 | 1 + postgresql12.changes | 13 +++++++++++++ postgresql12.spec | 21 +++++++++++---------- 6 files changed, 28 insertions(+), 14 deletions(-) delete mode 100644 postgresql-12.7.tar.bz2 delete mode 100644 postgresql-12.7.tar.bz2.sha256 create mode 100644 postgresql-12.8.tar.bz2 create mode 100644 postgresql-12.8.tar.bz2.sha256 diff --git a/postgresql-12.7.tar.bz2 b/postgresql-12.7.tar.bz2 deleted file mode 100644 index d675d61..0000000 --- a/postgresql-12.7.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:8490741f47c88edc8b6624af009ce19fda4dc9b31c4469ce2551d84075d5d995 -size 20819005 diff --git a/postgresql-12.7.tar.bz2.sha256 b/postgresql-12.7.tar.bz2.sha256 deleted file mode 100644 index 229ce01..0000000 --- a/postgresql-12.7.tar.bz2.sha256 +++ /dev/null @@ -1 +0,0 @@ -8490741f47c88edc8b6624af009ce19fda4dc9b31c4469ce2551d84075d5d995 postgresql-12.7.tar.bz2 diff --git a/postgresql-12.8.tar.bz2 b/postgresql-12.8.tar.bz2 new file mode 100644 index 0000000..734b4a4 --- /dev/null +++ b/postgresql-12.8.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e26401e090c34ccb15ffb33a111f340833833535a7b7c5cd11cd88ab57d9c62a +size 20849478 diff --git a/postgresql-12.8.tar.bz2.sha256 b/postgresql-12.8.tar.bz2.sha256 new file mode 100644 index 0000000..e1a3c8f --- /dev/null +++ b/postgresql-12.8.tar.bz2.sha256 @@ -0,0 +1 @@ +e26401e090c34ccb15ffb33a111f340833833535a7b7c5cd11cd88ab57d9c62a postgresql-12.8.tar.bz2 diff --git a/postgresql12.changes b/postgresql12.changes index 89ec4b9..44d893f 100644 --- a/postgresql12.changes +++ b/postgresql12.changes @@ -1,3 +1,16 @@ +------------------------------------------------------------------- +Tue Aug 24 13:01:54 UTC 2021 - Marcus Rueckert + +- Upgrade to version 12.8: + * https://www.postgresql.org/docs/12/release-12-8.html + * CVE-2021-3677 (boo#1189748) + The planner could create an incorrect plan in cases where two + ProjectionPaths were stacked on top of each other. The only + known way to trigger that situation involves parallel sort + operations, but there may be other instances. The result would + be crashes or incorrect query results. Disclosure of server + memory contents is also possible. + ------------------------------------------------------------------- Wed May 19 15:24:24 UTC 2021 - Reinhard Max diff --git a/postgresql12.spec b/postgresql12.spec index f15af1c..37d9264 100644 --- a/postgresql12.spec +++ b/postgresql12.spec @@ -1,5 +1,5 @@ # -# spec file for package postgresql12 +# spec file # # Copyright (c) 2021 SUSE LLC # @@ -16,7 +16,7 @@ # -%define pgversion 12.7 +%define pgversion 12.8 %define pgmajor 12 %define pgsuffix %pgmajor %define buildlibs 0 @@ -159,7 +159,7 @@ Provides: postgresql = %version-%release Provides: postgresql-implementation = %version-%release Requires: %libpq >= %version Requires(post): postgresql-noarch >= %pgmajor -Requires(postun): postgresql-noarch >= %pgmajor +Requires(postun):postgresql-noarch >= %pgmajor # At this point we changed the package layout on SLE and conflict with # older releases to get a clean cut. Conflicts: postgresql-noarch < 12.0.1 @@ -227,9 +227,9 @@ Requires: this-is-only-for-build-envs Provides: %libecpg = %version-%release Provides: %libpq = %version-%release Provides: %pgname-devel = %version-%release -Conflicts: %pgname-devel Conflicts: %libecpg Conflicts: %libpq +Conflicts: %pgname-devel %else Requires: %libecpg >= %version Requires: %libpq >= %version @@ -248,7 +248,7 @@ Provides: %pgname-server-devel = %version-%release Provides: postgresql-server-devel = %version-%release Provides: postgresql-server-devel-implementation = %version-%release Requires(post): postgresql-server-noarch >= %pgmajor -Requires(postun): postgresql-server-noarch >= %pgmajor +Requires(postun):postgresql-server-noarch >= %pgmajor Requires: %pgname-devel = %version Requires: %pgname-server = %version-%release # Installation of postgresql??-devel is exclusive @@ -307,10 +307,10 @@ Recommends: %{name}-llvmjit Provides: postgresql-server-implementation = %version-%release Requires: %libpq >= %version Requires(pre): postgresql-server-noarch >= %pgmajor -Requires(preun): postgresql-server-noarch >= %pgmajor -Requires(postun): postgresql-server-noarch >= %pgmajor +Requires(preun):postgresql-server-noarch >= %pgmajor +Requires(postun):postgresql-server-noarch >= %pgmajor Requires(post): postgresql-noarch >= %pgmajor -Requires(postun): postgresql-noarch >= %pgmajor +Requires(postun):postgresql-noarch >= %pgmajor %description server PostgreSQL is an advanced object-relational database management system @@ -442,7 +442,7 @@ that supports an extended subset of the SQL standard, including transactions, foreign keys, subqueries, triggers, and user-defined types and functions. -This package contains the PL/Tcl procedural language for PostgreSQL. +This package contains the PL/Tcl procedural language for PostgreSQL. With thie module one can use Tcl to write stored procedures, functions, and triggers. @@ -722,7 +722,7 @@ cat server-devel.files >> devel.files cat > libpq.files <> libpq.files %find_lang libpq5-$VLANG libpq.files @@ -922,6 +922,7 @@ fi %if %buildlibs && %mini %files %devel -f devel.files -f libpq.files -f libecpg.files %else + %files %devel -f devel.files %endif From b697d2e35ae41817f014f8614a84465b07db1f0cbf4d3596772a094c8723bb40 Mon Sep 17 00:00:00 2001 From: Marcus Rueckert Date: Tue, 24 Aug 2021 13:32:32 +0000 Subject: [PATCH 2/8] fix header OBS-URL: https://build.opensuse.org/package/show/server:database:postgresql/postgresql12?expand=0&rev=46 --- postgresql12.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgresql12.spec b/postgresql12.spec index 37d9264..3bcef87 100644 --- a/postgresql12.spec +++ b/postgresql12.spec @@ -1,5 +1,5 @@ # -# spec file +# spec file for package postgresql12 # # Copyright (c) 2021 SUSE LLC # From 7f6dd520bbadf1031f6222b77ec30af359a603ca5586d792b7aeb2d0e933f9ce Mon Sep 17 00:00:00 2001 From: Marcus Rueckert Date: Tue, 24 Aug 2021 13:35:00 +0000 Subject: [PATCH 3/8] fix scriptlet syntax OBS-URL: https://build.opensuse.org/package/show/server:database:postgresql/postgresql12?expand=0&rev=47 --- postgresql12.spec | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/postgresql12.spec b/postgresql12.spec index 3bcef87..bfba53a 100644 --- a/postgresql12.spec +++ b/postgresql12.spec @@ -159,7 +159,7 @@ Provides: postgresql = %version-%release Provides: postgresql-implementation = %version-%release Requires: %libpq >= %version Requires(post): postgresql-noarch >= %pgmajor -Requires(postun):postgresql-noarch >= %pgmajor +Requires(postun): postgresql-noarch >= %pgmajor # At this point we changed the package layout on SLE and conflict with # older releases to get a clean cut. Conflicts: postgresql-noarch < 12.0.1 @@ -248,7 +248,7 @@ Provides: %pgname-server-devel = %version-%release Provides: postgresql-server-devel = %version-%release Provides: postgresql-server-devel-implementation = %version-%release Requires(post): postgresql-server-noarch >= %pgmajor -Requires(postun):postgresql-server-noarch >= %pgmajor +Requires(postun): postgresql-server-noarch >= %pgmajor Requires: %pgname-devel = %version Requires: %pgname-server = %version-%release # Installation of postgresql??-devel is exclusive @@ -307,10 +307,10 @@ Recommends: %{name}-llvmjit Provides: postgresql-server-implementation = %version-%release Requires: %libpq >= %version Requires(pre): postgresql-server-noarch >= %pgmajor -Requires(preun):postgresql-server-noarch >= %pgmajor -Requires(postun):postgresql-server-noarch >= %pgmajor +Requires(preun): postgresql-server-noarch >= %pgmajor +Requires(postun): postgresql-server-noarch >= %pgmajor Requires(post): postgresql-noarch >= %pgmajor -Requires(postun):postgresql-noarch >= %pgmajor +Requires(postun): postgresql-noarch >= %pgmajor %description server PostgreSQL is an advanced object-relational database management system From eab86d3b60911ce8a099a0a160e0c4e54921b42cef3e58b5b2b94bb55829b6da Mon Sep 17 00:00:00 2001 From: Reinhard Max Date: Wed, 25 Aug 2021 11:41:54 +0000 Subject: [PATCH 4/8] - bsc#1187751: Make the dependency of postgresqlXX-server-devel on llvm and clang optional (postgresql-llvm-optional.patch). OBS-URL: https://build.opensuse.org/package/show/server:database:postgresql/postgresql12?expand=0&rev=48 --- postgresql-llvm-optional.patch | 16 ++++++++++++++++ postgresql12.changes | 6 ++++++ postgresql12.spec | 10 ++++++---- 3 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 postgresql-llvm-optional.patch diff --git a/postgresql-llvm-optional.patch b/postgresql-llvm-optional.patch new file mode 100644 index 0000000..87a8d9f --- /dev/null +++ b/postgresql-llvm-optional.patch @@ -0,0 +1,16 @@ +--- src/Makefile.global.in.orig ++++ src/Makefile.global.in +@@ -192,7 +192,12 @@ with_krb_srvnam = @with_krb_srvnam@ + with_ldap = @with_ldap@ + with_libxml = @with_libxml@ + with_libxslt = @with_libxslt@ +-with_llvm = @with_llvm@ ++# Only build for LLVM, if the core supports it and the llvm and clang packages are installed. ++ifeq (@with_llvm@ $(wildcard /usr/bin/clang /usr/bin/llvm-lto),yes /usr/bin/clang /usr/bin/llvm-lto) ++with_llvm = yes ++else ++with_llvm = no ++endif + with_system_tzdata = @with_system_tzdata@ + with_uuid = @with_uuid@ + with_zlib = @with_zlib@ diff --git a/postgresql12.changes b/postgresql12.changes index 44d893f..d43b217 100644 --- a/postgresql12.changes +++ b/postgresql12.changes @@ -11,6 +11,12 @@ Tue Aug 24 13:01:54 UTC 2021 - Marcus Rueckert be crashes or incorrect query results. Disclosure of server memory contents is also possible. +------------------------------------------------------------------- +Fri Jul 2 07:47:15 UTC 2021 - Reinhard Max + +- bsc#1187751: Make the dependency of postgresqlXX-server-devel on + llvm and clang optional (postgresql-llvm-optional.patch). + ------------------------------------------------------------------- Wed May 19 15:24:24 UTC 2021 - Reinhard Max diff --git a/postgresql12.spec b/postgresql12.spec index bfba53a..5806dda 100644 --- a/postgresql12.spec +++ b/postgresql12.spec @@ -88,6 +88,7 @@ BuildRequires: %libpq %bcond_with systemd %bcond_with systemd_notify %endif + %if 0%{?suse_version} >= 1500 && %pgsuffix >= 11 && %pgsuffix < 90 %bcond_without llvm %else @@ -153,6 +154,7 @@ Patch4: postgresql-plperl-keep-rpath.patch Patch6: postgresql-testsuite-int8.sql.patch Patch8: postgresql-testsuite-keep-results-file.patch Patch9: postgresql-var-run-socket.patch +Patch10: postgresql-llvm-optional.patch URL: https://www.postgresql.org/ BuildRoot: %{_tmppath}/%{name}-%{version}-build Provides: postgresql = %version-%release @@ -255,8 +257,8 @@ Requires: %pgname-server = %version-%release Provides: postgresql-server-devel-exclusive = %pgmajor Conflicts: postgresql-server-devel-exclusive < %pgmajor %if %{with llvm} -Requires: clang -Requires: llvm +Recommends: clang +Recommends: llvm %endif Requires: libxslt-devel Requires: openssl-devel @@ -459,6 +461,7 @@ touch -r configure tmp %patch6 %patch8 -p1 %patch9 +%patch10 touch -r tmp configure rm tmp find src/test/ -name '*.orig' -delete @@ -533,8 +536,7 @@ make check || { %endif %install -VLANG=${RPM_PACKAGE_VERSION%%.*} -VSO=${RPM_PACKAGE_VERSION%%%%.*} +VLANG=%pgmajor %if %mini make DESTDIR=%buildroot PACKAGE_TARNAME=%pgname -C src/include install make DESTDIR=%buildroot PACKAGE_TARNAME=%pgname -C src/interfaces install From df48f463ed4f8501b4d71ac886a57849181245205aebfa014e6b5680482cf8b3 Mon Sep 17 00:00:00 2001 From: Reinhard Max Date: Fri, 27 Aug 2021 17:22:37 +0000 Subject: [PATCH 5/8] Sync spec file with other versions OBS-URL: https://build.opensuse.org/package/show/server:database:postgresql/postgresql12?expand=0&rev=49 --- postgresql12.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/postgresql12.spec b/postgresql12.spec index 5806dda..e2e5876 100644 --- a/postgresql12.spec +++ b/postgresql12.spec @@ -72,7 +72,7 @@ BuildRequires: tcl-devel BuildRequires: timezone BuildRequires: zlib-devel %bcond_without selinux -%if %pgmajor > 10 || 0%{?suse_version} <= 1500 +%if 0%{?suse_version} <= 1500 %bcond_without icu %else %bcond_with icu @@ -154,7 +154,9 @@ Patch4: postgresql-plperl-keep-rpath.patch Patch6: postgresql-testsuite-int8.sql.patch Patch8: postgresql-testsuite-keep-results-file.patch Patch9: postgresql-var-run-socket.patch +%if %{with llvm} Patch10: postgresql-llvm-optional.patch +%endif URL: https://www.postgresql.org/ BuildRoot: %{_tmppath}/%{name}-%{version}-build Provides: postgresql = %version-%release @@ -461,7 +463,9 @@ touch -r configure tmp %patch6 %patch8 -p1 %patch9 +%if %{with llvm} %patch10 +%endif touch -r tmp configure rm tmp find src/test/ -name '*.orig' -delete From 8d6c053616a8a2ad258b4fbe81f5d03f438418cc0c8bd191eda603668292eb7f Mon Sep 17 00:00:00 2001 From: Reinhard Max Date: Tue, 31 Aug 2021 11:46:19 +0000 Subject: [PATCH 6/8] - bsc#1185952: fix build with llvm12 on s390x. 0001-jit-Workaround-potential-datalayout-mismatch-on-s390.patch OBS-URL: https://build.opensuse.org/package/show/server:database:postgresql/postgresql12?expand=0&rev=50 --- ...otential-datalayout-mismatch-on-s390.patch | 99 +++++++++++++++++++ postgresql12.changes | 6 ++ postgresql12.spec | 9 +- 3 files changed, 108 insertions(+), 6 deletions(-) create mode 100644 0001-jit-Workaround-potential-datalayout-mismatch-on-s390.patch diff --git a/0001-jit-Workaround-potential-datalayout-mismatch-on-s390.patch b/0001-jit-Workaround-potential-datalayout-mismatch-on-s390.patch new file mode 100644 index 0000000..1d11412 --- /dev/null +++ b/0001-jit-Workaround-potential-datalayout-mismatch-on-s390.patch @@ -0,0 +1,99 @@ +From 0edaa982336823d4d7af8f10b91579fe0099ef3d Mon Sep 17 00:00:00 2001 +From: Tom Stellard +Date: Tue, 20 Apr 2021 20:14:21 -0700 +Subject: [PATCH] jit: Workaround potential datalayout mismatch on s390x + +LLVM's s390x target uses a different datalayout for z13 and newer processors. +If llvmjit_types.bc is compiled to target a processor older than z13, and +then the JIT runs on a z13 or newer processor, then there will be a mismatch +in datalayouts between llvmjit_types.bc and the JIT engine. This mismatch +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))); + } + ++/* ++ * 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 ++ * and the JIT is running on z13 or newer. ++ * See computeDataLayout() function in ++ * llvm/lib/Target/SystemZ/SystemZTargetMachine.cpp for information on the ++ * datalayout differences. ++ */ ++static bool ++needs_systemz_workaround(void) ++{ ++ bool ret = false; ++ LLVMContextRef llvm_context; ++ LLVMTypeRef vec_type; ++ LLVMTargetDataRef llvm_layoutref; ++ if (strncmp(LLVMGetTargetName(llvm_targetref), "systemz", strlen("systemz"))) ++ { ++ return false; ++ } ++ ++ llvm_context = LLVMGetModuleContext(llvm_types_module); ++ vec_type = LLVMVectorType(LLVMIntTypeInContext(llvm_context, 32), 4); ++ llvm_layoutref = LLVMCreateTargetData(llvm_layout); ++ ret = (LLVMABIAlignmentOfType(llvm_layoutref, vec_type) == 16); ++ LLVMDisposeTargetData(llvm_layoutref); ++ return ret; ++} ++ + /* + * Per session initialization. + */ +@@ -785,6 +814,7 @@ llvm_session_initialize(void) + MemoryContext oldcontext; + char *error = NULL; + char *cpu = NULL; ++ char *host_features = NULL; + char *features = NULL; + LLVMTargetMachineRef opt0_tm; + LLVMTargetMachineRef opt3_tm; +@@ -816,10 +846,17 @@ llvm_session_initialize(void) + * features not all CPUs have (weird, huh). + */ + cpu = LLVMGetHostCPUName(); +- features = LLVMGetHostCPUFeatures(); ++ features = host_features = LLVMGetHostCPUFeatures(); + elog(DEBUG2, "LLVMJIT detected CPU \"%s\", with features \"%s\"", + cpu, features); + ++ if (needs_systemz_workaround()) ++ { ++ const char *no_vector =",-vector"; ++ features = malloc(sizeof(char) * (strlen(host_features) + strlen(no_vector) + 1)); ++ sprintf(features, "%s%s", host_features, no_vector); ++ } ++ + opt0_tm = + LLVMCreateTargetMachine(llvm_targetref, llvm_triple, cpu, features, + LLVMCodeGenLevelNone, +@@ -833,8 +870,13 @@ llvm_session_initialize(void) + + LLVMDisposeMessage(cpu); + cpu = NULL; +- LLVMDisposeMessage(features); ++ if (features != host_features) ++ { ++ free(features); ++ } + features = NULL; ++ LLVMDisposeMessage(host_features); ++ host_features = NULL; + + /* force symbols in main binary to be loaded */ + LLVMLoadLibraryPermanently(NULL); +-- +2.27.0 + diff --git a/postgresql12.changes b/postgresql12.changes index d43b217..3072b02 100644 --- a/postgresql12.changes +++ b/postgresql12.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Aug 31 11:14:53 UTC 2021 - Reinhard Max + +- bsc#1185952: fix build with llvm12 on s390x. + 0001-jit-Workaround-potential-datalayout-mismatch-on-s390.patch + ------------------------------------------------------------------- Tue Aug 24 13:01:54 UTC 2021 - Marcus Rueckert diff --git a/postgresql12.spec b/postgresql12.spec index e2e5876..725a4cc 100644 --- a/postgresql12.spec +++ b/postgresql12.spec @@ -116,15 +116,10 @@ BuildRequires: libicu-devel BuildRequires: libselinux-devel %endif %if %{with llvm} -BuildRequires: gcc-c++ -%ifarch s390x -BuildRequires: clang11 -BuildRequires: llvm11-devel -%else BuildRequires: clang +BuildRequires: gcc-c++ BuildRequires: llvm-devel %endif -%endif BuildRequires: libxslt-devel BuildRequires: openldap2-devel BuildRequires: openssl-devel @@ -156,6 +151,7 @@ Patch8: postgresql-testsuite-keep-results-file.patch Patch9: postgresql-var-run-socket.patch %if %{with llvm} Patch10: postgresql-llvm-optional.patch +Patch11: 0001-jit-Workaround-potential-datalayout-mismatch-on-s390.patch %endif URL: https://www.postgresql.org/ BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -465,6 +461,7 @@ touch -r configure tmp %patch9 %if %{with llvm} %patch10 +%patch11 -p1 %endif touch -r tmp configure rm tmp From 9728ec8991e2881399c67955310e73fd345546064be836ed37e14e7c237a3105 Mon Sep 17 00:00:00 2001 From: Reinhard Max Date: Tue, 31 Aug 2021 14:26:25 +0000 Subject: [PATCH 7/8] - bsc#1179945: Re-enable icu for PostgreSQL 10. OBS-URL: https://build.opensuse.org/package/show/server:database:postgresql/postgresql12?expand=0&rev=51 --- postgresql12.changes | 1 + postgresql12.spec | 4 ---- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/postgresql12.changes b/postgresql12.changes index 3072b02..c2b89f8 100644 --- a/postgresql12.changes +++ b/postgresql12.changes @@ -3,6 +3,7 @@ Tue Aug 31 11:14:53 UTC 2021 - Reinhard Max - bsc#1185952: fix build with llvm12 on s390x. 0001-jit-Workaround-potential-datalayout-mismatch-on-s390.patch +- bsc#1179945: Re-enable icu for PostgreSQL 10. ------------------------------------------------------------------- Tue Aug 24 13:01:54 UTC 2021 - Marcus Rueckert diff --git a/postgresql12.spec b/postgresql12.spec index 725a4cc..636325a 100644 --- a/postgresql12.spec +++ b/postgresql12.spec @@ -72,11 +72,7 @@ BuildRequires: tcl-devel BuildRequires: timezone BuildRequires: zlib-devel %bcond_without selinux -%if 0%{?suse_version} <= 1500 %bcond_without icu -%else -%bcond_with icu -%endif %if !%buildlibs BuildRequires: %libecpg BuildRequires: %libpq From f596acf83c9a66d2c9c6df575ae4ce643de4cbb89ea1e91a73ba3ef64cc94b10 Mon Sep 17 00:00:00 2001 From: Reinhard Max Date: Tue, 31 Aug 2021 16:14:13 +0000 Subject: [PATCH 8/8] 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