Previously, sbrk() was used for the memory allocation even if the
executable pages were requested.
* os_dep.c [!OS2 && !PCR && !AMIGA && !USE_WINALLOC && !MACOS
&& !DOS4GW && !NONSTOP && !SN_TARGET_PSP2 && !RTEMS && !__CC_ARM
&& MMAP_SUPPORTED] (GC_unix_get_mem): Do not call GC_unix_sbrk_get_mem
if GC_pages_executable; add comment.
static GC_bool sbrk_failed = FALSE;
ptr_t result = 0;
+ if (GC_pages_executable) {
+ /* If the allocated memory should have the execute permission */
+ /* then sbrk() cannot be used. */
+ return GC_unix_mmap_get_mem(bytes);
+ }
if (!sbrk_failed) result = GC_unix_sbrk_get_mem(bytes);
if (0 == result) {
sbrk_failed = TRUE;