libcareplus/elf-add-section-adderss-for-STT_NOTYPE-type-of-symbo.patch
imxcc e3d89e9bf0 update patch with openeuler !19
- gensrc: we should add align while FLAGS_PUSH_SECTION flag is set
- elf: add section adderss for STT_NOTYPE type of symbol

Signed-off-by: imxcc <xingchaochao@huawei.com>
(cherry picked from commit 70651236ba10ff7178f3969445ceccecbaba5831)
2022-02-22 21:21:52 +08:00

31 lines
952 B
Diff

From 55b659c0b52a7c5f3fc493dd9c19ac76f09d0ccb Mon Sep 17 00:00:00 2001
From: Bihong Yu <yubihong@huawei.com>
Date: Sat, 22 Jan 2022 16:15:50 +0800
Subject: [PATCH] elf: add section adderss for STT_NOTYPE type of symbol
Sometimes, the symbol type of the new global static variable in the
patch may be STT_NOTYPE. We should add the section adderss to st_value
for this type symbol, otherwise, the calculated adderss for this type
symbol will be wrong, which may result in the patched process coredump.
Signed-off-by: Bihong Yu <yubihong@huawei.com>
---
src/kpatch_elf.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/kpatch_elf.c b/src/kpatch_elf.c
index 3ac56d9..5acf370 100644
--- a/src/kpatch_elf.c
+++ b/src/kpatch_elf.c
@@ -789,6 +789,7 @@ symbol_resolve(struct object_file *o,
break;
case STT_NOTYPE: // for Systemtap symbol _.stapsdt.base.kpatch
+ s->st_value += shdr[s->st_shndx].sh_addr;
break;
default:
--
2.27.0