]> Projects (at) Tadryanom (dot) Me - AdrOS.git/commit
fix(ulibc): add null-pointer guards in __libc_init_array/fini_array
authorTulio A M Mendes <[email protected]>
Thu, 16 Apr 2026 05:36:47 +0000 (02:36 -0300)
committerTulio A M Mendes <[email protected]>
Thu, 16 Apr 2026 05:36:47 +0000 (02:36 -0300)
commit5d41d2c53c7dfa60f6fb0289225cfb3cebf53b9b
treeb70cc491ee0296640c2e91752f786808029b089d
parentfbaa14ed8d5c576db36f9f2e212b7ca7a0628868
fix(ulibc): add null-pointer guards in __libc_init_array/fini_array

In a PIC shared library build, linker-generated symbols like
__init_array_start, __fini_array_end, and _init may remain
SHN_UNDEF (value 0) when the library has no .init_array/.fini_array
sections. The GOT entries for these resolve to 0.

Added null-pointer checks using volatile pointers (to prevent the
compiler from assuming the address is always non-null) for all
init/fini array pointers and for _init/_fini function pointers.
This prevents crashes when these symbols are unresolved.
user/ulibc/src/init_fini.c