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, 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
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
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 Skipped
Unit
Tests Skipped
Build Status
Buildable 74817
Build 71700: arc lint + arc unit

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.