This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 4eab0e5d62236b7ab5ef3c6c904195f1709a7add
Author: hujun5 <[email protected]>
AuthorDate: Sun Jun 28 16:38:37 2026 +0800

    sched/coredump: mark multi-call helpers as noinline to save Flash
    
    Under -O2 the compiler may inline these static helpers into every
    call site. For functions invoked from many places this duplicates
    the function body across all callers and bloats .text.
    
    elf_emit() and elf_emit_align() are already noinline_function.  Apply
    it also to the other helpers that have multiple call sites
    (elf_emit_tcb_note, elf_emit_tcb_stack, elf_emit_tcb_phdr and
    coredump_initialize_memory_region) so each keeps a single .text
    instance reached via a call.  The single-call helpers are left
    inlinable, since inlining them into their sole caller removes the
    standalone prologue/epilogue and call overhead without any code
    duplication.
    
    coredump runs only on the crash/exception path, so trading a function
    call for smaller footprint is a safe net win here.
    
    Signed-off-by: hujun5 <[email protected]>
---
 sched/misc/coredump.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sched/misc/coredump.c b/sched/misc/coredump.c
index 3b931de58d4..46179e11500 100644
--- a/sched/misc/coredump.c
+++ b/sched/misc/coredump.c
@@ -291,6 +291,7 @@ static int elf_get_info_note_size(void)
  *
  ****************************************************************************/
 
+noinline_function
 static void elf_emit_tcb_note(FAR struct elf_dumpinfo_s *cinfo,
                               FAR struct tcb_s *tcb)
 {
@@ -419,6 +420,7 @@ static void elf_emit_note(FAR struct elf_dumpinfo_s *cinfo)
  *
  ****************************************************************************/
 
+noinline_function
 static void elf_emit_tcb_stack(FAR struct elf_dumpinfo_s *cinfo,
                                FAR struct tcb_s *tcb)
 {
@@ -604,6 +606,7 @@ static void elf_emit_info_note(FAR struct elf_dumpinfo_s 
*cinfo)
  *
  ****************************************************************************/
 
+noinline_function
 static void elf_emit_tcb_phdr(FAR struct elf_dumpinfo_s *cinfo,
                               FAR struct tcb_s *tcb,
                               FAR Elf_Phdr *phdr, off_t *offset)
@@ -859,6 +862,7 @@ static void coredump_dump_dev(pid_t pid)
  *
  ****************************************************************************/
 
+noinline_function
 static int coredump_initialize_memory_region(void)
 {
 #ifdef CONFIG_BOARD_MEMORY_RANGE

Reply via email to