[PATCH 1/1] Modifying fs/binfmt_elf.c:elf_core_dump() to use round_up()
Ruinland Chuan-Tzu Tsai
ruinland at andestech.com
Mon Mar 8 06:03:56 GMT 2021
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 at andestech.com>
---
fs/binfmt_elf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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();
--
2.17.1
More information about the linux-riscv
mailing list