anjiahao1 opened a new pull request, #22520:
URL: https://github.com/apache/nuttx/pull/22520

   ## Summary
   
   Skip null entries when calling static constructors and destructors.
   
   The .ctors/.dtors sections can contain padding entries that the
   toolchain or the linker leaves as NULL when the section size is not a
   multiple of the pointer size.  exec_ctors() and exec_dtors() call every
   entry as a function pointer, so a padded section jumps to address zero
   during startup.  Check each entry against NULL in both the ARM and the
   ARM64 crt0.
   
   ## Impact
   
   * Is new feature added? NO - startup robustness fix.
   * Impact on user: NO
   * Impact on build: NO
   * Impact on hardware: NO
   * Impact on documentation: NO
   * Impact on security: NO
   * Impact on compatibility: NO
   
   ## Testing
   
   Build host: Linux x86_64, arm-none-eabi gcc 13.3.
   
   ```
   tools/configure.sh -a <apps> qemu-armv7a:nsh
   make -j$(nproc)
   ```
   
   The build completes (ROM 386592 B, RAM 28 KB).  The configuration has
   CONFIG_HAVE_CXXINITIALIZE=y, so both loops are compiled in.  The ARM64
   change is the same two NULL checks in arch/arm64/src/common/crt0.c and
   is covered by the CI ARM64 builds.
   
   ## PR verification
   
   * [x] This PR introduces only one functional change.
   * [x] I have updated all required description fields above.
   * [x] My PR adheres to Contributing Guidelines and Documentation.
   * [ ] My PR is still work in progress (not ready for review).
   * [x] My PR is ready for review and can be safely merged into a codebase.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to