Rollup merge of #76167 - mati865:mingw-self-contained-heuristic, r=petrochenkov
Rollup merge of #76167 - mati865:mingw-self-contained-heuristic, r=petrochenkov

Replace MinGW library hack with heuristic controlling link mode

Depends on https://github.com/rust-lang/rust/pull/76158
Closes https://github.com/rust-lang/rust/issues/68887

aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust