Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sagesmc
Path: blob/master/build/pkgs/boehm_gc/patches/cygwin64.patch
8822 views
1
--- a/include/gc.h 2012-08-09 16:25:13.000000000 -0400
2
+++ b/include/gc.h 2013-04-22 13:10:01.101686000 -0400
3
@@ -1385,7 +1385,14 @@
4
/* THREAD_LOCAL_ALLOC defined and the initial allocation call is not */
5
/* to GC_malloc() or GC_malloc_atomic(). */
6
7
-#ifdef __CYGWIN32__
8
+#ifdef __CYGWIN__
9
+#ifdef __x86_64__
10
+ extern int __data_start__[], __data_end__[], __bss_start__[], __bss_end__[];
11
+#define GC_DATASTART (__data_start__ < __bss_start__ ?\
12
+ (void *)__data_start__ : (void *)__bss_start__)
13
+#define GC_DATAEND (__data_end__ < __bss_end__ ?\
14
+ (void *)__data_end__ : (void *)__bss_end__)
15
+#else
16
/* Similarly gnu-win32 DLLs need explicit initialization from the */
17
/* main program, as does AIX. */
18
extern int _data_start__[], _data_end__[], _bss_start__[], _bss_end__[];
19
@@ -1393,6 +1400,7 @@
20
(void *)_data_start__ : (void *)_bss_start__)
21
# define GC_DATAEND (_data_end__ > _bss_end__ ? \
22
(void *)_data_end__ : (void *)_bss_end__)
23
+#endif
24
# define GC_INIT_CONF_ROOTS GC_add_roots(GC_DATASTART, GC_DATAEND); \
25
GC_gcollect() /* For blacklisting. */
26
/* Required at least if GC is in a DLL. And doesn't hurt. */
27
--- a/include/private/gcconfig.h 2012-08-09 16:25:13.000000000 -0400
28
+++ b/include/private/gcconfig.h 2013-04-21 12:52:28.024399600 -0400
29
@@ -432,10 +432,20 @@
30
# endif
31
# define mach_type_known
32
# endif
33
-# if defined(__CYGWIN32__) || defined(__CYGWIN__)
34
+# if defined(__CYGWIN32__)
35
# define I386
36
# define CYGWIN32
37
# define mach_type_known
38
+#if defined(__CYGWIN__)
39
+# if defined(__LP64__)
40
+# define X86_64
41
+# define mach_type_known
42
+# else
43
+# define I386
44
+# endif
45
+# define CYGWIN32
46
+# define mach_type_known
47
+#endif
48
# endif
49
# if defined(__MINGW32__) && !defined(mach_type_known)
50
# define I386
51
@@ -502,6 +512,16 @@
52
# define mach_type_known
53
# endif
54
55
+#if defined(__CYGWIN__)
56
+# if defined(__LP64__)
57
+# define X86_64
58
+# define mach_type_known
59
+# else
60
+# define I386
61
+# endif
62
+# define CYGWIN32
63
+# define mach_type_known
64
+#endif
65
/* Feel free to add more clauses here */
66
67
/* Or manually define the machine type here. A machine type is */
68
@@ -2259,6 +2279,19 @@
69
# define GWW_VDB
70
# define DATAEND /* not needed */
71
# endif
72
+
73
+# ifdef CYGWIN32
74
+# define OS_TYPE "CYGWIN32"
75
+# define DATASTART ((ptr_t)GC_DATASTART) /* From gc.h */
76
+# define DATAEND ((ptr_t)GC_DATAEND)
77
+# define ALIGNMENT 8
78
+# undef STACK_GRAN
79
+# define STACK_GRAN 0x10000
80
+# ifdef USE_MMAP
81
+# define NEED_FIND_LIMIT
82
+# define USE_MMAP_ANON
83
+# endif
84
+# endif
85
# endif /* X86_64 */
86
87
# ifdef HEXAGON
88
--- a/os_dep.c 2012-08-09 16:25:13.000000000 -0400
89
+++ b/os_dep.c 2013-04-22 12:43:32.202498600 -0400
90
@@ -770,7 +770,14 @@
91
/* gcc version of boehm-gc). */
92
GC_API int GC_CALL GC_get_stack_base(struct GC_stack_base *sb)
93
{
94
+# ifdef __x86_64__
95
+ PNT_TIB pTib = NtCurrentTeb();
96
+ void * _tlsbase = pTib->StackBase;
97
+ /*void * _tlsbase = NtCurrentTeb()->pTib.StackBase;*/
98
+ /*extern void * _tlsbase __asm__ ("%gs:8");*/
99
+# else
100
extern void * _tlsbase __asm__ ("%fs:4");
101
+# endif
102
sb -> mem_base = _tlsbase;
103
return GC_SUCCESS;
104
}
105
106