diff --git a/0001-modify-CodeMode-on-loongarch64.patch b/0001-modify-CodeMode-on-loongarch64.patch new file mode 100644 index 0000000000000000000000000000000000000000..960b41b8679cda57bed84cd0f17ec37b66a71f89 --- /dev/null +++ b/0001-modify-CodeMode-on-loongarch64.patch @@ -0,0 +1,45 @@ +From d25b11a444f7c0d796adcc191813d167ba51d44e Mon Sep 17 00:00:00 2001 +From: Huang Yang +Date: Fri, 22 Aug 2025 14:03:26 +0800 +Subject: [PATCH] modify CodeMode on loongarch64 + +--- + src/backend/jit/llvm/llvmjit.c | 15 +++++++++++++-- + 1 file changed, 13 insertions(+), 2 deletions(-) + +diff --git a/src/backend/jit/llvm/llvmjit.c b/src/backend/jit/llvm/llvmjit.c +index aadba6b..638553b 100644 +--- a/src/backend/jit/llvm/llvmjit.c ++++ b/src/backend/jit/llvm/llvmjit.c +@@ -961,7 +961,18 @@ llvm_session_initialize(void) + features = LLVMGetHostCPUFeatures(); + elog(DEBUG2, "LLVMJIT detected CPU \"%s\", with features \"%s\"", + cpu, features); +- ++#if defined(__loongarch_lp64) ++ opt0_tm = ++ LLVMCreateTargetMachine(llvm_targetref, llvm_triple, cpu, features, ++ LLVMCodeGenLevelNone, ++ LLVMRelocDefault, ++ LLVMCodeModelLarge); ++ opt3_tm = ++ LLVMCreateTargetMachine(llvm_targetref, llvm_triple, cpu, features, ++ LLVMCodeGenLevelAggressive, ++ LLVMRelocDefault, ++ LLVMCodeModelLarge); ++#else + opt0_tm = + LLVMCreateTargetMachine(llvm_targetref, llvm_triple, cpu, features, + LLVMCodeGenLevelNone, +@@ -972,7 +983,7 @@ llvm_session_initialize(void) + LLVMCodeGenLevelAggressive, + LLVMRelocDefault, + LLVMCodeModelJITDefault); +- ++#endif + LLVMDisposeMessage(cpu); + cpu = NULL; + LLVMDisposeMessage(features); +-- +2.43.7 + diff --git a/postgresql16.spec b/postgresql16.spec index a0fe39a1705615af053106760e8c42576d0d2483..3fcc01a8a270667b7dd3dd38485994686b2ae1a0 100644 --- a/postgresql16.spec +++ b/postgresql16.spec @@ -10,11 +10,7 @@ %{!?test:%global test 1} # enable llvmjit, due to citus-llvmjit -%ifarch loongarch64 -%{!?llvmjit:%global llvmjit 0} -%else %{!?llvmjit:%global llvmjit 1} -%endif %{!?external_libpq:%global external_libpq 0} %{!?upgrade:%global upgrade 1} %{!?plpython3:%global plpython3 1} @@ -53,7 +49,7 @@ Summary: PostgreSQL client programs Name: %{majorname}%{majorversion} Version: 16.10 -Release: 1%{?dist} +Release: 2%{?dist} License: PostgreSQL Url: http://www.postgresql.org/ Source0: https://ftp.postgresql.org/pub/source/v%{version}/postgresql-%{version}.tar.bz2 @@ -71,6 +67,7 @@ Patch3004: postgresql-server-pg_config.patch Patch3005: postgresql-pgcrypto-openssl3-tests.patch Patch3031: postgresql-external-libpq.patch Patch3032: postgresql-no-libecpg.patch +Patch3040: 0001-modify-CodeMode-on-loongarch64.patch %define majorversion %(echo %{version} | cut -d. -f1) @@ -436,6 +433,7 @@ goal of accelerating analytics queries. %else %patch -P 3032 -p1 %endif +%patch -P 3040 -p1 %if ! %external_libpq @@ -1175,6 +1173,10 @@ make -C postgresql-setup-%{setup_version} check %changelog +* Fri Aug 22 2025 Huang Yang - 16.10-2 +- [Type] bugfix +- [DESC] enable llvm on loongarch64 + * Mon Aug 18 2025 Wang Guodong - 16.10-1 - Upgrade to version 16.10, fix CVE-2025-8713, CVE-2025-8714, CVE-2025-8715