Skip to content

Fix linux-x86 build #111861

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions eng/pipelines/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ extends:
eq(variables['isRollingBuild'], true))

#
# Build CoreCLR with no R2R
# Build CoreCLR and run crossgen on S.P.CoreLib
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
Expand All @@ -448,8 +448,8 @@ extends:
- linux_x86
jobParameters:
testScope: innerloop
nameSuffix: CoreCLR_NoR2R
buildArgs: -s clr.runtime+clr.jit+clr.iltools+clr.spmi+clr.corelib -c $(_BuildConfig)
nameSuffix: CoreCLR
buildArgs: -s clr.runtime+clr.jit+clr.iltools+clr.spmi+clr.corelib+clr.nativecorelib -c $(_BuildConfig)
timeoutInMinutes: 120
condition: >-
or(
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function(create_standalone_jit)
target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE FEATURE_NO_HOST)
target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE SELF_NO_HOST)

if ((TARGETDETAILS_ARCH STREQUAL "x64") OR (TARGETDETAILS_ARCH STREQUAL "arm64") OR ((TARGETDETAILS_ARCH STREQUAL "x86") AND NOT (TARGETDETAILS_OS STREQUAL "unix")))
if ((TARGETDETAILS_ARCH STREQUAL "x64") OR (TARGETDETAILS_ARCH STREQUAL "arm64") OR (TARGETDETAILS_ARCH STREQUAL "x86"))
target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE FEATURE_SIMD)
target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE FEATURE_HW_INTRINSICS)
target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE FEATURE_MASKED_HW_INTRINSICS)
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -9756,7 +9756,7 @@ class Compiler
//
bool isSIMDTypeLocalAligned(unsigned varNum)
{
#if defined(FEATURE_SIMD) && ALIGN_SIMD_TYPES
#if defined(FEATURE_SIMD) && ALIGN_SIMD_TYPES && !defined(UNIX_X86_ABI)
LclVarDsc* lcl = lvaGetDesc(varNum);
if (varTypeIsSIMD(lcl))
{
Expand Down
4 changes: 3 additions & 1 deletion src/coreclr/vm/i386/jithelp.S
Original file line number Diff line number Diff line change
Expand Up @@ -657,13 +657,15 @@ LEAF_END JIT_WriteBarrierReg_PostGrow,_TEXT
// PatchedCodeStart and PatchedCodeEnd are used to determine bounds of patched code.
//

.align 4
LEAF_ENTRY JIT_PatchedCodeStart, _TEXT
ret
LEAF_END JIT_PatchedCodeStart, _TEXT

// **********************************************************************
// Write barriers generated at runtime

.align 4
LEAF_ENTRY JIT_PatchedWriteBarrierGroup, _TEXT
ret
LEAF_END JIT_PatchedWriteBarrierGroup, _TEXT
Expand All @@ -672,7 +674,7 @@ LEAF_END JIT_PatchedWriteBarrierGroup, _TEXT
.align 8
LEAF_ENTRY JIT_WriteBarrier\rg, _TEXT
// Just allocate space that will be filled in at runtime
.space 0xCC, 48
.space 48, 0xCC
LEAF_END JIT_WriteBarrier\rg, _TEXT

.endm
Expand Down
12 changes: 8 additions & 4 deletions src/coreclr/vm/i386/stublinkerx86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1131,10 +1131,11 @@ VOID StubLinkerCPU::X86EmitPushRegs(unsigned regSet)
{
STANDARD_VM_CONTRACT;

for (X86Reg r = kEAX; r <= NumX86Regs; r = (X86Reg)(r+1))
for (X86Reg r = kEAX; regSet > 0; r = (X86Reg)(r+1))
if (regSet & (1U<<r))
{
X86EmitPushReg(r);
regSet &= ~(1U<<r);
}
}

Expand All @@ -1143,9 +1144,12 @@ VOID StubLinkerCPU::X86EmitPopRegs(unsigned regSet)
{
STANDARD_VM_CONTRACT;

for (X86Reg r = NumX86Regs; r >= kEAX; r = (X86Reg)(r-1))
for (X86Reg r = NumX86Regs; regSet > 0; r = (X86Reg)(r-1))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would always underflow, X86Reg is unsigned and kEAX is 0.

if (regSet & (1U<<r))
{
X86EmitPopReg(r);
regSet &= ~(1U<<r);
}
}
#endif // TARGET_X86

Expand Down Expand Up @@ -2157,7 +2161,7 @@ VOID StubLinkerCPU::X86EmitCurrentThreadFetch(X86Reg dstreg, unsigned preservedR
X86EmitPushRegs(preservedRegSet & ((1 << kEAX) | (1 << kEDX) | (1 << kECX)));

// call GetThread
X86EmitCall(NewExternalCodeLabel((LPVOID)GetThreadHelper), sizeof(void*));
X86EmitCall(NewExternalCodeLabel((LPVOID)GetThreadHelper), 0);

// mov dstreg, eax
X86EmitMovRegReg(dstreg, kEAX);
Expand Down Expand Up @@ -2219,7 +2223,7 @@ VOID StubLinkerCPU::X86EmitCurrentThreadAllocContextFetch(X86Reg dstreg, unsigne
X86EmitPushRegs(preservedRegSet & ((1 << kEAX) | (1 << kEDX) | (1 << kECX)));

// call GetThread
X86EmitCall(NewExternalCodeLabel((LPVOID)GetAllocContextHelper), sizeof(void*));
X86EmitCall(NewExternalCodeLabel((LPVOID)GetAllocContextHelper), 0);

// mov dstreg, eax
X86EmitMovRegReg(dstreg, kEAX);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<IsMobileLike Condition="'$(TargetsBrowser)' == 'true' or '$(TargetsWasi)' == 'true' or '$(IsiOSLike)' == 'true' or '$(TargetsAndroid)' == 'true'">true</IsMobileLike>
<SupportsArmIntrinsics Condition="'$(Platform)' == 'arm64'">true</SupportsArmIntrinsics>
<SupportsWasmIntrinsics Condition="'$(Platform)' == 'wasm'">true</SupportsWasmIntrinsics>
<SupportsX86Intrinsics Condition="'$(Platform)' == 'x64' or ('$(Platform)' == 'x86' and '$(TargetsUnix)' != 'true')">true</SupportsX86Intrinsics>
<SupportsX86Intrinsics Condition="'$(Platform)' == 'x86' and '$(TargetsWindows)' == 'true' and '$(FeatureMono)' == 'true'">false</SupportsX86Intrinsics>
<SupportsX86Intrinsics Condition="'$(Platform)' == 'x64' or '$(Platform)' == 'x86'">true</SupportsX86Intrinsics>
<SupportsX86Intrinsics Condition="'$(Platform)' == 'x86' and '$(FeatureMono)' == 'true'">false</SupportsX86Intrinsics>
<NotSupportedOnMono Condition="'$(FeatureMono)' == 'true'">.PlatformNotSupported</NotSupportedOnMono>
<ILLinkSharedDirectory>$(MSBuildThisFileDirectory)ILLink\</ILLinkSharedDirectory>
<IsBigEndian Condition="'$(Platform)' == 's390x'">true</IsBigEndian>
Expand Down
6 changes: 6 additions & 0 deletions src/native/minipal/cpufeatures.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@

static uint32_t xmmYmmStateSupport()
{
#if defined(HOST_X86)
// We don't support saving XState context on linux-x86 platforms yet, so we
// need to disable any AVX support that uses the extended registers.
return 0;
#else
uint32_t eax;
__asm(" xgetbv\n" \
: "=a"(eax) /*output in eax*/\
Expand All @@ -66,6 +71,7 @@ static uint32_t xmmYmmStateSupport()
);
// check OS has enabled both XMM and YMM state support
return ((eax & 0x06) == 0x06) ? 1 : 0;
#endif // HOST_X86
}

#ifndef XSTATE_MASK_AVX512
Expand Down
Loading