From 70e3c12fb708a02c2326d571e11ae53aef8c45f0 Mon Sep 17 00:00:00 2001 From: KO Myung-Hun Date: Tue, 19 Jan 2021 01:40:11 +0900 Subject: [PATCH] zerosize-ptr: Fix compilation on OS/2 kLIBC. * tests/zerosize-ptr.h [OS/2 kLIBC]: Don't use mmap(). --- ChangeLog | 5 +++++ tests/zerosize-ptr.h | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 83d724cfbe..357c231be8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2021-01-19 KO Myung-Hun + + zerosize-ptr: Fix compilation on OS/2 kLIBC. + * tests/zerosize-ptr.h [OS/2 kLIBC]: Don't use mmap(). + 2021-01-19 KO Myung-Hun stddef: Fix compilation for max_align_t on OS/2 kLIBC. diff --git a/tests/zerosize-ptr.h b/tests/zerosize-ptr.h index 45a1729d3e..bfeff50935 100644 --- a/tests/zerosize-ptr.h +++ b/tests/zerosize-ptr.h @@ -36,8 +36,9 @@ /* Test whether mmap() and mprotect() are available. We don't use HAVE_MMAP, because AC_FUNC_MMAP would not define it on HP-UX. HAVE_MPROTECT is not enough, because mingw does not have mmap() but has an - mprotect() function in libgcc.a. */ -#if HAVE_SYS_MMAN_H && HAVE_MPROTECT + mprotect() function in libgcc.a. + And OS/2 kLIBC has and mprotect(), but not mmap(). */ +#if HAVE_SYS_MMAN_H && HAVE_MPROTECT && !defined __KLIBC__ # include # include # include @@ -58,7 +59,7 @@ zerosize_ptr (void) { /* Use mmap and mprotect when they exist. Don't test HAVE_MMAP, because it is not defined on HP-UX 11 (since it does not support MAP_FIXED). */ -#if HAVE_SYS_MMAN_H && HAVE_MPROTECT +#if HAVE_SYS_MMAN_H && HAVE_MPROTECT && !defined __KLIBC__ # if HAVE_MAP_ANONYMOUS const int flags = MAP_ANONYMOUS | MAP_PRIVATE; const int fd = -1; -- 2.39.5