Skip to content

Commit

Permalink
Use pthread_getattr_np() to get stack base on Cosmo
Browse files Browse the repository at this point in the history
Issue #666 (bdwgc).

* include/private/gcconfig.h [COSMO] (LINUX_STACKBOTTOM): Do not
define.
* include/private/gcconfig.h [COSMO] (HEURISTIC1,
USE_GET_STACKBASE_FOR_MAIN): Define macro.
* include/private/gcconfig.h [COSMO && NO_PTHREAD_GETATTR_NP]
(HAVE_PTHREAD_GETATTR_NP): Likewise.
* include/private/gcconfig.h [COSMO] (STACK_GRAN): Define macro (with
some fake value).
  • Loading branch information
ivmai committed Oct 15, 2024
1 parent 1310a0c commit 380f510
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions include/private/gcconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,11 @@ EXTERN_C_BEGIN

#ifdef COSMO
# define OS_TYPE "COSMO"
# define LINUX_STACKBOTTOM
# define HEURISTIC1 /* relies on pthread_attr_getstack actually */
# define STACK_GRAN 0x1000000
# ifndef USE_GET_STACKBASE_FOR_MAIN
# define USE_GET_STACKBASE_FOR_MAIN
# endif
extern int __data_start[] __attribute__((__weak__));
# define DATASTART ((ptr_t)__data_start)
extern int _end[];
Expand Down Expand Up @@ -3122,8 +3126,8 @@ extern ptr_t GC_data_start;
#endif

/* Outline pthread primitives to use in GC_get_[main_]stack_base. */
#if ((defined(FREEBSD) && defined(__GLIBC__)) /* kFreeBSD */ \
|| defined(LINUX) || defined(KOS) || defined(NETBSD)) \
#if ((defined(FREEBSD) && defined(__GLIBC__)) /* kFreeBSD */ \
|| defined(COSMO) || defined(LINUX) || defined(KOS) || defined(NETBSD)) \
&& !defined(NO_PTHREAD_GETATTR_NP)
# define HAVE_PTHREAD_GETATTR_NP 1
#elif defined(FREEBSD) && !defined(__GLIBC__) \
Expand Down

0 comments on commit 380f510

Please sign in to comment.