diff mbox series

[1/1] Modifying fs/binfmt_elf.c:elf_core_dump() to use round_up()

Message ID 20210308060356.329-2-ruinland@andestech.com (mailing list archive)
State New, archived
Headers show
Series fs: binfmt_elf.c:elf_core_dump() link error on RV32 platform without optimization | expand

Commit Message

Ruinland ChuanTzu Tsai March 8, 2021, 6:03 a.m. UTC
Since roundup() will use plain division which might cause the compiler
to use its own integer library routines (i.e. __divid3() in libgcc) on
32bit mahcines when "O0" is specified. The problem won't occur if it
uses round_up() which utilize bitwise operations (shift & and), and the
limitation that "the divisor must be the power of 2" is true on
ELF_EXEC_PAGESIZE.

Signed-off-by: Ruinland Chuan-Tzu Tsai <ruinland@andestech.com>
---
 fs/binfmt_elf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index b12ba98ae..01d4d6d2b 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -2209,7 +2209,7 @@  static int elf_core_dump(struct coredump_params *cprm)
 		offset += sz;
 	}
 
-	dataoff = offset = roundup(offset, ELF_EXEC_PAGESIZE);
+	dataoff = offset = round_up(offset, ELF_EXEC_PAGESIZE);
 
 	offset += vma_data_size;
 	offset += elf_core_extra_data_size();