rustc --test -l static=somelib.a links with --whole-archive (original) (raw)

Originally reported as #116900, but the actual bug affects every libraries and platforms.

rustc --test -l static:+verbatim=libsomelib.a generates the linker command -Wl,--whole-archive -l:libsomelib.a -Wl,--no-whole-archive. Without --test it correctly doesn't link whole archive.

It is expected to link whole archive only if passing +whole-archive modifier.