Skip to content

Commit 74d5faa

Browse files
committed
rt: Give each platform its own red zone definition
1 parent 762d7e4 commit 74d5faa

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

src/rt/rust_task.cpp

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,35 @@
1818
// The amount of extra space at the end of each stack segment, available
1919
// to the rt, compiler and dynamic linker for running small functions
2020
// FIXME: We want this to be 128 but need to slim the red zone calls down
21+
#define RZ_LINUX_32 1024*20
22+
#define RZ_LINUX_64 1024*20
23+
#define RZ_MAC_32 1024*20
24+
#define RZ_MAC_64 1024*20
25+
#define RZ_WIN_32 1024*20
26+
27+
#ifdef __linux__
2128
#ifdef __i386__
22-
#define RED_ZONE_SIZE 1024*20
29+
#define RED_ZONE_SIZE RZ_LINUX_32
30+
#endif
31+
#ifdef __x86_64__
32+
#define RED_ZONE_SIZE RZ_LINUX_64
33+
#endif
34+
#endif
35+
#ifdef __APPLE__
36+
#ifdef __i386__
37+
#define RED_ZONE_SIZE RZ_MAC_32
2338
#endif
24-
2539
#ifdef __x86_64__
26-
#define RED_ZONE_SIZE 1024*20
40+
#define RED_ZONE_SIZE RZ_MAC_64
41+
#endif
42+
#endif
43+
#ifdef __WIN32__
44+
#ifdef __i386__
45+
#define RED_ZONE_SIZE RZ_WIN_32
46+
#endif
47+
#ifdef __x86_64__
48+
#define RED_ZONE_SIZE RZ_WIN_64
49+
#endif
2750
#endif
2851

2952
// Stack size

0 commit comments

Comments
 (0)