diff --git a/Directory.Build.props b/Directory.Build.props
index c6bae2a825b1b..b374f83f816ea 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -323,7 +323,7 @@
true
- ClrFullNativeBuild;ClrRuntimeSubset;ClrJitSubset;ClrPalTestsSubset;ClrAllJitsSubset;ClrILToolsSubset;ClrNativeAotSubset;ClrSpmiSubset;ClrCrossComponentsSubset;ClrDebugSubset;HostArchitecture;PgoInstrument;NativeOptimizationDataSupported;CMakeArgs
+ ClrFullNativeBuild;ClrRuntimeSubset;ClrJitSubset;ClrPalTestsSubset;ClrAllJitsSubset;ClrILToolsSubset;ClrNativeAotSubset;ClrSpmiSubset;ClrCrossComponentsSubset;ClrDebugSubset;HostArchitecture;PgoInstrument;NativeOptimizationDataSupported;CMakeArgs;CxxStandardLibrary;CxxStandardLibraryStatic;CxxAbiLibrary
diff --git a/eng/Subsets.props b/eng/Subsets.props
index 0a51b12649d1e..41f63f11bbd79 100644
--- a/eng/Subsets.props
+++ b/eng/Subsets.props
@@ -127,6 +127,13 @@
true
+
+
+ CxxStandardLibrary=$(TargetCxxStandardLibrary)
+ $(TargetCxxLibraryProperties);CxxStandardLibraryStatic=$(TargetCxxStandardLibraryStatic)
+ $(TargetCxxLibraryProperties);CxxAbiLibrary=$(TargetCxxAbiLibrary)
+
+
@@ -265,7 +272,7 @@
@@ -455,7 +462,7 @@
-
+
diff --git a/eng/pipelines/common/global-build-job.yml b/eng/pipelines/common/global-build-job.yml
index 8273417557052..13da1c03fbaf4 100644
--- a/eng/pipelines/common/global-build-job.yml
+++ b/eng/pipelines/common/global-build-job.yml
@@ -99,10 +99,26 @@ jobs:
- name: crossArg
value: '-cross'
- - ${{ if ne(parameters.jobParameters.crossrootfsDir, '') }}:
- # This is only required for cross builds.
- - name: ROOTFS_DIR
- value: ${{ parameters.jobParameters.crossrootfsDir }}
+ - name: CxxStandardLibraryArg
+ value: ''
+ - ${{ if ne(parameters.cxxStandardLibrary, '') }}:
+ - name: CxxStandardLibraryArg
+ value: /p:TargetCxxStandardLibrary=${{ parameters.cxxStandardLibrary }}
+
+ - name: CxxStandardLibraryStaticArg
+ value: ''
+ - ${{ if ne(parameters.cxxStandardLibraryStatic, '') }}:
+ - name: CxxStandardLibraryStaticArg
+ value: /p:TargetCxxStandardLibraryStatic=${{ parameters.cxxStandardLibraryStatic }}
+
+ - name: CxxAbiLibraryArg
+ value: ''
+ - ${{ if ne(parameters.cxxAbiLibrary, '') }}:
+ - name: CxxAbiLibraryArg
+ value: /p:TargetCxxAbiLibrary=${{ parameters.cxxAbiLibrary }}
+
+ - name: TargetCxxLibraryConfigurationArgs
+ value: $(CxxStandardLibraryArg) $(CxxStandardLibraryStaticArg) $(CxxAbiLibraryArg)
- name: _officialBuildParameter
${{ if eq(parameters.isOfficialBuild, true) }}:
diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml
index 085ba914a18e2..49f9ba6e3f240 100644
--- a/eng/pipelines/common/platform-matrix.yml
+++ b/eng/pipelines/common/platform-matrix.yml
@@ -253,6 +253,28 @@ jobs:
crossBuild: true
${{ insert }}: ${{ parameters.jobParameters }}
+- ${{ if containsValue(parameters.platforms, 'linux_x64_sanitizer') }}:
+ - template: xplat-setup.yml
+ parameters:
+ jobTemplate: ${{ parameters.jobTemplate }}
+ helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }}
+ variables: ${{ parameters.variables }}
+ osGroup: linux
+ archType: x64
+ targetRid: linux-x64
+ platform: linux_x64
+ shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
+ container: linux_x64_sanitizer
+ jobParameters:
+ runtimeFlavor: ${{ parameters.runtimeFlavor }}
+ buildConfig: ${{ parameters.buildConfig }}
+ helixQueueGroup: ${{ parameters.helixQueueGroup }}
+ crossBuild: true
+ cxxStandardLibrary: libc++
+ cxxStandardLibraryStatic: true
+ cxxAbiLibrary: libstdc++
+ ${{ insert }}: ${{ parameters.jobParameters }}
+
# Linux x86
- ${{ if containsValue(parameters.platforms, 'linux_x86') }}:
diff --git a/eng/pipelines/common/templates/global-build-step.yml b/eng/pipelines/common/templates/global-build-step.yml
index b88207c516c19..2a2262d9a4ead 100644
--- a/eng/pipelines/common/templates/global-build-step.yml
+++ b/eng/pipelines/common/templates/global-build-step.yml
@@ -4,12 +4,13 @@ parameters:
shouldContinueOnError: false
archParameter: $(_archParameter)
crossArg: $(crossArg)
+ targetCxxLibraryConfigurationArgs: $(TargetCxxLibraryConfigurationArgs)
displayName: Build product
container: ''
condition: succeeded()
steps:
- - script: $(Build.SourcesDirectory)$(dir)build$(scriptExt) -ci ${{ parameters.archParameter }} $(_osParameter) ${{ parameters.crossArg }} ${{ parameters.buildArgs }} $(_officialBuildParameter) $(_buildDarwinFrameworksParameter) $(_overrideTestScriptWindowsCmdParameter)
+ - script: $(Build.SourcesDirectory)$(dir)build$(scriptExt) -ci ${{ parameters.archParameter }} $(_osParameter) ${{ parameters.crossArg }} ${{ parameters.buildArgs }} ${{ parameters.targetCxxLibraryConfigurationArgs }} $(_officialBuildParameter) $(_buildDarwinFrameworksParameter) $(_overrideTestScriptWindowsCmdParameter)
displayName: ${{ parameters.displayName }}
${{ if eq(parameters.useContinueOnErrorDuringBuild, true) }}:
continueOnError: ${{ parameters.shouldContinueOnError }}
diff --git a/eng/pipelines/common/templates/pipeline-with-resources.yml b/eng/pipelines/common/templates/pipeline-with-resources.yml
index e3182e42d21aa..bf668d6441fe6 100644
--- a/eng/pipelines/common/templates/pipeline-with-resources.yml
+++ b/eng/pipelines/common/templates/pipeline-with-resources.yml
@@ -70,6 +70,11 @@ extends:
linux_musl_x64_dev_innerloop:
image: mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.19-WithNode
+ linux_x64_sanitizer:
+ image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-cross-amd64-net9.0-sanitizer
+ env:
+ ROOTFS_DIR: /crossrootfs/x64
+
# We use a CentOS Stream 8 image here to test building from source on CentOS Stream 8.
SourceBuild_centos_x64:
image: mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream8
diff --git a/eng/pipelines/runtime-sanitized.yml b/eng/pipelines/runtime-sanitized.yml
index df461c03b7a70..329f9b9af9cde 100644
--- a/eng/pipelines/runtime-sanitized.yml
+++ b/eng/pipelines/runtime-sanitized.yml
@@ -28,7 +28,7 @@ extends:
buildConfig: Checked
runtimeFlavor: coreclr
platforms:
- - linux_x64
+ - linux_x64_sanitizer
- osx_x64
- windows_x64
variables:
@@ -63,7 +63,7 @@ extends:
buildConfig: Debug
runtimeFlavor: coreclr
platforms:
- - linux_x64
+ - linux_x64_sanitizer
- osx_x64
variables:
- name: _nativeSanitizersArg
@@ -123,7 +123,7 @@ extends:
helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml
buildConfig: release
platforms:
- - linux_x64
+ - linux_x64_sanitizer
- osx_x64
- windows_x64
variables:
diff --git a/src/coreclr/runtime.proj b/src/coreclr/runtime.proj
index 814d4dba29f70..109554ffe9a52 100644
--- a/src/coreclr/runtime.proj
+++ b/src/coreclr/runtime.proj
@@ -54,6 +54,18 @@
<_CoreClrBuildArg Include="-cmakeargs "-DCDAC_BUILD_TOOL_BINARY_PATH=$(RuntimeBinDir)cdac-build-tool\cdac-build-tool.dll"" />
+
+ <_CoreClrBuildArg Include="-cmakeargs -DCLR_CMAKE_CXX_STANDARD_LIBRARY=$(CxxStandardLibrary)" />
+
+
+
+ <_CoreClrBuildArg Include="-cmakeargs -DCLR_CMAKE_CXX_STANDARD_LIBRARY_STATIC=ON" />
+
+
+
+ <_CoreClrBuildArg Include="-cmakeargs -DCLR_CMAKE_CXX_ABI_LIBRARY=$(CxxAbiLibrary)" />
+
+
<_CoreClrBuildArg Condition="'$(ClrHostsSubset)' == 'true'" Include="-component hosts" />
<_CoreClrBuildArg Condition="'$(ClrRuntimeSubset)' == 'true'" Include="-component runtime" />
diff --git a/src/native/corehost/corehost.proj b/src/native/corehost/corehost.proj
index 026cff6928567..99a1bb9f5c5bb 100644
--- a/src/native/corehost/corehost.proj
+++ b/src/native/corehost/corehost.proj
@@ -78,6 +78,20 @@
<_CoreHostUnixTargetOS Condition="'$(TargetsLinuxBionic)' == 'true'">linux-bionic
$(Configuration) $(TargetArchitecture) -commithash "$([MSBuild]::ValueOrDefault('$(SourceRevisionId)', 'N/A'))" -os $(_CoreHostUnixTargetOS)
$(BuildArgs) -cmakeargs "-DVERSION_FILE_PATH=$(NativeVersionFile)"
+
+
+ $(BuildArgs) -cmakeargs -DCLR_CMAKE_CXX_STANDARD_LIBRARY=$(CxxStandardLibrary)
+
+
+
+ $(BuildArgs) -cmakeargs -DCLR_CMAKE_CXX_STANDARD_LIBRARY_STATIC=ON
+
+
+
+ $(BuildArgs) -cmakeargs -DCLR_CMAKE_CXX_ABI_LIBRARY=$(CxxAbiLibrary)
+
+
+
$(BuildArgs) -configureonly
$(BuildArgs) -portablebuild=false
$(BuildArgs) -keepnativesymbols