-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[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
Conversation
Fix building after a6f7cb5. Check for the function getauxval() instead of just the sys/auxv.h header.
@llvm/pr-subscribers-llvm-support Author: Brad Smith (brad0) ChangesFix building after a6f7cb5. Check for the function getauxval() instead of just the sys/auxv.h header. Full diff: https://github.com/llvm/llvm-project/pull/127005.diff 3 Files Affected:
diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake
index e2f14398fd857..c128fd2ed125c 100644
--- a/llvm/cmake/config-ix.cmake
+++ b/llvm/cmake/config-ix.cmake
@@ -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)
@@ -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)
@@ -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
diff --git a/llvm/include/llvm/Config/config.h.cmake b/llvm/include/llvm/Config/config.h.cmake
index d4f5935b245b7..835201f2a45b0 100644
--- a/llvm/include/llvm/Config/config.h.cmake
+++ b/llvm/include/llvm/Config/config.h.cmake
@@ -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
diff --git a/llvm/lib/Support/Unix/Process.inc b/llvm/lib/Support/Unix/Process.inc
index 43509190fccfb..b5c3719f57963 100644
--- a/llvm/lib/Support/Unix/Process.inc
+++ b/llvm/lib/Support/Unix/Process.inc
@@ -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
@@ -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();
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks @brad0!
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/59/builds/12681 Here is the relevant piece of the build log for the reference
|
Fix building after a6f7cb5. Check for the function getauxval() instead of just the sys/auxv.h header.
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/146/builds/2285 Here is the relevant piece of the build log for the reference
|
Fix building after a6f7cb5. Check for the function getauxval() instead of just the sys/auxv.h header.
Fix building after a6f7cb5. Check for the function getauxval() instead of just the sys/auxv.h header.
Fix building after a6f7cb5.
Check for the function getauxval() instead of just the sys/auxv.h header.