Skip to content
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
12 changes: 5 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,14 @@ add_compile_definitions(
_WIN32_WINNT=0x0A00 NTDDI_VERSION=NTDDI_WIN10_NI)

if(STL_USE_ANALYZE)
# TRANSITION OS-40109504: Windows SDK: incorrect SAL annotations on functions the STL uses
# warning C6553: The annotation for function 'LCMapStringEx' on _Param_(9)
# does not apply to a value type.
# There's a bug in the declaration for LCMapStringEx - it applies _In_opt_ to an LPARAM.
# LPARAM is a LONG_PTR (intptr_t), and it's invalid to apply _In_opt_ to a non-pointer.
# As of the Windows 11 SDK (10.0.22621.0), there are 5 total occurrences of warning C6553 affecting the STL's build.
# TRANSITION, Windows SDK 10.0.22621.0 emits
# "warning C6553: The annotation for function 'LCMapStringEx' on _Param_(9) does not apply to a value type."
# Reported as OS-40109504 "Windows SDK: incorrect SAL annotations on functions the STL uses".
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:/analyze:autolog-;/wd6553>")

if(VCLIBS_TARGET_ARCHITECTURE STREQUAL "arm64ec")
# TRANSITION, the Windows SDK emits "warning C28301: No annotations for first declaration of 'meow'"
# TRANSITION, Windows SDK 10.0.22621.0 emits
# "warning C28301: No annotations for first declaration of 'meow'"
# for various intrinsics when building for ARM64EC.
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:/wd28301>")
endif()
Expand Down
14 changes: 14 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,17 @@ stages:
targetArch: arm64
targetPlatform: arm64
testsBuildOnly: true

- stage: Build_And_Test_ARM64EC
dependsOn: Build_And_Test_x64
displayName: 'Build and Test ARM64EC'
pool:
name: ${{ variables.poolName }}
demands: ${{ variables.poolDemands }}
jobs:
- template: azure-devops/build-and-test.yml
parameters:
hostArch: x64
targetArch: arm64
targetPlatform: arm64ec
testsBuildOnly: true
4 changes: 2 additions & 2 deletions tests/std/tests/GH_001103_countl_zero_correctness/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ using namespace std;

int main() {
// This test is applicable only to x86 and x64 platforms
#if defined(_M_IX86) || defined(_M_X64)
#if (defined(_M_IX86) && !defined(_M_HYBRID_X86_ARM64)) || (defined(_M_X64) && !defined(_M_ARM64EC))
assert(_Countl_zero_bsr(static_cast<unsigned char>(0x00)) == 8);
assert(_Countl_zero_bsr(static_cast<unsigned char>(0x13)) == 3);
assert(_Countl_zero_bsr(static_cast<unsigned char>(0x83)) == 0);
Expand Down Expand Up @@ -67,5 +67,5 @@ int main() {
assert(_Countr_zero_bsf(static_cast<unsigned long long>(0x8000'0000'0000'0002)) == 1);
assert(_Countr_zero_bsf(static_cast<unsigned long long>(0x8000'0000'0000'0000)) == 63);
assert(_Countr_zero_bsf(static_cast<unsigned long long>(0xF000'0000'0000'0008)) == 3);
#endif // ^^^ defined(_M_IX86) || defined(_M_X64) ^^^
#endif // ^^^ (defined(_M_IX86) && !defined(_M_HYBRID_X86_ARM64)) || (defined(_M_X64) && !defined(_M_ARM64EC)) ^^^
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,15 @@
// Also test GH-2645: <yvals_core.h>: Conformance issue on [[msvc::known_semantics]]
#define msvc 1
#define known_semantics 2
#define intrinsic 3
#define lifetimebound 4
#define noop_dtor 5
#define empty_bases 6

#ifndef _M_ARM64EC // TRANSITION, Windows SDK 10.0.22621.0 uses '#pragma intrinsic(fabsf)' for ARM64EC.
// This use is no longer present in Windows SDK 10.0.26100.0.
#define intrinsic 3
#endif // ^^^ no workaround ^^^

#define lifetimebound 4
#define noop_dtor 5
#define empty_bases 6

#include <__msvc_all_public_headers.hpp>

Expand All @@ -47,9 +52,11 @@
#error bad macro expansion
#endif // known_semantics != 2

#ifndef _M_ARM64EC // TRANSITION, Windows SDK 10.0.22621.0
#if intrinsic != 3
#error bad macro expansion
#endif // intrinsic != 3
#endif // ^^^ no workaround ^^^

#if lifetimebound != 4
#error bad macro expansion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ def getBuildSteps(self, test, litConfig, shared):
if noisyProgress:
print('Creating library...')
cmd = ['lib.exe', '/nologo', f'/out:{libFilename}', *objFilenames]
if litConfig.target_arch.casefold() == 'arm64ec'.casefold():
cmd.append('/machine:arm64ec')
yield TestStep(cmd, shared.execDir, shared.env, False)

if compileTestCppWithEdg:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ ()
# For convenience, create a library file containing all of the object files that were produced.
my $libFilename = "stl_header_units.lib";
Run::ExecuteCommand(join(" ", "lib.exe", "/nologo", "/out:$libFilename", @objFilenames));
# TRANSITION, when we test ARM64EC internally, add "/machine:arm64ec" here to match custom_format.py.

Run::ExecuteCL(join(" ", "test.cpp", "/Fe$cwd.exe", @consumeBuiltHeaderUnits, $libFilename));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
// This EXCLUDES the <cmeow> headers in:
// [tab:headers.cpp.c]: "Table 22: C++ headers for C library facilities"

// TRANSITION, Windows SDK 10.0.22621.0 causes this test to fail for ARM64EC with:
// "error LNK2019: unresolved external symbol fabsf referenced in function #fabsf$exit_thunk (EC Symbol)"
// It passes when built with Windows SDK 10.0.26100.0.
// UNSUPPORTED: arm64ec

import <algorithm>;
import <any>;
import <array>;
Expand Down
5 changes: 5 additions & 0 deletions tests/std/tests/P2465R3_standard_library_modules/test.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
// Copyright (c) Microsoft Corporation.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

// TRANSITION, Windows SDK 10.0.22621.0 causes this test to fail for ARM64EC with:
// "error LNK2019: unresolved external symbol fabsf referenced in function #fabsf$exit_thunk (EC Symbol)"
// It passes when built with Windows SDK 10.0.26100.0.
// UNSUPPORTED: arm64ec

import std;

#include <assert.h> // intentionally not <cassert>
Expand Down
7 changes: 7 additions & 0 deletions tests/std/tests/VSO_1775715_user_defined_modules/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@

// Note: To properly test the fix for VSO-1775715, don't include any headers here.

// TRANSITION, Windows SDK 10.0.22621.0 causes this test to fail for ARM64EC with:
// "error LNK2019: unresolved external symbol fabsf referenced in function #fabsf$exit_thunk (EC Symbol)"
// Windows SDK 10.0.26100.0 will avoid that error, but we'll need to investigate why user.ixx emits:
// "error C2678: binary '==': no operator found which takes a left-hand operand of type 'const std::string'
// (or there is no acceptable conversion)"
Comment on lines +8 to +10
Copy link
Contributor Author

@cpplearner cpplearner May 21, 2025

Choose a reason for hiding this comment

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

This error C2678 turns out to be unaffected by architecture or Windows SDK version, and affected by the execution charset: error C2678 manifests if and only if the execution charset is not self-synchronizing (e.g. cp932, cp936). With cp1252 or UTF-8, the test compiles successfully.

No change requested for this PR,but we could maybe file a bug report against the compiler.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like something in some non-_Is_execution_charset_self_synchronizing() branch in <format> fails to compile.

// UNSUPPORTED: arm64ec

import User;

int main() {
Expand Down
3 changes: 3 additions & 0 deletions tests/utils/stl/test/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,7 @@ def getDefaultFeatures(config, litConfig):
elif litConfig.target_arch.casefold() == 'arm64'.casefold():
DEFAULT_FEATURES.append(Feature(name='arm64'))

elif litConfig.target_arch.casefold() == 'arm64ec'.casefold():
DEFAULT_FEATURES.append(Feature(name='arm64ec'))

return DEFAULT_FEATURES
14 changes: 13 additions & 1 deletion tests/utils/stl/test/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,11 @@ def _handleEnvlst(self, litConfig):
self.compileFlags.extend(self.envlstEntry.getEnvVal('PM_CL', '').split())
self.linkFlags.extend(self.envlstEntry.getEnvVal('PM_LINK', '').split())

targetArch = litConfig.target_arch.casefold()
if ('clang'.casefold() in os.path.basename(cxx).casefold()):
self._addCustomFeature('clang')
self._addCustomFeature('gcc-style-warnings')

targetArch = litConfig.target_arch.casefold()
if (targetArch == 'x64'.casefold()):
self.compileFlags.append('-m64')
elif (targetArch == 'x86'.casefold()):
Expand All @@ -245,6 +245,9 @@ def _handleEnvlst(self, litConfig):
return Result(UNSUPPORTED, 'clang targeting arm is not supported')
elif (targetArch == 'arm64'.casefold()):
self.compileFlags.append('--target=arm64-pc-windows-msvc')
elif (targetArch == 'arm64ec'.casefold()):
# TRANSITION, LLVM-116256 (fixed in Clang 20)
return Result(UNSUPPORTED, 'clang targeting arm64ec is not supported')
elif ('nvcc'.casefold() in os.path.basename(cxx).casefold()):
self._addCustomFeature('nvcc')

Expand All @@ -253,6 +256,15 @@ def _handleEnvlst(self, litConfig):
else:
self._addCustomFeature('cl-style-warnings')

if (targetArch == 'arm64ec'.casefold()):
self.compileFlags.append('/arm64EC')
self.linkFlags.append('/machine:arm64ec')

# TRANSITION, Windows SDK 10.0.22621.0 emits
# "warning C28301: No annotations for first declaration of 'meow'"
# for various intrinsics when building for ARM64EC.
self.compileFlags.append('/wd28301')

self.cxx = os.path.normpath(cxx)
return None

Expand Down