splitting libc -> libc + libsys and static linking

Dimitry Andric dim at FreeBSD.org
Tue Apr 3 20:39:47 UTC 2018


On 3 Apr 2018, at 22:32, Brooks Davis <brooks at one-eyed-alien.net> wrote:
> 
> We (mostly Ali) are working on a patch to to split the actual syscalls
> (__sys_<foo>) out of libc and into a libsys.  For dynamic linking,
> this is fairly straightforward (link libc against libsys, maybe as a
> filter).  For static linking, I'm looking for feedback on the right
> approach.  Do we link libsys.a into libc.a?  Do we try to teach all the
> compilers to add -lsys?  I'm pretty sure we don't modify all the ports
> that statically link programs.  Is there some easy approach I'm missing?

The approach chosen for e.g. libc++ (and before that, libstdc++), was to
put all needed objects from the dependent libs in the same .a file.

See:
https://svnweb.freebsd.org/base/head/lib/libc%2B%2B/Makefile?revision=321369&view=markup#l61

and:
https://svnweb.freebsd.org/base/head/gnu/lib/libstdc%2B%2B/Makefile?revision=315175&view=markup#l57

For dynamic linking, you could use your approach of putting libsys in
the NEEDED section, or add it to the libc.so linker script, like what is
done for libc++.so.

-Dimitry

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 223 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.freebsd.org/pipermail/freebsd-toolchain/attachments/20180403/50434ff7/attachment.sig>


More information about the freebsd-toolchain mailing list