From 0627b9970e996f634fc172eba11f22659b3b9ac6 Mon Sep 17 00:00:00 2001 From: wangjianyu3 Date: Mon, 4 Sep 2023 16:55:35 +0800 Subject: [PATCH] binfmt: The program headers are optional. Fix problems mentioned in: https://github.com/apache/nuttx/pull/10462 Brief: rv-virt:knsh64, qemu-7.2.4 qemu-system-riscv64 -semihosting -nographic -cpu rv64 -smp 8 -M virt,aclint=on -bios none -kernel nuttx ``` [ 0.006000] _assert: Current Version: NuttX 12.0.0 8a13da322d Sep 4 2023 14:31:15 risc-v [ 0.006000] _assert: Assertion failed : at file: init/nx_bringup.c:302 task: Idle_Task 0x800017fc ``` Signed-off-by: wangjianyu3 --- binfmt/libelf/libelf_sections.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/binfmt/libelf/libelf_sections.c b/binfmt/libelf/libelf_sections.c index 5de75a8855..f47f6daa85 100644 --- a/binfmt/libelf/libelf_sections.c +++ b/binfmt/libelf/libelf_sections.c @@ -188,8 +188,8 @@ int elf_loadphdrs(FAR struct elf_loadinfo_s *loadinfo) if (loadinfo->ehdr.e_phnum < 1) { - berr("No programs(?)\n"); - return -EINVAL; + binfo("No programs(?)\n"); + return 0; } /* Get the total size of the program header table */