Page MenuHomeFreeBSD

linker: Recognize SHT_INIT_ARRAY sections as constructor sections
ClosedPublic

Authored by markj on Jul 14 2026, 11:09 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Oct 12, 3:20 AM
Unknown Object (File)
Tue, Oct 6, 5:30 AM
Unknown Object (File)
Fri, Oct 2, 7:34 PM
Unknown Object (File)
Mon, Sep 28, 4:29 AM
Unknown Object (File)
Sat, Sep 26, 10:39 PM
Unknown Object (File)
Thu, Sep 24, 6:41 PM
Unknown Object (File)
Thu, Sep 24, 11:11 AM
Unknown Object (File)
Tue, Sep 22, 6:37 AM
Subscribers

Details

Summary

We do this already for ET_REL files, but it was missed here. Note that
this function operates only on dynamically loaded files, not on
preloaded files.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kib added inline comments.
sys/kern/link_elf.c
1311

In theory there could be both init and initarray

This revision is now accepted and ready to land.Jul 15 2026, 1:35 PM
sys/kern/link_elf.c
1311

My motivation is really just to handle a specific case where .init_array is added by KASAN. We are not executing constructors for the kernel since for some reason we rely on the loader to pass them down in module metadata.