Skip to content

Commit 5b4873a

Browse files
committed
Run the #85441 regression test on MSVC only
On MinGW toolchains the various features (such as function sections) necessary to eliminate dead function references are disabled due to various bugs. This means that the windows sockets library will most likely remain linked to any mingw toolchain built program that also utilizes libstd. That said, I made an attempt to also enable `function-sections` and `--gc-sections` during my experiments, but the symbol references remained, sadly.
1 parent b7d2b46 commit 5b4873a

File tree

2 files changed

+4
-4
lines changed
  • library/std/src/sys/windows
  • src/test/run-make/issue-85441

2 files changed

+4
-4
lines changed

library/std/src/sys/windows/net.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ pub mod netc {
2929

3030
pub struct Socket(OwnedSocket);
3131

32-
static WSA: SyncOnceCell<unsafe extern "system" fn() -> i32> = SyncOnceCell::new();
32+
static WSA_CLEANUP: SyncOnceCell<unsafe extern "system" fn() -> i32> = SyncOnceCell::new();
3333

3434
/// Checks whether the Windows socket interface has been started already, and
3535
/// if not, starts it.
3636
pub fn init() {
37-
let _ = WSA.get_or_init(|| unsafe {
37+
let _ = WSA_CLEANUP.get_or_init(|| unsafe {
3838
let mut data: c::WSADATA = mem::zeroed();
3939
let ret = c::WSAStartup(
4040
0x202, // version 2.2
@@ -51,7 +51,7 @@ pub fn init() {
5151

5252
pub fn cleanup() {
5353
// only perform cleanup if network functionality was actually initialized
54-
if let Some(cleanup) = WSA.get() {
54+
if let Some(cleanup) = WSA_CLEANUP.get() {
5555
unsafe {
5656
cleanup();
5757
}

src/test/run-make/issue-85441/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# only-windows
1+
# only-windows-msvc
22

33
-include ../../run-make-fulldeps/tools.mk
44

0 commit comments

Comments
 (0)