From 09fdb0772d1434883eed158d2ce84dab00ba507e Mon Sep 17 00:00:00 2001 From: Kamalesh Babulal Date: Wed, 4 Jul 2018 08:40:12 +0530 Subject: [PATCH] create-diff-object: Relax sh_addralign check for .text sections .text section addralign value might change between original and patched .o files, for a loop() such as: for (i = 0; i < sections_per_block; i++) { remove_memory(nid, base, MIN_MEMORY_BLOCK_SIZE); base += MIN_MEMORY_BLOCK_SIZE; } On ppc64le, which translate to: f0: 78 1b 7b 7c mr r27,r3 f4: 6c 00 9d 40 ble cr7,160 f8: ff ff 9c 3b addi r28,r28,-1 fc: 38 00 a1 fb std r29,56(r1) 100: 00 01 bf 3f addis r29,r31,256 104: 08 c2 9c 7b rldic r28,r28,24,8 108: 14 ea 9c 7f add r28,r28,r29 10c: 14 00 00 48 b 120 110: 00 00 00 60 nop 114: 00 00 00 60 nop 118: 00 00 00 60 nop 11c: 00 00 00 60 nop 120: 78 fb e4 7f mr r4,r31 .LVL174: rldic 28,28,24,8 #, tmp198, tmp196, add 28,28,29 # _45, tmp198, base .p2align 5,,31 Patch removing such loop, changes the section alignment boundary. Given that alignment changes to .text section are not fatal, relax the check for text sections. Signed-off-by: Kamalesh Babulal --- kpatch-build/create-diff-object.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c index d242d01..f539a46 100644 --- a/kpatch-build/create-diff-object.c +++ b/kpatch-build/create-diff-object.c @@ -375,8 +375,9 @@ static void kpatch_compare_correlated_section(struct section *sec) /* Compare section headers (must match or fatal) */ if (sec1->sh.sh_type != sec2->sh.sh_type || sec1->sh.sh_flags != sec2->sh.sh_flags || - sec1->sh.sh_addralign != sec2->sh.sh_addralign || - sec1->sh.sh_entsize != sec2->sh.sh_entsize) + sec1->sh.sh_entsize != sec2->sh.sh_entsize || + (sec1->sh.sh_addralign != sec2->sh.sh_addralign && + !is_text_section(sec1))) DIFF_FATAL("%s section header details differ", sec1->name); /* Short circuit for mcount sections, we rebuild regardless */