linker: Move native library search from linker to rustc by petrochenkov · Pull Request #138753 · rust-lang/rust (original) (raw)
For static libraries only, for now.
Linker's search by name is still used if rustc's search fails, because linker may search in additional platform-specific directories in addition to directories known to rustc.
So we are basically doing something like #123436 for all targets.
This way we provide best effort support for +verbatim modifier even on targets with linkers not supporting it natively.
This closes #132264 in particular.
If this is supported for dynamic libraries as well (which is nontrivial), this may also allow us to not pass -L options to the linker at all, although it may cause some breakage from libraries passed to linker directly, without rustc knowing about it.
TODO: Some more tests for +verbatim and library naming fallback on Windows, if they are missing.