Page MenuHomeFreeBSD

lib{c,sys}: fully stub libc verisons of symbols
AcceptedPublic

Authored by brooks on Feb 27 2024, 6:11 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 7, 10:49 PM
Unknown Object (File)
Thu, Nov 7, 7:49 PM
Unknown Object (File)
Tue, Oct 22, 8:32 AM
Unknown Object (File)
Tue, Oct 22, 8:32 AM
Unknown Object (File)
Tue, Oct 22, 8:20 AM
Unknown Object (File)
Oct 5 2024, 3:26 AM
Unknown Object (File)
Sep 16 2024, 1:30 AM
Unknown Object (File)
Sep 15 2024, 9:28 PM

Details

Reviewers
kib
andrew
Summary

When a symbol is to be provided by libsys, create a traping stub in the
dynamic libc rather than linking in a copy of the implementation. This
reduces the size of the dynamic libc and ensures that we're using the
right verison or failing outright should there be further issues with
linkage or the runtime linker.

This change is complicated by the need to for static libc to contain all
the libsys symbols. bsd.lib.mk does provide support for this indirectly
as the SOBJS (shared objects), STATICOBJS (static objects), and
NOSSPSOBJS (position-independent, non-stack-protected, for rtld's use)
variables allow a disjoint set of inputs to be specified for shared and
static libraries, but it's a little awkward.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 56290
Build 53178: arc lint + arc unit

Event Timeline

This whole stack is fixups and cleanups found while making this change to generate the libc.so.7 stubs from the symbols files.

I'm a little hesitant to commit this last change until we're very certain we have the right set of symbols in libsys. Once we do it, we have to be much more cautious about removing symbols from libsys since if something needs them during installworld things will go badly.

kib added inline comments.
lib/libsys/Makefile.sys
165

This is lie, of course. But I cannot think about any better way doing it except reverting back to asm and providing some TRAP_INSTR per-arch definition.

BTW, additional advantage of falling to asm is that it could be the same trap instruction for all symbols.

This revision is now accepted and ready to land.Feb 28 2024, 1:22 AM