48 lines
1.8 KiB
Diff
48 lines
1.8 KiB
Diff
From 7fa14b0c6f2e42cdf76b44b1337eb27e5b777d14 Mon Sep 17 00:00:00 2001
|
|
From: Zhipeng Xie <xiezhipeng1@huawei.com>
|
|
Date: Fri, 2 Nov 2018 17:25:38 +0000
|
|
Subject: [PATCH 23/24] create-diff-object: create dynamic relocs for changed
|
|
functions in this object
|
|
|
|
Currently, we only create dynamic relocs for changed functions of
|
|
other objects, but not this object. It will cause a problem like:
|
|
|
|
original: funcA and funcB (funcA calls funcB)
|
|
patch-1: funcA-1 and funcB-1 (funcA-1 calls funcB-1)
|
|
patch-2: funcB-2 (funcA-1 should call funcB-2)
|
|
|
|
But as we don't create dynamic relocs for funcA-1, it will call
|
|
funcB-1 directly (not by jumping from funcB). So the new funcB-2
|
|
will not get called. This patch will create dynamic relocs for
|
|
all the changed functions, including changed ones in this object.
|
|
|
|
Reported-by: Xie Zhipeng <xiezhipeng1@huawei.com>
|
|
Tested-by: Zhou Chengming <zhouchengming1@huawei.com>
|
|
Signed-off-by: Zhou Chengming <zhouchengming1@huawei.com>
|
|
Signed-off-by: Li Bin <huawei.libin@huawei.com>
|
|
Signed-off-by: Zhipeng Xie <xiezhipeng1@huawei.com>
|
|
---
|
|
kpatch-build/create-diff-object.c | 6 ++++++
|
|
1 file changed, 6 insertions(+)
|
|
|
|
diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c
|
|
index 59d491d..3a12ee1 100644
|
|
--- a/kpatch-build/create-diff-object.c
|
|
+++ b/kpatch-build/create-diff-object.c
|
|
@@ -3238,6 +3238,12 @@ static bool need_dynrela(struct lookup_table *table, struct section *sec, const
|
|
return false;
|
|
|
|
if (rela->sym->sec) {
|
|
+ if (rela->sym->type == STT_FUNC &&
|
|
+ rela->sym->status == CHANGED &&
|
|
+ rela->sym->sec != sec->base &&
|
|
+ sec->base->sym &&
|
|
+ sec->base->sym->type == STT_FUNC)
|
|
+ return true;
|
|
/*
|
|
* Internal symbols usually don't need dynrelas, because they
|
|
* live in the patch module and can be relocated normally.
|
|
--
|
|
2.23.0
|
|
|