From 87feeb1d1c1c12080774d267210bced0b07731d0 Mon Sep 17 00:00:00 2001 From: imxcc Date: Wed, 2 Mar 2022 14:25:14 +0800 Subject: [PATCH] kpatch_elf: compatible with older versions of the so naming rules New openEuler so naming rules have been changed, such as: old so naming rules: libc-x.y.z.so <-----> new so naming rules: libc.so.x.y.z We need support this two version. fix elf/strip: adapt to new gcc version(10.3.1) Signed-off-by: Bihong Yu Signed-off-by: imxcc (cherry picked from commit 32e6a91435834614104e4b25b61bf5de4f3cc1c4) --- ...tible-with-older-versions-of-the-so-.patch | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 kpatch_elf-compatible-with-older-versions-of-the-so-.patch diff --git a/kpatch_elf-compatible-with-older-versions-of-the-so-.patch b/kpatch_elf-compatible-with-older-versions-of-the-so-.patch new file mode 100644 index 0000000..219043f --- /dev/null +++ b/kpatch_elf-compatible-with-older-versions-of-the-so-.patch @@ -0,0 +1,49 @@ +From b316ee94be9e6bdcda30400511593550de1eb29b Mon Sep 17 00:00:00 2001 +From: jiang-dawei15 +Date: Tue, 1 Mar 2022 16:07:37 +0800 +Subject: [PATCH 1/2] kpatch_elf: compatible with older versions of the so + naming rules + +New openEuler so naming rules have been changed, such as: + old so naming rules: libc-x.y.z.so + <-----> + new so naming rules: libc.so.x.y.z + +We need support this two version. +fix commit: abfc33435c25e1515e35768c9a2d684aa72dc780 + +Signed-off-by: Bihong Yu +--- + src/kpatch_elf.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +diff --git a/src/kpatch_elf.c b/src/kpatch_elf.c +index 260209a..833f8e1 100644 +--- a/src/kpatch_elf.c ++++ b/src/kpatch_elf.c +@@ -180,13 +180,19 @@ static int + elf_object_is_interp_exception(struct object_file *o) + { + /* libc */ +- if (!strncmp(o->name, "libc.", 5)) ++ if (!strncmp(o->name, "libc.so.", 8) || ++ (!strncmp(o->name, "libc-", 5) && ++ !strncmp(o->name + strlen(o->name) - 3, ".so", 3))) + return 1; + /* libpthread */ +- if (!strncmp(o->name, "libpthread.", 11)) ++ if (!strncmp(o->name, "libpthread.so.", 14) || ++ (!strncmp(o->name, "libpthread-", 11) && ++ !strncmp(o->name + strlen(o->name) - 3, ".so", 3))) + return 1; + /* libdl */ +- if (!strncmp(o->name, "libdl.", 6)) ++ if (!strncmp(o->name, "libdl.so.", 9) || ++ (!strncmp(o->name, "libdl-", 6) && ++ !strncmp(o->name + strlen(o->name) - 3, ".so", 3))) + return 1; + return 0; + } +-- +2.27.0 +