]> granicus.if.org Git - gc/commitdiff
Fix memory allocation on GCF (Linux/x64)
authorIvan Maidanski <ivmai@mail.ru>
Wed, 3 Oct 2018 08:02:07 +0000 (11:02 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Wed, 3 Oct 2018 08:02:07 +0000 (11:02 +0300)
Issue #225 (bdwgc).

GCF (Google Cloud Function) seems to have mmap("/dev/zero") operation
unsupported.  The workaround is to use mmap(MAP_ANONYMOUS).

* include/private/gcconfig.h [X86_64 && LINUX && __GLIBC__
&& !__UCLIBC__] (USE_MMAP_ANON): Define macro; add comment.

include/private/gcconfig.h

index 7abdf61b707cf942b6da537d231888cd62bdb237..5671402b9e5c39d0cda784cdba8f4a02306a587f 100644 (file)
@@ -2622,13 +2622,15 @@ EXTERN_C_BEGIN
 #            define DATASTART ((ptr_t)((((word)(etext)) + 0xfff) & ~0xfff))
 #       endif
 #       if defined(__GLIBC__) && !defined(__UCLIBC__)
+          /* A workaround for GCF (Google Cloud Function) which does    */
+          /* not support mmap() for "/dev/zero".  Should not cause any  */
+          /* harm to other targets.                                     */
+#         define USE_MMAP_ANON
           /* At present, there's a bug in GLibc getcontext() on         */
           /* Linux/x64 (it clears FPU exception mask).  We define this  */
           /* macro to workaround it.                                    */
           /* TODO: This seems to be fixed in GLibc v2.14.               */
 #         define GETCONTEXT_FPU_EXCMASK_BUG
-#       endif
-#       if defined(__GLIBC__) && !defined(__UCLIBC__)
           /* Workaround lock elision implementation for some glibc.     */
 #         define GLIBC_2_19_TSX_BUG
           EXTERN_C_END