diff --git a/llvm/lib/Support/CMakeLists.txt b/llvm/lib/Support/CMakeLists.txt --- a/llvm/lib/Support/CMakeLists.txt +++ b/llvm/lib/Support/CMakeLists.txt @@ -36,6 +36,10 @@ if( FUCHSIA ) set(system_libs ${system_libs} zircon) endif() + if ( HAIKU ) + add_definitions(-D_BSD_SOURCE) + set(system_libs ${system_libs} bsd) + endif() endif( MSVC OR MINGW ) # Delay load shell32.dll if possible to speed up process startup. diff --git a/llvm/lib/Support/Unix/Program.inc b/llvm/lib/Support/Unix/Program.inc --- a/llvm/lib/Support/Unix/Program.inc +++ b/llvm/lib/Support/Unix/Program.inc @@ -452,8 +452,12 @@ if (ProcStat) { std::chrono::microseconds UserT = toDuration(Info.ru_utime); std::chrono::microseconds KernelT = toDuration(Info.ru_stime); +#ifndef __HAIKU__ uint64_t PeakMemory = static_cast(Info.ru_maxrss); *ProcStat = ProcessStatistics{UserT + KernelT, UserT, PeakMemory}; +#else + *ProcStat = ProcessStatistics{UserT + KernelT, UserT, 0}; +#endif } // Return the proper exit status. Detect error conditions