From f0c9f95fec6b8c3b6ee7f4852605b346d903c0e6 Mon Sep 17 00:00:00 2001 From: ningyu <405888464@qq.com> Date: Fri, 9 Aug 2024 12:17:18 +0800 Subject: [PATCH] upatch-diff: fix .rela.text section status bug Signed-off-by: ningyu <405888464@qq.com> --- upatch-diff/create-diff-object.c | 2 +- upatch-diff/elf-compare.c | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/upatch-diff/create-diff-object.c b/upatch-diff/create-diff-object.c index 8830956..0eea362 100644 --- a/upatch-diff/create-diff-object.c +++ b/upatch-diff/create-diff-object.c @@ -868,7 +868,7 @@ static void verify_patchability(struct upatch_elf *uelf) int errs = 0; list_for_each_entry(sec, &uelf->sections, list) { - if (sec->status == CHANGED && !sec->include) { + if (sec->status == CHANGED && !sec->include && !is_rela_section(sec)) { log_normal("Section '%s' is changed, but it is not selected for inclusion\n", sec->name); errs++; } diff --git a/upatch-diff/elf-compare.c b/upatch-diff/elf-compare.c index 851c25f..5d39825 100644 --- a/upatch-diff/elf-compare.c +++ b/upatch-diff/elf-compare.c @@ -345,12 +345,10 @@ static inline void update_section_status(struct section *sec, enum status status sec->twin->status = status; } if (is_rela_section(sec)) { - if ((sec->base != NULL) && - (sec->base->sym != NULL)) { + if ((sec->base != NULL) && (sec->base->sym != NULL) && status != SAME) { sec->base->sym->status = status; } - } - else { + } else { if (sec->sym != NULL) { sec->sym->status = status; } -- 2.34.1