Skip to content

Commit 2a74721

Browse files
authored
[Mono] Fix Mono Windows x86 build and runtime crash. (#74639)
Fix Mono Windows x86 build and runtime crash. Trying to validate a fix on x86 Windows Mono crashed runtime with stack overflow. After some investigation it turns out that Mono Windows x86 have SIMD disabled, but S.P.C was still build with System.Runtime.Intrinsics support and implementation of methods like get_IsSupported is implemented as follow: .method public hidebysig specialname static bool get_IsSupported() cil managed { // Code size 6 (0x6) .maxstack 8 IL_0000: call bool System.Runtime.Intrinsics.X86.Popcnt::get_IsSupported() IL_0005: ret } // end of method Popcnt::get_IsSupported causing a stack overflow when called at runtime. Fix make sure we won't add support for System.Runtime.Intrinsics in S.P.C for Mono Windows x86 builds. There was also a warning in debugger-agent.c when building debug that caused build to fail, including fix for that as well.
1 parent 1b4ed22 commit 2a74721

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<SupportsArmIntrinsics Condition="'$(Platform)' == 'arm64'">true</SupportsArmIntrinsics>
1717
<SupportsWasmIntrinsics Condition="'$(Platform)' == 'wasm'">true</SupportsWasmIntrinsics>
1818
<SupportsX86Intrinsics Condition="'$(Platform)' == 'x64' or ('$(Platform)' == 'x86' and '$(TargetsUnix)' != 'true')">true</SupportsX86Intrinsics>
19+
<SupportsX86Intrinsics Condition="'$(Platform)' == 'x86' and '$(TargetsWindows)' == 'true' and '$(FeatureMono)' == 'true'">false</SupportsX86Intrinsics>
1920
<ILLinkSharedDirectory>$(MSBuildThisFileDirectory)ILLink\</ILLinkSharedDirectory>
2021
<IsBigEndian Condition="'$(Platform)' == 's390x'">true</IsBigEndian>
2122
<Is64Bit Condition="'$(Platform)' == 'arm64' or '$(Platform)' == 'x64' or '$(Platform)' == 's390x' or '$(Platform)' == 'loongarch64' or '$(Platform)' == 'ppc64le'">true</Is64Bit>

src/mono/mono/component/debugger-agent.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1039,7 +1039,7 @@ socket_transport_connect (const char *address)
10391039
MonoAddressEntry *rp;
10401040
SOCKET sfd = INVALID_SOCKET;
10411041
int s = 0, res;
1042-
char *host;
1042+
char *host = NULL;
10431043
int port;
10441044

10451045
MONO_REQ_GC_SAFE_MODE;

0 commit comments

Comments
 (0)