From a3e1a7267943e8e5b6fe2262dc6ef73452f839c0 Mon Sep 17 00:00:00 2001 From: Filip Navara Date: Wed, 20 Nov 2024 21:59:52 +0100 Subject: [PATCH] WIP: Test sys/ucontext.h --- src/coreclr/nativeaot/CMakeLists.txt | 1 - src/coreclr/nativeaot/Runtime/unix/UnixContext.h | 2 +- src/coreclr/pal/src/configure.cmake | 2 +- src/coreclr/pal/src/include/pal/context.h | 4 +--- src/native/external/libunwind/include/libunwind-aarch64.h | 6 +++++- src/native/external/libunwind/include/libunwind-x86_64.h | 4 ++++ 6 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/coreclr/nativeaot/CMakeLists.txt b/src/coreclr/nativeaot/CMakeLists.txt index 74ee982ab98058..20deb87a60bb14 100644 --- a/src/coreclr/nativeaot/CMakeLists.txt +++ b/src/coreclr/nativeaot/CMakeLists.txt @@ -20,7 +20,6 @@ if(CLR_CMAKE_HOST_UNIX) add_compile_options(-nostdlib) if(CLR_CMAKE_TARGET_APPLE) - add_definitions(-D_XOPEN_SOURCE) add_definitions(-DFEATURE_OBJCMARSHAL) endif(CLR_CMAKE_TARGET_APPLE) diff --git a/src/coreclr/nativeaot/Runtime/unix/UnixContext.h b/src/coreclr/nativeaot/Runtime/unix/UnixContext.h index 662b697715da0a..fa54d1d76836fd 100644 --- a/src/coreclr/nativeaot/Runtime/unix/UnixContext.h +++ b/src/coreclr/nativeaot/Runtime/unix/UnixContext.h @@ -4,7 +4,7 @@ #ifndef __UNIX_CONTEXT_H__ #define __UNIX_CONTEXT_H__ -#include +#include // Convert Unix native context to PAL_LIMITED_CONTEXT void NativeContextToPalContext(const void* context, PAL_LIMITED_CONTEXT* palContext); diff --git a/src/coreclr/pal/src/configure.cmake b/src/coreclr/pal/src/configure.cmake index 79140466b97d59..1dfb14f2c4d845 100644 --- a/src/coreclr/pal/src/configure.cmake +++ b/src/coreclr/pal/src/configure.cmake @@ -615,7 +615,7 @@ endif() check_c_source_compiles(" #include -#include +#include int main(int argc, char **argv) { unw_context_t libUnwindContext; diff --git a/src/coreclr/pal/src/include/pal/context.h b/src/coreclr/pal/src/include/pal/context.h index 5d515a1434e00c..e99abd12b48613 100644 --- a/src/coreclr/pal/src/include/pal/context.h +++ b/src/coreclr/pal/src/include/pal/context.h @@ -33,9 +33,7 @@ extern "C" /* A type to wrap the native context type, which is ucontext_t on some * platforms and another type elsewhere. */ #if HAVE_UCONTEXT_T -#if HAVE_UCONTEXT_H -#include -#endif // HAVE_UCONTEXT_H +#include typedef ucontext_t native_context_t; #else // HAVE_UCONTEXT_T diff --git a/src/native/external/libunwind/include/libunwind-aarch64.h b/src/native/external/libunwind/include/libunwind-aarch64.h index 7751e4eb8be5e9..28c2678f514dd7 100644 --- a/src/native/external/libunwind/include/libunwind-aarch64.h +++ b/src/native/external/libunwind/include/libunwind-aarch64.h @@ -34,9 +34,13 @@ extern "C" { #include #include -#include #include #include +#ifdef __APPLE__ +#include +#else +#include +#endif #ifndef UNW_EMPTY_STRUCT # define UNW_EMPTY_STRUCT uint8_t unused; diff --git a/src/native/external/libunwind/include/libunwind-x86_64.h b/src/native/external/libunwind/include/libunwind-x86_64.h index a2fea33b3ba313..5bafbcdc8b61f4 100644 --- a/src/native/external/libunwind/include/libunwind-x86_64.h +++ b/src/native/external/libunwind/include/libunwind-x86_64.h @@ -35,7 +35,11 @@ extern "C" { #include #include #include +#ifdef __APPLE__ +#include +#else #include +#endif #ifndef UNW_EMPTY_STRUCT # define UNW_EMPTY_STRUCT uint8_t unused;