Skip to content
Open
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
14 changes: 0 additions & 14 deletions src/native/external/libunwind/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,6 @@ if ("${CMAKE_GENERATOR}" MATCHES "^Visual Studio.*$")
set(HAVE_ELF_H 1)
set(HAVE_ENDIAN_H 1)

# MSVC compiler is currently missing C11 stdalign.h header
# Fake it until support is added
check_include_files(stdalign.h HAVE_STDALIGN_H)
if (NOT HAVE_STDALIGN_H)
configure_file(include/remote/win/fakestdalign.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/stdalign.h)
endif (NOT HAVE_STDALIGN_H)

# MSVC compiler is currently missing C11 stdatomic.h header
# Fake it until support is added
check_include_files(stdatomic.h HAVE_STDATOMIC_H)
if (NOT HAVE_STDATOMIC_H)
configure_file(include/remote/win/fakestdatomic.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/stdatomic.h)
endif (NOT HAVE_STDATOMIC_H)

# MSVC compiler is currently missing C11 _Thread_local
check_c_source_compiles("void main() { _Thread_local int a; }" HAVE_THREAD_LOCAL)
if (NOT HAVE_THREAD_LOCAL)
Expand Down

This file was deleted.

This file was deleted.

12 changes: 12 additions & 0 deletions src/native/external/libunwind_extras/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,18 @@ if(CLR_CMAKE_HOST_WIN32)
# Assume we are using default MSVC compiler
add_compile_options(/permissive-)

# Enable C11 atomics so libunwind's <stdatomic.h> usage
# (e.g. atomic_compare_exchange_strong in Gaddress_validator.c) compiles
# against MSVC's real header instead of a generated fake.
# /std:c11 is already implied by CMAKE_C_STANDARD=11 set in libunwind/CMakeLists.txt.
# CMAKE_C_COMPILER_ID is used instead of MSVC so that clang-cl (which sets

@jkotas jkotas Jun 10, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We do not support clang-cl and I expect we would need number of changes to actually support it. This can be simplified to just use /experimental:c11atomics unconditionally.

# MSVC=TRUE but does not accept /experimental:c11atomics) is excluded.
# The COMPILE_LANGUAGE:C generator expression scopes the flag to C sources
# so it is not passed to C++ compilation (e.g. remote-unwind.cpp).
if(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
add_compile_options($<$<COMPILE_LANGUAGE:C>:/experimental:c11atomics>)
endif()

# include paths
include_directories(${CLR_SRC_NATIVE_DIR}/external/libunwind/include/tdep)
include_directories(${CLR_SRC_NATIVE_DIR}/external/libunwind/include)
Expand Down
13 changes: 0 additions & 13 deletions src/native/external/libunwind_extras/configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,6 @@ if(CLR_CMAKE_HOST_WIN32)
set(HAVE_ELF_H 1)
set(HAVE_ENDIAN_H 1)

# MSVC compiler is currently missing C11 stdalign.h header
# Fake it until support is added
check_include_files(stdalign.h HAVE_STDALIGN_H)
if (NOT HAVE_STDALIGN_H)
configure_file(${CLR_SRC_NATIVE_DIR}/external/libunwind/include/remote/win/fakestdalign.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/stdalign.h COPYONLY)
endif (NOT HAVE_STDALIGN_H)

# MSVC compiler is currently missing C11 stdatomic.h header
check_c_source_compiles("#include <stdatomic.h> void main() { _Atomic int a; }" HAVE_STDATOMIC_H)
if (NOT HAVE_STDATOMIC_H)
configure_file(${CLR_SRC_NATIVE_DIR}/external/libunwind/include/remote/win/fakestdatomic.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/stdatomic.h COPYONLY)
endif (NOT HAVE_STDATOMIC_H)

# MSVC compiler is currently missing C11 _Thread_local
check_c_source_compiles("void main() { _Thread_local int a; }" HAVE_THREAD_LOCAL)
if (NOT HAVE_THREAD_LOCAL)
Expand Down
Loading