Meson 0.52.0 changed how link_whole behaves and in doing so broke our usage of link_whole internally.
A quick glance over mesonbuild/backend/ninjabackend.py seems to confirm Christian's suspicion that link_with is what we want for internal use, and link_whole for the final binary.
You can see some more references to this and similar issues in the following jhbuild commit: jhbuild@dbe67904
Fixes: #1057 (closed)