[PATCH] D116603: [AIX][z/OS][Support] Provide alternate mapped_file_region::dontNeedImpl implementations

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 4 12:42:21 PST 2022


MaskRay added a comment.

POSIX specifies sys/mman.h and it is available on all major *NIX operation systems, so I don't think we need HAVE_SYS_MMAN_H.

We cannot use `posix_madvise`  on Linux glibc/musl because MADV_DONTNEED (desired semantics on a read-only file mapping) is a no-op in their `posix_madvise` implementations.

If madvise doesn't have a benefit on AIX, consider just not implementing it to avoid some CMake complexity.



================
Comment at: llvm/lib/Support/CMakeLists.txt:3
+# Path requires definitions in headers which need _ALL_SOURCE to build on AIX
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+  remove_definitions("-D_XOPEN_SOURCE=700")
----------------



================
Comment at: llvm/lib/Support/Unix/Path.inc:875
   assert(Mode == mapped_file_region::readonly);
   if (Mapping)
+#if defined(__MVS__) || !defined(HAVE_SYS_MMAN_H)
----------------
`if (Mapping) {` or use early return


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116603/new/

https://reviews.llvm.org/D116603



More information about the llvm-commits mailing list