Skip to content

Conversation

@brad0
Copy link
Contributor

@brad0 brad0 commented Feb 13, 2025

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.
@llvmbot llvmbot added cmake Build system in general and CMake in particular llvm:support labels Feb 13, 2025
@brad0 brad0 requested a review from lhames February 13, 2025 03:19
@llvmbot
Copy link
Member

llvmbot commented Feb 13, 2025

@llvm/pr-subscribers-llvm-support

Author: Brad Smith (brad0)

Changes

Fix 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:

  • (modified) llvm/cmake/config-ix.cmake (+1-2)
  • (modified) llvm/include/llvm/Config/config.h.cmake (+1-1)
  • (modified) llvm/lib/Support/Unix/Process.inc (+2-2)
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();

Copy link
Contributor

@lhames lhames left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks @brad0!

@brad0 brad0 merged commit 89d636b into llvm:main Feb 13, 2025
9 of 11 checks passed
@brad0 brad0 deleted the llvm_support_bsd branch February 13, 2025 03:55
@llvm-ci
Copy link
Collaborator

llvm-ci commented Feb 13, 2025

LLVM Buildbot has detected a new failure on builder lldb-aarch64-ubuntu running on linaro-lldb-aarch64-ubuntu while building llvm at step 6 "test".

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
Step 6 (test) failure: build (failure)
...
PASS: lldb-api :: functionalities/thread/concurrent_events/TestConcurrentBreakpointDelayBreakpointOneSignal.py (611 of 2089)
PASS: lldb-api :: functionalities/thread/concurrent_events/TestConcurrentCrashWithWatchpoint.py (612 of 2089)
PASS: lldb-api :: functionalities/thread/concurrent_events/TestConcurrentBreakpointsDelayedBreakpointOneWatchpoint.py (613 of 2089)
PASS: lldb-api :: functionalities/thread/concurrent_events/TestConcurrentCrashWithWatchpointBreakpointSignal.py (614 of 2089)
PASS: lldb-api :: functionalities/thread/concurrent_events/TestConcurrentDelaySignalBreak.py (615 of 2089)
PASS: lldb-api :: functionalities/progress_reporting/TestTrimmedProgressReporting.py (616 of 2089)
PASS: lldb-api :: functionalities/thread/concurrent_events/TestConcurrentDelaySignalWatch.py (617 of 2089)
PASS: lldb-api :: functionalities/thread/concurrent_events/TestConcurrentDelayWatchBreak.py (618 of 2089)
PASS: lldb-api :: functionalities/thread/concurrent_events/TestConcurrentDelayedCrashWithBreakpointSignal.py (619 of 2089)
PASS: lldb-api :: functionalities/thread/concurrent_events/TestConcurrentDelayedCrashWithBreakpointWatchpoint.py (620 of 2089)
FAIL: lldb-api :: functionalities/thread/concurrent_events/TestConcurrentManyBreakpoints.py (621 of 2089)
******************** TEST 'lldb-api :: functionalities/thread/concurrent_events/TestConcurrentManyBreakpoints.py' FAILED ********************
Script:
--
/usr/bin/python3.10 /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib --env LLVM_INCLUDE_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/include --env LLVM_TOOLS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin --arch aarch64 --build-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex --lldb-module-cache-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api --clang-module-cache-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-clang/lldb-api --executable /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/lldb --compiler /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/clang --dsymutil /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/dsymutil --make /usr/bin/gmake --llvm-tools-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin --lldb-obj-root /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/tools/lldb --lldb-libs-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/functionalities/thread/concurrent_events -p TestConcurrentManyBreakpoints.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 21.0.0git (https://github.com/llvm/llvm-project.git revision 89d636ba91924c945d39f02f261863b709249744)
  clang revision 89d636ba91924c945d39f02f261863b709249744
  llvm revision 89d636ba91924c945d39f02f261863b709249744
Skipping the following test categories: ['libc++', 'dsym', 'gmodules', 'debugserver', 'objc']

--
Command Output (stderr):
--
FAIL: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test (TestConcurrentManyBreakpoints.ConcurrentManyBreakpoints)
======================================================================
FAIL: test (TestConcurrentManyBreakpoints.ConcurrentManyBreakpoints)
   Test 100 breakpoints from 100 threads.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/decorators.py", line 148, in wrapper
    return func(*args, **kwargs)
  File "/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/functionalities/thread/concurrent_events/TestConcurrentManyBreakpoints.py", line 16, in test
    self.do_thread_actions(num_breakpoint_threads=100)
  File "/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/concurrent_base.py", line 225, in do_thread_actions
    self.assertEqual(
AssertionError: 1 != 101 : Expected to see 101 threads, but seeing 1. Details:
thread 1 running due to none at
	
Config=aarch64-/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang
----------------------------------------------------------------------
Ran 1 test in 2.931s

FAILED (failures=1)


flovent pushed a commit to flovent/llvm-project that referenced this pull request Feb 13, 2025
Fix building after a6f7cb5.

Check for the function getauxval() instead of just the sys/auxv.h
header.
@llvm-ci
Copy link
Collaborator

llvm-ci commented Feb 14, 2025

LLVM Buildbot has detected a new failure on builder lld-x86_64-win running on as-worker-93 while building llvm at step 7 "test-build-unified-tree-check-all".

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
Step 7 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM-Unit :: Support/./SupportTests.exe/38/87' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe-LLVM-Unit-11524-38-87.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=87 GTEST_SHARD_INDEX=38 C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe
--

Script:
--
C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe --gtest_filter=ProgramEnvTest.CreateProcessLongPath
--
C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp(160): error: Expected equality of these values:
  0
  RC
    Which is: -2

C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp(163): error: fs::remove(Twine(LongPath)): did not return errc::success.
error number: 13
error message: permission denied



C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp:160
Expected equality of these values:
  0
  RC
    Which is: -2

C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp:163
fs::remove(Twine(LongPath)): did not return errc::success.
error number: 13
error message: permission denied




********************


joaosaffran pushed a commit to joaosaffran/llvm-project that referenced this pull request Feb 14, 2025
Fix building after a6f7cb5.

Check for the function getauxval() instead of just the sys/auxv.h
header.
sivan-shani pushed a commit to sivan-shani/llvm-project that referenced this pull request Feb 24, 2025
Fix building after a6f7cb5.

Check for the function getauxval() instead of just the sys/auxv.h
header.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cmake Build system in general and CMake in particular llvm:support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants