Windows ARM64EC Target Fails - _tzcnt_u64(EC Symbol) #489

Closed
opened 2026-01-29 20:44:45 +00:00 by claunia · 5 comments
Owner

Originally created by @danoli3 on GitHub (Dec 28, 2023).

Error LNK2001 unresolved external symbol _tzcnt_u64 (EC Symbol)

Target: ARM64EC
MSVC
Windows

Error LNK2001	unresolved external symbol _tzcnt_u64 (EC Symbol)	
brotlienc.lib(compress_fragment_two_pass.obj)	1	
brotlienc.lib(compress_fragment.obj)	1		
brotlienc.lib(static_dict.obj)	1		
brotlienc.lib(encode.obj)	1		
backward_references.obj)	1		
brotlienc.lib(backward_references_hq.obj)	1		

No direct calls to _tzcnt_u64 are found in code base so its a dependency function calling it

Extra notes: ARM64 target works

Issue patched in other libraries:
bee421b93d%5E%21/

Disable _tzcnt_u64 for ARM64EC

The ARM64EC is a new Microsoft-designed ARM64 ABI that is compatible with AMD64 code. However, not all AMD64 intrinsic functions are supported. For, intrinsics that are lowered to AVX, AVX2 and AVX512 instructions are not supported, including the _tzcnt_u64. To make sure this file compiles for ARM64EC, the use of _tzcnt_u64 should be neutered.

Cmake flags:

      cmake .. \
           -DCMAKE_C_STANDARD=17 \
          -DCMAKE_CXX_STANDARD=17 \
          -DCMAKE_CXX_STANDARD_REQUIRED=ON \
          -DCMAKE_CXX_EXTENSIONS=OFF \
          -DBUILD_SHARED_LIBS=OFF \
          -DBUILD_TESTING=OFF
          -A "ARM64EC" \
          -G "Visual Studio 2022 17" \
          -DCMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION=10.0.22621.0 \
          -DCMAKE_SYSTEM_VERSION=10.0.22621.0 
      cmake --build . --config Release
Originally created by @danoli3 on GitHub (Dec 28, 2023). Error LNK2001 unresolved external symbol _tzcnt_u64 (EC Symbol) Target: ARM64EC MSVC Windows ``` Error LNK2001 unresolved external symbol _tzcnt_u64 (EC Symbol) brotlienc.lib(compress_fragment_two_pass.obj) 1 brotlienc.lib(compress_fragment.obj) 1 brotlienc.lib(static_dict.obj) 1 brotlienc.lib(encode.obj) 1 backward_references.obj) 1 brotlienc.lib(backward_references_hq.obj) 1 ``` No direct calls to _tzcnt_u64 are found in code base so its a dependency function calling it Extra notes: ARM64 target works Issue patched in other libraries: https://fuchsia.googlesource.com/third_party/lz4/+/bee421b93d79c613ecb67c13687d9a7127698609%5E%21/ > Disable _tzcnt_u64 for ARM64EC > The ARM64EC is a new Microsoft-designed ARM64 ABI that is compatible with AMD64 code. However, not all AMD64 intrinsic functions are supported. For, intrinsics that are lowered to AVX, AVX2 and AVX512 instructions are not supported, including the _tzcnt_u64. To make sure this file compiles for ARM64EC, the use of _tzcnt_u64 should be neutered. Cmake flags: ``` cmake .. \ -DCMAKE_C_STANDARD=17 \ -DCMAKE_CXX_STANDARD=17 \ -DCMAKE_CXX_STANDARD_REQUIRED=ON \ -DCMAKE_CXX_EXTENSIONS=OFF \ -DBUILD_SHARED_LIBS=OFF \ -DBUILD_TESTING=OFF -A "ARM64EC" \ -G "Visual Studio 2022 17" \ -DCMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION=10.0.22621.0 \ -DCMAKE_SYSTEM_VERSION=10.0.22621.0 cmake --build . --config Release ```
Author
Owner

@danoli3 commented on GitHub (Dec 28, 2023):

I tried a dependency walk and tried to figure out what is calling the _tzcnt_u64 with no success so far.

Any ideas ?

@danoli3 commented on GitHub (Dec 28, 2023): I tried a dependency walk and tried to figure out what is calling the _tzcnt_u64 with no success so far. Any ideas ?
Author
Owner

@eustas commented on GitHub (Dec 29, 2023):

It is used by FindMatchLengthWithLimit. Going to fix soon.

@eustas commented on GitHub (Dec 29, 2023): It is used by `FindMatchLengthWithLimit`. Going to fix soon.
Author
Owner

@eustas commented on GitHub (Jan 3, 2024):

Should be fixed with #1109. Could you check please? (unfortunately, currently could not integrate ARM64EC build on GH actions).

@eustas commented on GitHub (Jan 3, 2024): Should be fixed with #1109. Could you check please? (unfortunately, currently could not integrate ARM64EC build on GH actions).
Author
Owner

@danoli3 commented on GitHub (Jan 6, 2024):

Fixed thank you!

@danoli3 commented on GitHub (Jan 6, 2024): Fixed thank you!
Author
Owner

@danoli3 commented on GitHub (Feb 26, 2025):

can we get another release out for Brotli @eustas these fixes were gold

@danoli3 commented on GitHub (Feb 26, 2025): can we get another release out for Brotli @eustas these fixes were gold
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/brotli#489