The real issue is that Meson's implementation of link_whole for
library-in-library makes sense for one use case (convenience library that is
linked into another convenience library) but not for another (grouping code
for subsystems). I cannot blame them for this because link_with is a more
common case for the latter; OTOH QEMU is using link_whole a lot in order to
support the *_init() construct.
I really think the correct fix is for Meson to use objects instead of
archives for link_whole, similar to how QEMU Makefiles used to do it. This
would also remove the need for the special .fa suffix, so it would be an
improvement all around.
Does it mean that we need a kind of object target in meson? Do you think
if this interface would work?
crypto_objs = object_library(..., dependencies: public_deps + [aninternaldep])
crypto = declare_dependency(link_with: crypto_objs, dependencies: public_deps)