File tree Expand file tree Collapse file tree 3 files changed +9
-6
lines changed
Expand file tree Collapse file tree 3 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -294,7 +294,7 @@ namespace detail {
294294 if (type_info_addr - page_addr + sizeof (void *) > static_cast <unsigned >(page_size)) {
295295 throw internal_error (" pointer crosses page boundaries" );
296296 }
297- #if IS_WINDOWS
297+ #if IS_WINDOWS || defined(__CYGWIN__)
298298 auto old_protections = mprotect_page_and_return_old_protections (
299299 reinterpret_cast <void *>(page_addr),
300300 page_size,
Original file line number Diff line number Diff line change 55
66#ifndef _MSC_VER
77
8- #if IS_WINDOWS
8+ #if IS_WINDOWS || defined(__CYGWIN__)
99 #ifndef WIN32_LEAN_AND_MEAN
1010 #define WIN32_LEAN_AND_MEAN
1111 #endif
3131
3232CPPTRACE_BEGIN_NAMESPACE
3333namespace detail {
34- #if IS_WINDOWS
34+ #if IS_WINDOWS || defined(__CYGWIN__)
35+ // Cygwin uses GCC/Itanium ABI but Cygwin's mprotect seems to require 64KB-aligned addresses (allocation
36+ // granularity returned by sysconf(_SC_PAGESIZE)) while we need actual page granularity for typeinfo surgery.
37+ // Using the windows API here works best.
3538 int get_page_size () {
3639 SYSTEM_INFO info;
3740 GetSystemInfo (&info);
Original file line number Diff line number Diff line change 22
33#ifndef _MSC_VER
44
5- #if IS_WINDOWS
5+ #if IS_WINDOWS || defined(__CYGWIN__)
66 #ifndef WIN32_LEAN_AND_MEAN
77 #define WIN32_LEAN_AND_MEAN
88 #endif
1313
1414CPPTRACE_BEGIN_NAMESPACE
1515namespace detail {
16- #if IS_WINDOWS
16+ #if IS_WINDOWS || defined(__CYGWIN__)
1717 constexpr auto memory_readonly = PAGE_READONLY;
1818 constexpr auto memory_readwrite = PAGE_READWRITE;
1919 #else
2020 constexpr auto memory_readonly = PROT_READ;
2121 constexpr auto memory_readwrite = PROT_READ | PROT_WRITE;
2222 #endif
2323 int get_page_size ();
24- #if !IS_WINDOWS
24+ #if !IS_WINDOWS && !defined(__CYGWIN__)
2525 int get_page_protections (void * page);
2626 #endif
2727 int mprotect_page_and_return_old_protections (void * page, int page_size, int protections);
You can’t perform that action at this time.
0 commit comments