Skip to content

[Support] Fix building on FreeBSD and OpenBSD #127005

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions llvm/cmake/config-ix.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ if (ANDROID OR CYGWIN OR CMAKE_SYSTEM_NAME MATCHES "AIX|DragonFly|FreeBSD|Haiku|
set(HAVE_MACH_MACH_H 0)
set(HAVE_MALLOC_MALLOC_H 0)
set(HAVE_PTHREAD_H 1)
set(HAVE_SYS_AUXV_H 1)
set(HAVE_SYS_MMAN_H 1)
set(HAVE_SYSEXITS_H 1)
set(HAVE_UNISTD_H 1)
Expand Down Expand Up @@ -53,7 +52,6 @@ else()
check_include_file(mach/mach.h HAVE_MACH_MACH_H)
check_include_file(malloc/malloc.h HAVE_MALLOC_MALLOC_H)
check_include_file(pthread.h HAVE_PTHREAD_H)
check_include_file(sys/auxv.h HAVE_SYS_AUXV_H)
check_include_file(sys/mman.h HAVE_SYS_MMAN_H)
check_include_file(sysexits.h HAVE_SYSEXITS_H)
check_include_file(unistd.h HAVE_UNISTD_H)
Expand Down Expand Up @@ -321,6 +319,7 @@ check_symbol_exists(getrusage sys/resource.h HAVE_GETRUSAGE)
check_symbol_exists(isatty unistd.h HAVE_ISATTY)
check_symbol_exists(futimens sys/stat.h HAVE_FUTIMENS)
check_symbol_exists(futimes sys/time.h HAVE_FUTIMES)
check_symbol_exists(getauxval sys/auxv.h HAVE_GETAUXVAL)
# AddressSanitizer conflicts with lib/Support/Unix/Signals.inc
# Avoid sigaltstack on Apple platforms, where backtrace() cannot handle it
# (rdar://7089625) and _Unwind_Backtrace is unusable because it cannot unwind
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/Config/config.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,6 @@

#cmakedefine HAVE_BUILTIN_THREAD_POINTER ${HAVE_BUILTIN_THREAD_POINTER}

#cmakedefine HAVE_SYS_AUXV_H ${HAVE_SYS_AUXV_H}
#cmakedefine HAVE_GETAUXVAL ${HAVE_GETAUXVAL}

#endif
4 changes: 2 additions & 2 deletions llvm/lib/Support/Unix/Process.inc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#ifdef HAVE_MALLOC_MALLOC_H
#include <malloc/malloc.h>
#endif
#ifdef HAVE_SYS_AUXV_H
#ifdef HAVE_GETAUXVAL
#include <sys/auxv.h>
#endif

Expand Down Expand Up @@ -66,7 +66,7 @@ Process::Pid Process::getProcessId() {
// On Cygwin, getpagesize() returns 64k(AllocationGranularity) and
// offset in mmap(3) should be aligned to the AllocationGranularity.
Expected<unsigned> Process::getPageSize() {
#if defined(HAVE_SYS_AUXV_H)
#if defined(HAVE_GETAUXVAL)
static const int page_size = ::getauxval(AT_PAGESZ);
#elif defined(HAVE_GETPAGESIZE)
static const int page_size = ::getpagesize();
Expand Down