summaryrefslogtreecommitdiff
path: root/os_dep.c
diff options
context:
space:
mode:
authorMario Topf <mario.topf@unity3d.com>2021-03-04 12:08:44 +0100
committerIvan Maidanski <ivmai@mail.ru>2023-02-02 00:37:14 +0300
commit8ade04b4dc6e22547cab60180948f61b93b0006b (patch)
tree3dadc5537454d71a62575831b406baea2765be6a /os_dep.c
parent694cf83a36706437eedf8ce51a00d7dafea67be2 (diff)
downloadbdwgc-8ade04b4dc6e22547cab60180948f61b93b0006b.tar.gz
Use __builtin_frame_address(0) to find main stack base on QNX
(cherry-pick of 544ba4d, ef9684c from Unity-Technologies/bdwgc) The proposed alternate approach (QNX_STACKBOTTOM) to find stack bottom (base) of the primordial thread is not very exact but it works for the tests, at least, unlike other available heuristics (e.g., HEURISTIC1). * include/private/gcconfig.h [QNX] (HEURISTIC1): Do not define if QNX_STACKBOTTOM; add TODO item. * os_dep.c [QNX_STACKBOTTOM] (GC_qnx_main_stack_base): New function (calls __builtin_frame_address(0)); add TODO item. * os_dep.c [!STACKBOTTOM && !HEURISTIC1 && QNX_STACKBOTTOM] (GC_get_main_stack_base): Call GC_qnx_main_stack_base(). Co-authored-by: Mario Hoepfner <mario.hopfner@unity3d.com>
Diffstat (limited to 'os_dep.c')
-rw-r--r--os_dep.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/os_dep.c b/os_dep.c
index 06345341..2d33b150 100644
--- a/os_dep.c
+++ b/os_dep.c
@@ -1154,6 +1154,15 @@ GC_INNER size_t GC_page_size = 0;
}
#endif /* LINUX_STACKBOTTOM */
+#ifdef QNX_STACKBOTTOM
+ STATIC ptr_t GC_qnx_main_stack_base(void)
+ {
+ /* TODO: this approach is not very exact but it works for the */
+ /* tests, at least, unlike other available heuristics. */
+ return (ptr_t)__builtin_frame_address(0);
+ }
+#endif /* QNX_STACKBOTTOM */
+
#ifdef FREEBSD_STACKBOTTOM
/* This uses an undocumented sysctl call, but at least one expert */
/* believes it will stay. */
@@ -1283,6 +1292,8 @@ GC_INNER size_t GC_page_size = 0;
result = GC_hpux_main_stack_base();
# elif defined(LINUX_STACKBOTTOM)
result = GC_linux_main_stack_base();
+# elif defined(QNX_STACKBOTTOM)
+ result = GC_qnx_main_stack_base();
# elif defined(FREEBSD_STACKBOTTOM)
result = GC_freebsd_main_stack_base();
# elif defined(HEURISTIC2)