And note that .init and .fini are legacy interfaces.
Details
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Good blog on these sections: https://maskray.me/blog/2021-11-07-init-ctors-init-array
You might want to mention that for dynamic binaries rtld selects which init model to use based on the presence of the FreeBSD note NOINIT.
mention that for dynamic binaries rtld selects which init model to use
We do describe NT_FREEBSD_NOINIT_TAG in here already. If we add more documentation should it be here or in rtld(1) with an explicit cross reference?
Old binaries: .init and .ctors, called by csu
New binaries with NT_FREEBSD_NOINIT_TAG: .init, .ctors, and .init_array, called by rtld
rtld(1) main subject is the rtld use, e.g. env vars affecting the runtime linker, defaults and other user-tweakable stuff. There we describe the binaries format, and IMO there is the right place to add a sentence to point to the NOINIT note.
OK, we already describe NT_FREEBSD_NOINIT_TAG in this man page (elf.5) so perhaps just a mention there?
.It Dv NT_FREEBSD_NOINIT_TAG Pq Value: 2 Indicates that the C startup does not call initialization routines, and thus .Xr rtld 1 must do so. .Va desc is ignored. +This note must be present for the .init_array and .fini_array sections to be +processed.
IMO it would be redundant. I suggested to mention the note near description of the section (really it should be dyn tags, but ok) to provide a cross-reference.
Otherwise whole man page needs to be memoized to make the right conclusion.
I didn't want to have to repeat the description of rtld/NOINIT_TAG twice for .fini_array and .init_array so just put a reference to the existing NOINIT_TAG description.
share/man/man5/elf.5 | ||
---|---|---|
970 | I would put the sentence last in the paragraph. |