From db7a5232a973579132615c171b014f7be159d55a Mon Sep 17 00:00:00 2001 From: renoseven Date: Tue, 24 Jun 2025 17:32:59 +0800 Subject: [PATCH] upatch-diff: fix special section cannot be correlated issue In some special case, section name may be changed like from '.text.xxxx' to '.text.xxxx.unlikely', while the section content does not change. This issue caused section correlation failure. We found that the section corresponding symbol was same. Thus, we linked symbol section when correlating symbols. Signed-off-by: renoseven --- upatch-diff/elf-correlate.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/upatch-diff/elf-correlate.c b/upatch-diff/elf-correlate.c index 8e2f7659..5991c2cf 100644 --- a/upatch-diff/elf-correlate.c +++ b/upatch-diff/elf-correlate.c @@ -38,6 +38,10 @@ static void correlate_symbol(struct symbol *sym_orig, sym_patched->name, sym_orig->name); sym_patched->name = sym_orig->name; } + if (sym_patched->sec && sym_orig->sec) { + sym_patched->sec->twin = sym_orig->sec; + sym_orig->sec->twin = sym_patched->sec; + } } void upatch_correlate_symbols(struct upatch_elf *uelf_source, -- Gitee