From c25e2cbdc9b2b8836af9859b837bc1247ea905a6 Mon Sep 17 00:00:00 2001 From: herengui Date: Mon, 28 Aug 2023 14:44:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=BE=99=E8=8A=AF=E5=92=8C?= =?UTF-8?q?=E7=94=B3=E5=A8=81=E6=9E=B6=E6=9E=84=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: herengui (cherry picked from commit 3d70ac03dba53c7fd12665945cc0f1dda5e9f3b2) --- 1000-kpatch-0.9.5-sw_64.patch | 55 +++++++++++++++++++++++++++ 1001-kpatch-0.9.5-loongarch64.patch | 58 +++++++++++++++++++++++++++++ kpatch.spec | 12 +++++- 3 files changed, 123 insertions(+), 2 deletions(-) create mode 100644 1000-kpatch-0.9.5-sw_64.patch create mode 100644 1001-kpatch-0.9.5-loongarch64.patch diff --git a/1000-kpatch-0.9.5-sw_64.patch b/1000-kpatch-0.9.5-sw_64.patch new file mode 100644 index 0000000..cb9319d --- /dev/null +++ b/1000-kpatch-0.9.5-sw_64.patch @@ -0,0 +1,55 @@ +From 8aeaf418a8826ede3485ffc440d8bdad62aea902 Mon Sep 17 00:00:00 2001 +From: rpm-build +Date: Fri, 10 Mar 2023 14:44:11 +0800 +Subject: [PATCH] kpatch-0.9.5-sw + +--- + kpatch-build/Makefile | 4 ++++ + kpatch-build/create-diff-object.c | 2 +- + kpatch-build/kpatch-elf.c | 2 +- + 3 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/kpatch-build/Makefile b/kpatch-build/Makefile +index 423c32a..09c631f 100644 +--- a/kpatch-build/Makefile ++++ b/kpatch-build/Makefile +@@ -14,6 +14,10 @@ ifeq ($(ARCH),x86_64) + SOURCES += insn/insn.c insn/inat.c + INSN = insn/insn.o insn/inat.o + insn/%.o: CFLAGS := $(filter-out -Wconversion, $(CFLAGS)) ++else ifeq ($(ARCH),sw_64) ++SOURCES += insn/insn.c insn/inat.c ++INSN = insn/insn.o insn/inat.o ++insn/%.o: CFLAGS := $(filter-out -Wconversion, $(CFLAGS)) + else ifeq ($(ARCH),aarch64) + SOURCES += insn/insn.c insn/inat.c + INSN = insn/insn.o insn/inat.o +diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c +index 6f3937f..ffab889 100644 +--- a/kpatch-build/create-diff-object.c ++++ b/kpatch-build/create-diff-object.c +@@ -1688,7 +1688,7 @@ static void kpatch_replace_sections_syms(struct kpatch_elf *kelf) + continue; + } + +-#if defined(__powerpc64__) || defined(__aarch64__) ++#if defined(__powerpc64__) || defined(__aarch64__) || defined(__sw_64__) + add_off = 0; + #else + if (rela->type == R_X86_64_PC32 || +diff --git a/kpatch-build/kpatch-elf.c b/kpatch-build/kpatch-elf.c +index c84d865..408874e 100644 +--- a/kpatch-build/kpatch-elf.c ++++ b/kpatch-build/kpatch-elf.c +@@ -325,7 +325,7 @@ static void kpatch_find_func_profiling_calls(struct kpatch_elf *kelf) + list_for_each_entry(sym, &kelf->symbols, list) { + if (sym->type != STT_FUNC || !sym->sec || !sym->sec->rela) + continue; +-#if defined(__powerpc64__) ++#if defined(__powerpc64__) || defined(__sw_64__) + list_for_each_entry(rela, &sym->sec->rela->relas, list) { + if (!strcmp(rela->sym->name, "_mcount")) { + sym->has_func_profiling = 1; +-- +2.33.0 + diff --git a/1001-kpatch-0.9.5-loongarch64.patch b/1001-kpatch-0.9.5-loongarch64.patch new file mode 100644 index 0000000..cd0e632 --- /dev/null +++ b/1001-kpatch-0.9.5-loongarch64.patch @@ -0,0 +1,58 @@ +From 45df848acc148dd03480af1afee45794ff7dee25 Mon Sep 17 00:00:00 2001 +From: rpm-build +Date: Wed, 10 May 2023 10:10:40 +0800 +Subject: [PATCH] kpatch 0.9.5 loongarch64 + +- add support loongarch64 + +Signed-off-by: rpm-build +--- + kpatch-build/Makefile | 4 ++++ + kpatch-build/create-diff-object.c | 2 +- + kpatch-build/kpatch-elf.c | 2 +- + 3 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/kpatch-build/Makefile b/kpatch-build/Makefile +index 09c631f..f33d415 100644 +--- a/kpatch-build/Makefile ++++ b/kpatch-build/Makefile +@@ -18,6 +18,10 @@ else ifeq ($(ARCH),sw_64) + SOURCES += insn/insn.c insn/inat.c + INSN = insn/insn.o insn/inat.o + insn/%.o: CFLAGS := $(filter-out -Wconversion, $(CFLAGS)) ++else ifeq ($(ARCH),loongarch64) ++SOURCES += insn/insn.c insn/inat.c ++INSN = insn/insn.o insn/inat.o ++insn/%.o: CFLAGS := $(filter-out -Wconversion, $(CFLAGS)) + else ifeq ($(ARCH),aarch64) + SOURCES += insn/insn.c insn/inat.c + INSN = insn/insn.o insn/inat.o +diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c +index ffab889..80d1253 100644 +--- a/kpatch-build/create-diff-object.c ++++ b/kpatch-build/create-diff-object.c +@@ -1688,7 +1688,7 @@ static void kpatch_replace_sections_syms(struct kpatch_elf *kelf) + continue; + } + +-#if defined(__powerpc64__) || defined(__aarch64__) || defined(__sw_64__) ++#if defined(__powerpc64__) || defined(__aarch64__) || defined(__sw_64__) || defined(__loongarch__) + add_off = 0; + #else + if (rela->type == R_X86_64_PC32 || +diff --git a/kpatch-build/kpatch-elf.c b/kpatch-build/kpatch-elf.c +index 408874e..9c2e157 100644 +--- a/kpatch-build/kpatch-elf.c ++++ b/kpatch-build/kpatch-elf.c +@@ -325,7 +325,7 @@ static void kpatch_find_func_profiling_calls(struct kpatch_elf *kelf) + list_for_each_entry(sym, &kelf->symbols, list) { + if (sym->type != STT_FUNC || !sym->sec || !sym->sec->rela) + continue; +-#if defined(__powerpc64__) || defined(__sw_64__) ++#if defined(__powerpc64__) || defined(__sw_64__) || defined(__loongarch__) + list_for_each_entry(rela, &sym->sec->rela->relas, list) { + if (!strcmp(rela->sym->name, "_mcount")) { + sym->has_func_profiling = 1; +-- +2.39.2 + diff --git a/kpatch.spec b/kpatch.spec index 6c28375..652e086 100644 --- a/kpatch.spec +++ b/kpatch.spec @@ -1,7 +1,7 @@ Name: kpatch Epoch: 1 Version: 0.9.5 -Release: 7 +Release: 8 Summary: A Linux dynamic kernel patching infrastructure License: GPLv2 @@ -59,7 +59,9 @@ Patch0043:0043-kpatch-build-Remove-duplicate-functions.patch Patch0044:0044-lookup-skip-finding-local-symbols-for-object-with-no.patch Patch0045:0045-backport-create-diff-object-add-support-for-.return_sites-sec.patch Patch0046:0046-create-diff-object-ignore-entsize-change-of-.return_.patch - +# architecture support +Patch1000:1000-kpatch-0.9.5-sw_64.patch +Patch1001:1001-kpatch-0.9.5-loongarch64.patch BuildRequires: gcc elfutils-libelf-devel kernel-devel git Requires: bc make gcc patch bison flex openssl-devel Recommends: %{name}-help = %{version}-%{release} @@ -119,6 +121,12 @@ popd %{_mandir}/man1/*.1.gz %changelog +* Mon Aug 28 2023 herengui - 0.9.5-8 +- TYPE:bugfix +- ID:NA +- SUG:NA +- DESC: add support for sw_64 and loongarch64 + * Mon Oct 17 2022 Bin Hu -1:0.9.5-7 - Type:bugfix - ID:NA -- Gitee