diff --git a/src/coreclr/tests/issues.targets b/src/coreclr/tests/issues.targets
index ac5addebf4b3ba..af2dda53dc299c 100644
--- a/src/coreclr/tests/issues.targets
+++ b/src/coreclr/tests/issues.targets
@@ -923,9 +923,6 @@
https://github.com/dotnet/runtime/issues/7597
-
- Not compatible with crossgen2
-
https://github.com/dotnet/runtime/issues/32732
diff --git a/src/coreclr/tests/src/CLRTest.CrossGen.targets b/src/coreclr/tests/src/CLRTest.CrossGen.targets
index a1104376140342..682dcf7dcf0f62 100644
--- a/src/coreclr/tests/src/CLRTest.CrossGen.targets
+++ b/src/coreclr/tests/src/CLRTest.CrossGen.targets
@@ -72,6 +72,8 @@ if [ ! -z ${RunCrossGen2+x} ]%3B then
fi
fi
+ ExtraCrossGen2Args+=" $(CrossGen2TestExtraArguments)"
+
if [ ! -z ${LargeVersionBubble+x} ]%3B then
ExtraCrossGen2Args+=" --inputbubble"
fi
@@ -174,6 +176,8 @@ if defined RunCrossGen (
)
REM CrossGen2 Script
if defined RunCrossGen2 (
+ set ExtraCrossGen2Args=!ExtraCrossGen2Args! $(CrossGen2TestExtraArguments)
+
if defined LargeVersionBubble ( set ExtraCrossGen2Args=!ExtraCrossGen2Args! --inputbubble)
call :TakeLock
set CrossGen2Status=0
diff --git a/src/tests/JIT/opt/ObjectStackAllocation/ObjectStackAllocationTests.cs b/src/tests/JIT/opt/ObjectStackAllocation/ObjectStackAllocationTests.cs
index 1c068630cc4776..639c44a333cb81 100644
--- a/src/tests/JIT/opt/ObjectStackAllocation/ObjectStackAllocationTests.cs
+++ b/src/tests/JIT/opt/ObjectStackAllocation/ObjectStackAllocationTests.cs
@@ -110,7 +110,7 @@ public static int Main()
Console.WriteLine("GCStress is enabled");
expectedAllocationKind = AllocationKind.Undefined;
}
- else if (!SPCOptimizationsEnabled()) {
+ else if (!SPCOptimizationsEnabled() && !Crossgen2Test()) {
Console.WriteLine("System.Private.CoreLib.dll optimizations are disabled");
expectedAllocationKind = AllocationKind.Heap;
}
@@ -181,6 +181,12 @@ static bool GCStressEnabled()
return Environment.GetEnvironmentVariable("COMPlus_GCStress") != null;
}
+ static bool Crossgen2Test()
+ {
+ // CrossGen2 doesn't respect the debuggable attribute
+ return Environment.GetEnvironmentVariable("RunCrossGen2") != null;
+ }
+
static void CallTestAndVerifyAllocation(Test test, int expectedResult, AllocationKind expectedAllocationsKind)
{
long allocatedBytesBefore = GC.GetAllocatedBytesForCurrentThread();
diff --git a/src/tests/JIT/opt/ObjectStackAllocation/ObjectStackAllocationTests.csproj b/src/tests/JIT/opt/ObjectStackAllocation/ObjectStackAllocationTests.csproj
index 655a42cc4fbd21..bfd9e534b56156 100644
--- a/src/tests/JIT/opt/ObjectStackAllocation/ObjectStackAllocationTests.csproj
+++ b/src/tests/JIT/opt/ObjectStackAllocation/ObjectStackAllocationTests.csproj
@@ -10,6 +10,7 @@
+ --codegenopt JitObjectStackAllocation=1