From 31893a45758ff015ec20d049963e06197a20ad7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=82=A5=E7=89=9B=E5=8D=B7=E5=8D=B7=E5=8D=B7?= Date: Wed, 30 Apr 2025 09:34:59 +0000 Subject: [PATCH] =?UTF-8?q?=E5=9B=9E=E9=80=80=20'Pull=20Request=20!630=20:?= =?UTF-8?q?=20sync=20openEuler=2024.03=20bugfix'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- upatch-diff/elf-compare.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/upatch-diff/elf-compare.c b/upatch-diff/elf-compare.c index 7ccc9525..b37167c8 100644 --- a/upatch-diff/elf-compare.c +++ b/upatch-diff/elf-compare.c @@ -143,23 +143,20 @@ static void compare_correlated_nonrela_section(struct section *sec, // we may change status of sec, they are not same static int compare_correlated_section(struct section *sec, struct section *twin) { - /* We allow sh_flags and sh_addralign changes. - When we change the initial value of variables - sh_flags & sh_addralign may change in .rodata section */ + /* compare section headers */ if ((sec->sh.sh_type != twin->sh.sh_type) || - (sec->sh.sh_entsize != twin->sh.sh_entsize)) { + (sec->sh.sh_flags != twin->sh.sh_flags) || + (sec->sh.sh_entsize != twin->sh.sh_entsize) || + ((sec->sh.sh_addralign != twin->sh.sh_addralign) && + !is_text_section(sec) && + !is_string_section(sec) && + !is_rodata_section(sec))) { + /* shaddralign of .rodata may be changed from 0 to 8 bytes + once string length is over 30 */ ERROR("%s section header details differ from %s", sec->name, twin->name); return -1; } - if (sec->sh.sh_flags != twin->sh.sh_flags) { - log_warn("Section '%s' sh_flags changed from %ld to %ld\n", - sec->name, sec->sh.sh_flags, twin->sh.sh_flags); - } - if (sec->sh.sh_addralign != twin->sh.sh_addralign) { - log_warn("Section '%s' sh_addralign changed from %ld to %ld\n", - sec->name, sec->sh.sh_addralign, twin->sh.sh_addralign); - } if (is_note_section(sec)) { sec->status = SAME; -- Gitee