Index: llvm/lib/Support/CMakeLists.txt =================================================================== --- llvm/lib/Support/CMakeLists.txt +++ llvm/lib/Support/CMakeLists.txt @@ -1,5 +1,12 @@ include(GetLibraryName) +# 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") + add_definitions("-D_ALL_SOURCE") +endif() + + # Ensure that libSupport does not carry any static global initializer. # libSupport can be embedded in use cases where we don't want to load all # cl::opt unless we want to parse the command line. Index: llvm/lib/Support/Unix/Path.inc =================================================================== --- llvm/lib/Support/Unix/Path.inc +++ llvm/lib/Support/Unix/Path.inc @@ -873,7 +873,14 @@ void mapped_file_region::dontNeedImpl() { assert(Mode == mapped_file_region::readonly); if (Mapping) +#if defined(__MVS__) || !defined(HAVE_SYS_MMAN_H) + // If we don't have madvise, treat this as a no-op. + return; +#elif defined(_AIX) + ::madvise((caddr_t)Mapping, Size, POSIX_MADV_DONTNEED); +#else ::madvise(Mapping, Size, MADV_DONTNEED); +#endif } int mapped_file_region::alignment() {