Skip to content

Commit

Permalink
WIP: Test sys/ucontext.h
Browse files Browse the repository at this point in the history
  • Loading branch information
filipnavara committed Nov 20, 2024
1 parent 1474fc3 commit a3e1a72
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 7 deletions.
1 change: 0 additions & 1 deletion src/coreclr/nativeaot/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/nativeaot/Runtime/unix/UnixContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#ifndef __UNIX_CONTEXT_H__
#define __UNIX_CONTEXT_H__

#include <ucontext.h>
#include <sys/ucontext.h>

// Convert Unix native context to PAL_LIMITED_CONTEXT
void NativeContextToPalContext(const void* context, PAL_LIMITED_CONTEXT* palContext);
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/pal/src/configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ endif()

check_c_source_compiles("
#include <libunwind.h>
#include <ucontext.h>
#include <sys/ucontext.h>
int main(int argc, char **argv)
{
unw_context_t libUnwindContext;
Expand Down
4 changes: 1 addition & 3 deletions src/coreclr/pal/src/include/pal/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <ucontext.h>
#endif // HAVE_UCONTEXT_H
#include <sys/ucontext.h>

typedef ucontext_t native_context_t;
#else // HAVE_UCONTEXT_T
Expand Down
6 changes: 5 additions & 1 deletion src/native/external/libunwind/include/libunwind-aarch64.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,13 @@ extern "C" {

#include <inttypes.h>
#include <stddef.h>
#include <ucontext.h>
#include <stdalign.h>
#include <stdint.h>
#ifdef __APPLE__
#include <sys/ucontext.h>
#else
#include <ucontext.h>
#endif

#ifndef UNW_EMPTY_STRUCT
# define UNW_EMPTY_STRUCT uint8_t unused;
Expand Down
4 changes: 4 additions & 0 deletions src/native/external/libunwind/include/libunwind-x86_64.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ extern "C" {
#include <sys/types.h>
#include <inttypes.h>
#include <stdint.h>
#ifdef __APPLE__
#include <sys/ucontext.h>
#else
#include <ucontext.h>
#endif

#ifndef UNW_EMPTY_STRUCT
# define UNW_EMPTY_STRUCT uint8_t unused;
Expand Down

0 comments on commit a3e1a72

Please sign in to comment.