summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Remove OpenBSD uthreads (GC_OPENBSD_UTHREADS) supportGreg Steuck2022-11-255-146/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Issue #512 (bdwgc). Userland threads were replaced by rthreads on OpenBSD about a decade ago. Prior to OpenBSD 5.2 release (2012), the OS had user threads and required special handling. * include/private/gc_priv.h [GC_OPENBSD_THREADS && !GC_USESIGRT_SIGNALS] (SIG_SUSPEND): Do not check GC_OPENBSD_UTHREADS (assume not defined). * include/private/gcconfig.h [OPENBSD] (NEED_FIND_LIMIT): Likewise. * include/private/gcconfig.h [PTHREAD_STOP_WORLD_IMPL && !NACL] (SIGNAL_BASED_STOP_WORLD): Likewise. * os_dep.c [OPENBSD] (GC_register_data_segments): Likewise. * pthread_stop_world.c (GC_usleep, GC_suspend_all, GC_stop_world, GC_start_world, GC_stop_init): Likewise. * tests/initfromthread.c (main): Likewise. * include/private/gcconfig.h [GC_OPENBSD_THREADS && OpenBSD<201211] (GC_OPENBSD_UTHREADS): Do not define. * os_dep.c [OPENBSD && GC_OPENBSD_UTHREADS]: Do not include sys/syscall.h. * os_dep.c [OPENBSD && GC_OPENBSD_UTHREADS] (__syscall): Do not declare. * os_dep.c [OPENBSD && GC_OPENBSD_UTHREADS] (GC_find_limit_openbsd): Remove. * os_dep.c [NEED_FIND_LIMIT || USE_PROC_FOR_LIBRARIES && THREADS] (GC_find_limit_with_bound): Move comment from GC_find_limit_openbsd. * pthread_stop_world.c [!NACL && GC_OPENBSD_UTHREADS]: Do not include pthread_np.h. Co-authored-by: Kurt Miller <bsdkurt@gmail.com>
* Make Emscripten Asyncify feature optionalJukka Jylanki2022-11-244-12/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Issue #506 (bdwgc). "-sASYNCIFY" is a relatively rarely used feature of Emscripten, most developers do not use it, and it does not scale well to moderate-to-large codebases. It incurs a heavy impact to code size and performance, and carries other correctness problems that developers must then adhere to regarding event loop message ordering. This commit provides new option in cmake (-Denable_emscripten_asyncify) and configure (--enable-emscripten-asyncify) scripts to turn on Emscripten Asyncify feature on demand. * CMakeLists.txt (enable_emscripten_asyncify): New option (off by default). * CMakeLists.txt (EMSCRIPTEN): Define using check_c_source_compiles. * CMakeLists.txt [EMSCRIPTEN && enable_emscripten_asyncify] (EMSCRIPTEN_ASYNCIFY): Define C macro. * CMakeLists.txt [EMSCRIPTEN && enable_emscripten_asyncify] (CMAKE_EXE_LINKER_FLAGS): Append "-sASYNCIFY" and "-sASYNCIFY_STACK_SIZE=128000". * configure.ac (emscripten): Remove quotes for the error directive message. * configure.ac [emscripten] (gc_cflags): Move comment and assignment down (to be after reporting result for emscripten). * configure.ac (emscripten-asyncify): New AC_ARG_ENABLE option; add comment. * configure.ac [enable_emscripten_asyncify && emscripten] (gc_cflags): Add -D EMSCRIPTEN_ASYNCIFY; remove space after "-s". * configure.ac [emscripten] (gc_cflags): Append "-sASYNCIFY" and "-sASYNCIFY_STACK_SIZE=128000" only if enable_emscripten_asyncify. * doc/README.macros (EMSCRIPTEN_ASYNCIFY): Document. * os_dep.c [!ECOS && !NOSYS && !SYMBIAN && EMSCRIPTEN]: Make USE_EMSCRIPTEN_SCAN_STACK has effect only if EMSCRIPTEN_ASYNCIFY. * os_dep.c [THREADS && EMSCRIPTEN]: Include emscripten.h only if EMSCRIPTEN_ASYNCIFY. * os_dep.c [THREADS && EMSCRIPTEN] (scan_regs_cb, GC_default_push_other_roots): Define as a function only if EMSCRIPTEN_ASYNCIFY; update comment. Co-authored-by: Ivan Maidanski <ivmai@mail.ru>
* Use sbrk() to get OS memory on EmscriptenJukka Jylanki2022-11-231-2/+5
| | | | | | | | | | | | | Issue #505 (bdwgc). Disable targeting memory mapping features with WebAssembly since it does not support them. * include/private/gcconfig.h [I386 && EMSCRIPTEN] (USE_MMAP_ANON): Do not define. * include/private/gcconfig.h [I386 && EMSCRIPTEN] (USE_MMAP): Undefine. * include/private/gcconfig.h [I386 && EMSCRIPTEN] (USE_MUNMAP): Update comment.
* Fix typo in comment related to Emscripten linker bug memalign/memsetIvan Maidanski2022-11-231-2/+2
| | | | | | | | (fix of commit 1431bda1a) * tests/tests.am [EMSCRIPTEN]: Fix a typo ("_memalign and _memset") in comment (i.e. mention also _memset instead of mentioning _memalign twice).
* Fix call to undeclared function emscripten_scan_registersIvan Maidanski2022-11-231-0/+2
| | | | | | | | | | (fix of commit e4247e8e3) Issue #504 (bdwgc). * os_dep.c [!THREADS && EMSCRIPTEN]: Include emscripten.h. Co-authored-by: Jukka Jylanki <jujjyl@gmail.com>
* Use emscripten_stack_get_base instead of emscripten_scan_stackJukka Jylanki2022-11-221-9/+20
| | | | | | | | | | | | | | | | | | | | | | | | Issue #504 (bdwgc). Simplify obtaining the stack base for Emscripten by using the direct emscripten_stack_get_base(), instead of the ASYNCIFY-only emscripten_scan_stack(). The previous variant of getting the stack base (using emscripten_scan_stack function) is still available, it could be chosen by passing -D USE_EMSCRIPTEN_SCAN_STACK to CFLAGS. * os_dep.c [!ECOS && !NOSYS && !SYMBIAN && EMSCRIPTEN]: Include emscripten.h only if USE_EMSCRIPTEN_SCAN_STACK; add comment. * os_dep.c [!ECOS && !NOSYS && !SYMBIAN && EMSCRIPTEN] (emscripten_stack_base, scan_stack_cb): Define only if USE_EMSCRIPTEN_SCAN_STACK. * os_dep.c [!ECOS && !NOSYS && !SYMBIAN && EMSCRIPTEN && !USE_EMSCRIPTEN_SCAN_STACK]: Include emscripten/stack.h. * os_dep.c [!ECOS && !NOSYS && !SYMBIAN && EMSCRIPTEN] (GC_get_main_stack_base): Call emscripten_stack_get_base() instead of emscripten_scan_stack(scan_stack_cb) unless USE_EMSCRIPTEN_SCAN_STACK is defined.
* Provide meaningful error message in case of Emscripten threaded buildIvan Maidanski2022-11-221-0/+3
| | | | | | | | | | | | | | | Issue #503 (bdwgc). WebAssembly/Web workers do not currently/yet support synchronous stopping of all threads, so disallow building in multi-threaded mode with Emscripten, and hint the user to build single-threaded bdwgc instead. * include/private/gcconfig.h [EMSCRIPTEN && GC_THREADS && !CPPCHECK]: Report an error (that the multi-threaded build is not supported) using a preprocessor directive. Co-authored-by: Jukka Jylanki <jujjyl@gmail.com>
* Fix 'EMSCRIPTEN macro redefined' compile errorJukka Jylanki2022-11-221-2/+4
| | | | | | | | | Issue #502 (bdwgc). Do not re-define EMSCRIPTEN when already defined, and take into account the system provided __EMSCRIPTEN__ macro. * include/private/gcconfig.h [EMSCRIPTEN] (EMSCRIPTEN): Do not define.
* Refine gcinterface.md that the allocator belongs to SGI STLIvan Maidanski2022-11-211-1/+1
| | | | | * doc/gcinterface.md (C interface): Outline that "malloc_alloc" name belongs to STL (not libgc).
* Fix gccpp and gctba library names in gcinterface.mdIvan Maidanski2022-11-211-3/+3
| | | | | | * doc/gcinterface.md (Class inheritance, C interface): Change "libgccpp" and "libgctba" to "gccpp" and "gctba", respectively (i.e., remove "lib" prefix).
* Mention gctba library in README.cmakeIvan Maidanski2022-11-211-1/+1
| | | | | | | | (fix of commit 3efd0bc4e) * doc/README.cmake (BUILD PROCESS): Mention gctba along with gccpp (i.e. -Denable_cplusplus=ON option forces cmake to build also gctba library by default).
* Fix cmake usage instructions in README to build and run testsIvan Maidanski2022-11-212-2/+2
| | | | | | | | | | (fix of commit 4dfd06514) Issue #501 (bdwgc). * README.md (Installation and Portability): Pass -Dbuild_tests=ON to cmake. * doc/README.cmake (BUILD PROCESS): Likewise.
* AppVeyor CI: Test with malloc redirection enabled on CygwinIvan Maidanski2022-11-211-1/+1
|
* Do not prohibit threaded builds with malloc redirection on non-LinuxKristian Larsson2022-11-171-1/+5
| | | | | | | | | | | | | | | Issue #478 (bdwgc). The malloc (and friends) redirection in a multi-threaded client may work even on platforms other than Linux (as confirmed on MacOS) provided the client ensures all the client threads are registered with the collector, e.g. by using the preprocessor-based interception of the thread primitives (i.e., define GC_THREADS and include gc.h from all the client files those are using pthread_create and friends). * include/private/gcconfig.h [!CPPCHECK && REDIRECT_MALLOC && THREADS && !LINUX && !REDIRECT_MALLOC_IN_HEADER]: Remove error preprocessor directive; add comment.
* Document macros in config.h not referring to README (configure)Ivan Maidanski2022-11-171-8/+18
| | | | | | | | | | | | * configure.ac [$compiler_xlc==yes && $powerpc_darwin] (DARWIN_DONT_PARSE_STACK): Document w/o referring to README.macros. * configure.ac (MAKE_BACK_GRAPH): Likewise. * configure.ac [$enable_gc_debug==yes] (SHORT_DBG_HDRS): Likewise. * configure.ac [$enable_java_finalization!=no] (JAVA_FINALIZATION): Likewise. * configure.ac [$enable_redirect_malloc==yes] (GC_USE_DLOPEN_WRAP): Likewise. * configure.ac [$enable_munmap!=no] (USE_MUNMAP): Likewise.
* Allow passing custom CC and CXX to Makefile.directKristian Larsson2022-11-161-2/+2
| | | | | | | Issue #483 (bdwgc). * Makefile.direct (CC, CXX): Assign value using operator "?=" instead of "=" one.
* Update ChangeLog fileIvan Maidanski2022-11-161-0/+65
|
* Update ChangeLog file (v8.2 changes)Ivan Maidanski2022-11-161-0/+28
| | | | (a cherry-pick of commit 2b342c41a from 'release-8_2')
* Update ChangeLog file (v8.0 changes)Ivan Maidanski2022-11-161-0/+12
| | | | (a cherry-pick of commit ed4a18a70 from 'release-8_0')
* Update ChangeLog file (v7.6 changes)Ivan Maidanski2022-11-161-0/+8
| | | | (a cherry-pick of commit 4fe277030 from 'release-7_6')
* Update ChangeLog file (v7.2 - v7.4 changes only)Ivan Maidanski2022-11-161-0/+22
| | | | (a cherry-pick of commit ec801e0ef from 'release-7_4')
* Fix use of unset errno after pthread_sigmask callsIvan Maidanski2022-11-132-8/+4
| | | | | | | | | | (fix of commit 95947bdc5) * pthread_support.c [PARALLEL_MARK && !NO_MARKER_SPECIAL_SIGMASK] (GC_start_mark_threads_inner): Do not pass errno value to WARN() calls (because pthread_sigmask does not set errno). * win32_threads.c [PARALLEL_MARK && GC_PTHREADS_PARAMARK && !NO_MARKER_SPECIAL_SIGMASK] (GC_start_mark_threads_inner): Likewise.
* Redirect aligned_alloc() in leak_detector.hIvan Maidanski2022-11-021-0/+2
| | | | | | Issue #494 (bdwgc). * include/gc/leak_detector.h (aligned_alloc): Redefine to GC_memalign.
* Redirect reallocarray() in leak_detector.hIvan Maidanski2022-11-023-4/+7
| | | | | | | | | Issue #491 (bdwgc). * doc/leak.md: Mention reallocarray function; reorder redirected functions list. * include/gc/leak_detector.h (reallocarray): Redefine to GC_REALLOC(). * tests/leak.c (main): Call reallocarray() in a loop.
* Test realloc() in leaktestIvan Maidanski2022-11-021-0/+5
| | | | | * tests/leak.c (main): Call realloc() N_TESTS/2-1 times and then call CHECK_LEAKS().
* Fix mistyped function name in documentation of REDIRECT_REALLOCIvan Maidanski2022-11-021-1/+1
| | | | | * doc/README.macros (REDIRECT_REALLOC): Fix typo ("realloc" w/o GC_ prefix).
* Fix missing getpagesize() definition on OS/2 for usage by valloc()Ivan Maidanski2022-11-013-13/+33
| | | | | | | | | | | | | | | | | | | | | (fix of commit d4c81638d) Issue #495 (bdwgc). * include/private/gcconfig.h [I386 && OS2] (GETPAGESIZE): Define to os2_getpagesize. * os_dep.c [OS2] (INCL_DOSERRORS): Reorder among INCL_x defines lexicographically. * tools/setjmp_t.c [OS2] (INCL_DOSERRORS): Likewise. * os_dep.c [OS2] (INCL_DOSFILEMGR, INCL_DOSMISC): Define (before include os2.h). * os_dep.c [!MSWIN32 && !MSWINCE && !CYGWIN32 && OS2] (os2_getpagesize): New static function (code copied mostly from getpagesize() in setjmp_t.c). * tools/setjmp_t.c [OS2]: Update comment and move close to os2_getpagesize(). * tools/setjmp_t.c [OS2] (getpagesize): Make static and rename to os2_getpagesize.
* Remove trailing dot in WARN messagesIvan Maidanski2022-11-013-12/+13
| | | | | | | | | | | | | | | | | (refactoring) Also, polish some WARN messages in GC_init. * allchblk.c (GC_allochblk_nth): Place space at the beginning of the 2nd half of the WARN message string literal (instead of the end of the 1st half). * misc.c (GC_init): Likewise. * os_dep.c [GWW_VDB] (GC_gww_read_dirty): Likewise. * misc.c (GC_init): Remove trailing dot in WARN message; adjust (make uniform) WARN message about ignoring the value. * os_dep.c [MPROTECT_VDB && DARWIN && BROKEN_EXCEPTION_HANDLING] (GC_dirty_init): No not break WARN message string literal into two parts unnecessarily.
* Fix 'implicit declaration of GETPAGESIZE' compiler error in setjmp_t.cIvan Maidanski2022-11-011-1/+2
| | | | | | | | | (fix of commit a37cdaa3b) * tools/setjmp_t.c [!OS2 && (MSWIN32 || MSWINCE || CYGWIN32)] (getpagesize): Make static; rename to win32_getpagesize. * tools/setjmp_t.c [!OS2 && (MSWIN32 || MSWINCE || CYGWIN32)] (GETPAGESIZE): Define macro (to win32_getpagesize).
* Fix data race in GC_heapsize_at_forced_unmap variableIvan Maidanski2022-11-011-7/+8
| | | | | | | | | | | | | | | | | Issue #488 (bdwgc). Write to GC_heapsize_at_forced_unmap should be only performed when holding the allocation lock. * alloc.c (GC_heapsize_at_forced_unmap): Move the definition upper to be before GC_try_to_collect_general(); add comment. * alloc.c (GC_try_to_collect_general): Set GC_heapsize_at_forced_unmap value (after LOCK) if force_unmap; move comment from GC_heapsize_at_forced_unmap(). * alloc.c [!USE_MUNMAP] (GC_try_to_collect_general): Remove UNUSED_ARG(force_unmap). * alloc.c (GC_gcollect_and_unmap): Do not set GC_heapsize_at_forced_unmap.
* Eliminate 'cast signed to bigger unsigned' CSA warning in WARN callsIvan Maidanski2022-11-012-11/+18
| | | | | | | | | | | | * pthread_support.c [HAVE_PTHREAD_SETNAME_NP_WITH_TID_AND_ARG] (set_marker_thread_name): Cast WARN argument to signed_word. * pthread_support.c [PARALLEL_MARK] (GC_start_mark_threads_inner): Likewise. * pthread_support.c [GC_LINUX_THREADS && !HOST_ANDROID && !NACL] (GC_get_nprocs): Likewise. * pthread_support.c (GC_thr_init): Likewise. * win32_threads.c [PARALLEL_MARK] (GC_start_mark_threads_inner): Likewise.
* Refine WARN message in GC_proc_read_dirty regarding buffer sizeIvan Maidanski2022-11-011-1/+1
| | | | | | | (refactoring) * os_dep.c [PROC_VDB] (GC_proc_read_dirty): Refine message of WARN(GC_proc_buf_size).
* Fix negative heap size values reported in WARNIvan Maidanski2022-11-018-16/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Issue #496 (bdwgc). WARN_PRIuPTR is now used to print unsigned values in WARN() calls. Also, byte values are replaced with KiB ones in some WARN() calls. * allchblk.c (GC_allochblk_nth): Use WARN_PRIuPTR specifier instead of WARN_PRIdPTR. * alloc.c (GC_expand_hp_inner, GC_collect_or_expand): Likewise. * headers.c (GC_scratch_alloc): Likewise. * mark.c (alloc_mark_stack): Likewise. * misc.c (GC_enable): Likewise. * os_dep.c [NEED_PROC_MAPS] (GC_get_maps): Likewise. * os_dep.c [PROC_VDB] (GC_proc_read_dirty): Likewise. * win32_threads.c (GC_delete_thread): Likewise. * allchblk.c (GC_allochblk_nth): Print KiB value instead of in bytes in WARN message. * alloc.c (GC_expand_hp_inner): Likewise. * misc.c (GC_enable): Likewise. * alloc.c (GC_expand_hp_inner): Remove unneeded cast of bytes to word. * headers.c (GC_scratch_alloc): Likewise. * alloc.c [(!AMIGA || !GC_AMIGA_FASTALLOC) && USE_MUNMAP] (GC_collect_or_expand): Add assertion to indicate that there is no underflow in GC_heapsize-GC_unmapped_bytes. * include/private/gc_priv.h (WARN): Update comment. * include/private/gc_priv.h [!WARN_PRIdPTR] (WARN_PRIuPTR): Define.
* Build with GC_wcsdup support if wcslen existsIvan Maidanski2022-10-296-4/+26
| | | | | | | | | | | | | | | | | | Now, digimars.mak, NT_MAKEFILE and WCC_MAKEFILE scripts pass -D GC_REQUIRE_WCSDUP option to the compiler unconditionally to build GC_wcsdup API function. CMakeLists.txt and configure.ac pass this option to the compiler after successful probing whether wcslen() is provided on the host. Makefile.direct does not pass the option by default, only the comment about the option is added (because this script cannot check availability of wcslen in libc). * CMakeLists.txt (HAVE_WCSLEN): Set if wcslen symbol exists in wchar.h. * Makefile.direct (CFLAGS_EXTRA): Add comment of -D GC_REQUIRE_WCSDUP. * NT_MAKEFILE (CFLAGS_DEFAULT): Add -D GC_REQUIRE_WCSDUP. * WCC_MAKEFILE (DEFS): Likewise. * digimars.mak (DEFINES): Likewise. * configure.ac (GC_REQUIRE_WCSDUP): Define if the code snippet including wchar.h and calling wcslen() can be compiled and linked.
* Define public GC_[p]valloc() and redirect to them in leak_detector.hIvan Maidanski2022-10-289-24/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Issue #495 (bdwgc). * doc/README.macros (GC_NO_VALLOC): Document. * doc/leak.md: Mention GNU valloc and pvalloc functions. * include/gc/gc.h (GC_memalign): Remove comment that it is not tested; add comment describing the functionality and a note. * include/gc/gc.h [!GC_NO_VALLOC] (GC_valloc, GC_pvalloc): Declare new API function. * include/gc/leak_detector.h [!GC_NO_VALLOC] (valloc, pvalloc): Redefine to the corresponding GC_ function. * include/private/gc_priv.h (GC_page_size): Add comment. * include/private/gc_priv.h (GC_real_page_size): Declare new variable (or as a macro). * include/private/gcconfig.h [NACL] (GETPAGESIZE): Add TODO item. * mallocx.c (GC_memalign): Likewise. * tests/gctest.c (run_one_test): Likewise. * include/private/gcconfig.h [CYGWIN32 && (MPROTECT_VDB || USE_MUNMAP) || !MSWIN32 && !MSWINCE && !CYGWIN32 && (GC_DISABLE_INCREMENTAL || DEFAULT_VDB) && !USE_MMAP] (ALT_PAGESIZE_USED): Define macro. * include/private/gcconfig.h [CYGWIN32 && (MPROTECT_VDB || USE_MUNMAP) || !MSWIN32 && !MSWINCE && !CYGWIN32 && (GC_DISABLE_INCREMENTAL || DEFAULT_VDB) && !USE_MMAP && !GC_NO_VALLOC] (REAL_PAGESIZE_NEEDED): Likewise. * mallocx.c (GC_strdup): Reformat comment. * mallocx.c [!GC_NO_VALLOC] (GC_valloc, GC_pvalloc): Implement. * os_dep.c [REAL_PAGESIZE_NEEDED] (GC_real_page_size): Define variable. * os_dep.c [MSWIN32 || MSWINCE || CYGWIN32] (GC_setpagesize): Replace CYGWIN32&&(MPROTECT_VDB||USE_MUNMAP) to ALT_PAGESIZE_USED; remove comment that a separate variable could be added; reformat comment; assert about GC_pagesize only if REAL_PAGESIZE_NEEDED. * os_dep.c [ALT_PAGESIZE_USED && REAL_PAGESIZE_NEEDED] (GC_setpagesize): Set GC_real_page_size. * os_dep.c [!MSWIN32 && !MSWINCE && !CYGWIN32] (GC_setpagesize): Replace MPROTECT_VDB||PROC_VDB||SOFT_VDB||USE_MMAP to !ALT_PAGESIZE_USED. * tests/gctest.c [!GC_NO_VALLOC] (run_one_test): Call GC_valloc() and GC_pvalloc().
* Do not define GETPAGESIZE on Win32Ivan Maidanski2022-10-261-16/+9
| | | | | | | | | | | | | | | (refactoring) * include/private/gcconfig.h [DARWIN]: Move include unistd.h and definition of GETPAGESIZE down (to the block where GETPAGESIZE is defined for the common cases). * include/private/gcconfig.h [!GETPAGESIZE] (GETPAGESIZE): Do not define if MSWIN32 or MSWINCE or CYGWIN32. * include/private/gcconfig.h [!GETPAGESIZE]: Remove ifdef HPUX because GETPAGESIZE is already defined. * include/private/gcconfig.h [!GETPAGESIZE && LINUX] (GETPAGESIZE): Remove duplicate include unistd.h (because HOST_ANDROID, HOST_TIZEN and SVR4 are Linux flavors).
* Prevent use of redirected posix_memalign in GC_haiku_get_memIvan Maidanski2022-10-251-0/+3
| | | | | | | (fix of commit 847927f0e) * os_dep.c [HAIKU && GC_LEAK_DETECTOR_H] (posix_memalign): Undefine it (just in case leak_detector.h was accidentally included before).
* Collapse arch macro defines where possibleIvan Maidanski2022-10-251-249/+117
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (refactoring) * include/private/gcconfig.h [__aarch64__ && (DARWIN || LINUX || FREEBSD || NETBSD|| OPENBSD || _WIN32)] (AARCH64): Do not define macro twice. * include/private/gcconfig.h [(mips || __mips || _mips) && !__TANDEM && (LINUX || FREEBSD || NETBSD || OPENBSD)] (MIPS): Likewise. * include/private/gcconfig.h [_M_XENIX && _M_SYSV && _M_I386]: Change comment to TODO item. * include/private/gcconfig.h [__aarch64__ && (DARWIN || LINUX || FREEBSD || NETBSD || OPENBSD)] (AARCH64): Use single #if to define the macro. * include/private/gcconfig.h [(__arm || __arm__ || __arm32__) && (DARWIN || LINUX || FREEBSD || NETBSD || OPENBSD || NN_PLATFORM_CTR || SN_TARGET_PSP2)] (ARM32): Likewise. * include/private/gcconfig.h [(__i386__ || i386) && (DARWIN || LINUX || FREEBSD || NETBSD || OPENBSD || __QNX__)] (I386): Likewise. * include/private/gcconfig.h [(__m68k__ || m68k) && (NETBSD || OPENBSD) || __mc68000__ && LINUX] (M68K): Likewise. * include/private/gcconfig.h [(__mips || _mips || mips) && (LINUX || FREEBSD || NETBSD || OPENBSD)] (MIPS): Likewise. * include/private/gcconfig.h [(__powerpc__ || __powerpc64__ || __ppc__ || __ppc64__ || powerpc || powerpc64) && (DARWIN || LINUX || FREEBSD || NETBSD || OPENBSD)] (POWERPC): Likewise. * include/private/gcconfig.h [__sh__ && (LINUX || NETBSD || OPENBSD)] (SH): Likewise. * include/private/gcconfig.h [(__sparc__ || sparc) && (LINUX || FREEBSD || NETBSD || OPENBSD)] (SPARC): Likewise. * include/private/gcconfig.h [(__x86_64 || __x86_64__ || __amd64__) && (DARWIN || LINUX || FREEBSD || NETBSD || OPENBSD)] (X86_64): Likewise. * include/private/gcconfig.h [__arc__ && LINUX] (ARC): Place close to other defines of same style (<ARCH>+mach_type_known). * include/private/gcconfig.h [__avr32__ && LINUX] (AVR32): Likewise. * include/private/gcconfig.h [__cris__ && LINUX && !CRIS] (CRIS): Likewise. * include/private/gcconfig.h [__e2k__ && LINUX] (E2K): Likewise. * include/private/gcconfig.h [__hexagon__ && LINUX] (HEXAGON): Likewise. * include/private/gcconfig.h [(__ia64 || __ia64__) && LINUX] (IA64): Likewise. * include/private/gcconfig.h [__loongarch__ && LINUX] (LOONGARCH): Likewise. * include/private/gcconfig.h [__m32r__ && LINUX] (M32R): Likewise. * include/private/gcconfig.h [(__NIOS2__ || __NIOS2 || __nios2__) && LINUX] (NIOS2): Likewise. * include/private/gcconfig.h [__or1k__ && LINUX] (OR1K): Likewise. * include/private/gcconfig.h [__riscv && (FREEBSD || LINUX || OPENBSD)] (RISCV): Likewise. * include/private/gcconfig.h [__s390__ && LINUX] (S390): Likewise.
* Fix undefined mach_type_known on Linux/mips, NetBSD/mips and OpenBSD/mipsIvan Maidanski2022-10-241-3/+4
| | | | | | | | Issue #486 (bdwgc). * include/private/gcconfig.h [(mips || __mips || _mips) && !__TANDEM && !(nec_ews || _nec_ews) && !(ultrix || __ultrix) && (LINUX || NETBSD || OPENBSD)] (mach_type_known): Define macro.
* Fix build using Makefile.direct on FreeBSD with system-defined CFLAGSIvan Maidanski2022-10-221-2/+13
| | | | | | | | | | | | | | | | | | | | | (fix of commit f7cfa9d10) Issue #483 (bdwgc). Some hosts (e.g. FreeBSD ones) predefine CFLAGS variable (to e.g. -O2), thus the options required to build libgc (e.g. -I) should be appended to CFLAGS. If there is a need to alter the default macros added to CFLAGS in Makefile.direct, then the client should provide the full list of -D options in CFLAGS_DEFAULT_MACROS variable. * Makefile.direct (CFLAGS_FOR_PIC): Set to empty (if unset). * Makefile.direct (CFLAGS_DEFAULT_MACROS): New variable (move all -D options from CFLAGS) which could be customized by client. * Makefile.direct (CFLAGS): Add comment; split assignment into two steps (assign "-O" value first using "?=" operator, then append the remaining options using "+=" operator); use CFLAGS_DEFAULT_MACROS.
* Fix missing libalphagc.so dependency in Makefile.directIvan Maidanski2022-10-221-1/+2
| | | | | * Makefile.direct (OBJS): Add comment. * Makefile.direct (libalphagc.so): Add dependency on dyn_load.o.
* Remove -o option where not needed in Makefile.directIvan Maidanski2022-10-221-2/+2
| | | | | | | (refactoring) * Makefile.direct (atomic_ops.o, atomic_ops_sysdeps.o): Remove -o option (to match that of cord/cordbscs.o).
* Replace target names with '$@' in Makefile.directIvan Maidanski2022-10-221-67/+66
| | | | | | | | | | | | | | | | | | | (refactoring) * Makefile.direct (AS_ABI_FLAG, CC, CXX, AS, LD, SYM_PREFIX-libgc): Add a space after '=' symbol. * Makefile.direct (LEAKFLAGS, bsd-libleak.a): Rename LEAKFLAGS to LEAK_CFLAGS. * Makefile.direct (gc_badalc.o, gc_cpp.o, dyn_load_sunos53.o, mach_dep.o, mark_rts.o, cord/cordbscs.o, cord/cordxtra.o, cord/cordprnt.o): Rearrange options to have -c right before the source file name or just before -o option. * Makefile.direct (cpptest, sunos5gc.so, libalphagc.so, libirixgc.so, liblinuxgc.so, mach_dep.o, mark_rts.o, cordtest, de, if_mach, threadlibs, if_not_there, gctest, setjmp_test, gctest_dyn_link, gctest_irix_dyn_link, bsd-libleak.a, tests/gctest.o, sunos5gc.so, libalphagc.so, libirixgc.so, liblinuxgc.so, cord/cordbscs.o, cord/cordxtra.o, cord/cordprnt.o): Replace rule target name with "$@".
* Allow custom AO_SRC_DIR, CURSES, EXEEXT, HOSTCC/CFLAGS for Makefile.directIvan Maidanski2022-10-211-5/+5
| | | | | * Makefile.direct (AO_SRC_DIR, HOSTCC, HOSTCFLAGS, EXEEXT, CURSES): Assign value using operator "?=" instead of "=" one.
* Fix gctest.o name in gctest_dyn_link rule of Makefile.directIvan Maidanski2022-10-211-1/+1
| | | | | | | (fix of commit 4a5c9217b) * Makefile.direct (gctest_dyn_link): Change gcgctest.o (misspelled) to gctest.o.
* Do not include sched.h from pthread_start.cIvan Maidanski2022-10-211-2/+0
| | | | | | | (refactoring) * pthread_start.c [GC_PTHREADS && !GC_WIN32_THREADS && !SN_TARGET_ORBIS && !SN_TARGET_PSP2]: Remove include sched.h.
* Get libpthread.so '.text' mapping only for glibc prior to v2.34 (Linux)Ivan Maidanski2022-10-212-27/+42
| | | | | | | | | | | | | | | | | | | | | | | | Some libc implementations like bionic (on Android), musl and glibc 2.34 (and later) do not have libpthread.so (because the code implementing POSIX threads is located in libc.so file). * include/private/gcconfig.h [GC_LINUX_THREADS && REDIRECT_MALLOC && !HAVE_LIBPTHREAD_SO && __GLIBC__ && !GC_GLIBC_PREREQ(2,34)] (HAVE_LIBPTHREAD_SO): Define macro; move comment from GC_init_lib_bounds. * malloc.c [REDIRECT_MALLOC && GC_LINUX_THREADS] (GC_libpthread_start, GC_libpthread_end): Define variable only if HAVE_LIBPTHREAD_SO. * malloc.c [REDIRECT_MALLOC && GC_LINUX_THREADS] (GC_init_lib_bounds): Call GC_text_mapping("libpthread-") only if HAVE_LIBPTHREAD_SO; remove TODO item. * malloc.c [REDIRECT_MALLOC && GC_LINUX_THREADS] (calloc): Update and place comments properly. * malloc.c [REDIRECT_MALLOC && GC_LINUX_THREADS] (calloc): Check the caller is in range between GC_libpthread_start and GC_libpthread_end only if HAVE_LIBPTHREAD_SO. * malloc.c [REDIRECT_FREE && !REDIRECT_MALLOC_IN_HEADER && !IGNORE_FREE && GC_LINUX_THREADS && !USE_PROC_FOR_LIBRARIES] (free): Likewise.
* Remove redundant HOST_TIZEN macro check for SEARCH_FOR_DATA_STARTIvan Maidanski2022-10-211-4/+2
| | | | | | | | (refactoring) * include/private/gcconfig.h [(I386 || ARM32) && LINUX && __ELF__] (SEARCH_FOR_DATA_START): Do not check HOST_TIZEN macro (because TIZEN uses glibc 2.0 or later).
* Define GC_GLIBC_PREREQ internal macroIvan Maidanski2022-10-214-23/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | (refactoring) * dyn_load.c [(SCO_ELF || DGUX || HURD || NACL || __ELF__ && (LINUX || FREEBSD || NETBSD || OPENBSD)) && !USE_PROC_FOR_LIBRARIES && !HAVE_DL_ITERATE_PHDR] (HAVE_DL_ITERATE_PHDR): Replace __GLIBC__>2||__GLIBC__==2&&__GLIBC_MINOR__>2 to GC_GLIBC_PREREQ(2,3). * dyn_load.c [(SCO_ELF || DGUX || HURD || NACL || __ELF__ && (LINUX || FREEBSD || NETBSD || OPENBSD)) && !USE_PROC_FOR_LIBRARIES && __GLIBC__==2 && __GLIBC_MINOR__==2 && DT_CONFIG && !HAVE_DL_ITERATE_PHDR] (HAVE_DL_ITERATE_PHDR): Do not define. * include/private/gcconfig.h [LINUX]: Move include features.h upper (to be before GC_GLIBC_PREREQ); add TODO item; refine comment. * include/private/gcconfig.h (GC_GLIBC_PREREQ): Define macro. * include/private/gcconfig.h [(M68K || I386 || ARM32) && LINUX && __ELF__]: Replace defined(__GLIBC__)&&__GLIBC__>=2 to GC_GLIBC_PREREQ(2,0). * include/private/gcconfig.h [MIPS && LINUX]: Replace __GLIBC__>2||__GLIBC__==2&&__GLIBC_MINOR__>=2 to GC_GLIBC_PREREQ(2,2). * include/private/gcconfig.h [MPROTECT_VDB && __GLIBC__]: Replace __GLIBC__<2||__GLIBC__==2&&__GLIBC_MINOR__<2 to !GC_GLIBC_PREREQ(2,2). * malloc.c [REDIRECT_MALLOC && GC_LINUX_THREADS && __GLIBC__] (GC_init_lib_bounds): Replace __GLIBC__<2||__GLIBC__==2&&__GLIBC_MINOR__<34 to !GC_GLIBC_PREREQ(2,34). * os_dep.c [(I386 && SAVE_CALL_CHAIN || SPARC) && LINUX]: Do not include features.h.
* Fix uclibc handling and comment in GC_init_lib_boundsIvan Maidanski2022-10-201-2/+2
| | | | | | | | | | | | | | | (fix of commit ffd2f9fe0) Issue #477 (bdwgc). According to uclibc source it seems to have libpthread.so file, unlike musl. This commit replaces uclibc to musl in comment and do not turn off the warning about missing libpthread.so for uclibc. * malloc.c [REDIRECT_MALLOC && !REDIRECT_MALLOC_IN_HEADER && GC_LINUX_THREADS && __GLIBC__] (GC_init_lib_bounds): Change uclibc (misspelled) to musl in comment; do not check whether __UCLIBC__ is defined.