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 <yubihong@huawei.com>
Signed-off-by: imxcc <xingchaochao@huawei.com>
(cherry picked from commit 32e6a91435834614104e4b25b61bf5de4f3cc1c4)
50 lines
1.5 KiB
Diff
50 lines
1.5 KiB
Diff
From b316ee94be9e6bdcda30400511593550de1eb29b Mon Sep 17 00:00:00 2001
|
|
From: jiang-dawei15 <jiangdawei15@huawei.com>
|
|
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 <yubihong@huawei.com>
|
|
---
|
|
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
|
|
|