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)
Fri, Dec 6, 6:23 AM
Unknown Object (File)
Nov 20 2024, 10:31 AM
Unknown Object (File)
Nov 7 2024, 10:49 PM
Unknown Object (File)
Nov 7 2024, 7:49 PM
Unknown Object (File)
Oct 22 2024, 8:32 AM
Unknown Object (File)
Oct 22 2024, 8:32 AM
Unknown Object (File)
Oct 22 2024, 8:20 AM
Unknown Object (File)
Oct 5 2024, 3:26 AM

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