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)
Sun, May 12, 5:07 PM
Unknown Object (File)
Sun, May 12, 12:07 PM
Unknown Object (File)
Mon, May 6, 4:02 AM
Unknown Object (File)
Sun, May 5, 9:45 AM
Unknown Object (File)
Fri, May 3, 1:15 PM
Unknown Object (File)
Thu, May 2, 1:47 AM
Unknown Object (File)
Wed, May 1, 4:59 PM
Unknown Object (File)
Sat, Apr 27, 6:19 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