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
F172940237: D58245.diff
Tue, Sep 22, 6:37 AM
Unknown Object (File)
Tue, Sep 15, 5:43 AM
Unknown Object (File)
Sun, Sep 13, 5:41 PM
Unknown Object (File)
Sat, Sep 12, 9:17 AM
Unknown Object (File)
Sat, Sep 12, 7:09 AM
Unknown Object (File)
Fri, Sep 11, 7:25 AM
Unknown Object (File)
Thu, Sep 10, 7:17 PM
Unknown Object (File)
Thu, Sep 10, 3:56 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.