PSA: Linkage of rlibs to dylibs tweaked on nightly

If you don't build Rust dynamic libraries, this shouldn't affect you!

The way that Rust rlibs are linked into dylibs has been tweaked slightly on the nightly compiler and as a result you may see linkage errors on nightly that weren't present before in your code. The PR in question is #26869, and the primary change was necessitated by the PR title but the linkage tweaks were essentially fixing #14344 and #25185.

The tl;dr; of this change is that rlibs are linked into dynamic libraries with --whole-archive, which ensure that the entirety of the archive (not just the used portions) are present in the dynamic library. This is fixing a longstanding bugs where parts of rlibs may be left out by accident, causing downstream linkage errors later on when linking to the dynamic library.

This change, however, may cause linker errors to start arising. If you have two rlibs which are linked statically against the same native library the linker will complain about duplicate symbols (as we're telling the linker to force inclusion of both copies). To fix this problem you need to make sure that native libraries only show up once in a compilation (e.g. only one rlib links to it).

A common way to ensure that this happens is to create a foo-sys crate which is dedicated to linking to the native library foo. That way any crate which wants to be sure to link to the native library foo will link to foo-sys instead, and the compiler will automatically make sure that the native library foo only shows up once.

If you have any issues feel free to ping me on IRC (acrichto) or open an issue!