Skip to content

Conversation

SchrodingerZhu
Copy link
Contributor

@SchrodingerZhu SchrodingerZhu commented Oct 7, 2025

Closes #153666

This patch introduces a new centralized AUXV (auxiliary vector) handling
mechanism for LLVM libc on Linux, replacing the previous scattered
implementation across multiple files.

Key Changes:

New Files:

  • libc/src/__support/OSUtil/linux/auxv.h: New header library providing
    a clean interface for AUXV access with:
    • auxv::Entry struct for AUXV entries (type and value)
    • auxv::Vector class with iterator support for traversing AUXV
    • auxv::get() function for retrieving specific AUXV values
    • Thread-safe initialization with fallback mechanisms (prctl and /proc/self/auxv)

Modified Files:

  1. libc/src/__support/OSUtil/linux/CMakeLists.txt:

    • Added auxv header library declaration with proper dependencies:
      • libc.hdr.fcntl_macros
      • libc.src.__support.OSUtil.osutil
      • libc.src.__support.common
      • libc.src.__support.CPP.optional
      • libc.src.__support.threads.callonce
  2. libc/config/linux/app.h:

    • Removed AuxEntry struct (moved to auxv.h as auxv::Entry)
    • Removed auxv_ptr from AppProperties struct
    • Simplified application properties structure
  3. libc/src/sys/auxv/linux/getauxval.cpp:

    • Completely refactored to use new auxv.h interface
    • Removed ~200 lines of complex initialization code
    • Simplified to just call auxv::get() function
    • Removed dependencies to external symbols (mman, prctl, fcntl, read, close, open)
  4. libc/src/sys/auxv/linux/CMakeLists.txt:

    • Updated dependencies to use new auxv header library
    • Removed dependencies to external symbols (prctl, mman, fcntl, unistd, etc.)
  5. libc/startup/linux/do_start.cpp:

    • Updated to use new auxv::Vector interface
    • Changed from pointer-based to iterator-based AUXV traversal
    • Updated field names (aux_entry->idaux_entry.type, aux_entry->valueaux_entry.val)
    • Added call to auxv::Vector::initialize_unsafe() for early AUXV setup
  6. libc/startup/linux/CMakeLists.txt:

    • Added dependency on libc.src.__support.OSUtil.linux.auxv

This patch introduces a new centralized AUXV (auxiliary vector) handling
mechanism for LLVM libc on Linux, replacing the previous scattered
implementation across multiple files.

## Key Changes:

### New Files:
- **libc/src/__support/OSUtil/linux/auxv.h**: New header library providing
  a clean interface for AUXV access with:
  - `auxv::Entry` struct for AUXV entries (type and value)
  - `auxv::Vector` class with iterator support for traversing AUXV
  - `auxv::get()` function for retrieving specific AUXV values
  - Thread-safe initialization with fallback mechanisms (prctl and /proc/self/auxv)

### Modified Files:

1. **libc/src/__support/OSUtil/linux/CMakeLists.txt**:
   - Added `auxv` header library declaration with proper dependencies:
     - libc.hdr.fcntl_macros
     - libc.src.__support.OSUtil.osutil
     - libc.src.__support.common
     - libc.src.__support.CPP.optional
     - libc.src.__support.threads.callonce

2. **libc/config/linux/app.h**:
   - Removed `AuxEntry` struct (moved to auxv.h as `auxv::Entry`)
   - Removed `auxv_ptr` from `AppProperties` struct
   - Simplified application properties structure

3. **libc/src/sys/auxv/linux/getauxval.cpp**:
   - Completely refactored to use new auxv.h interface
   - Removed ~200 lines of complex initialization code
   - Simplified to just call `auxv::get()` function
   - Removed dependencies to external symbols (mman, prctl, fcntl, read, close, open)

4. **libc/src/sys/auxv/linux/CMakeLists.txt**:
   - Updated dependencies to use new auxv header library
   - Removed dependencies to external symbols (prctl, mman, fcntl, unistd, etc.)

5. **libc/startup/linux/do_start.cpp**:
   - Updated to use new `auxv::Vector` interface
   - Changed from pointer-based to iterator-based AUXV traversal
   - Updated field names (`aux_entry->id` → `aux_entry.type`, `aux_entry->value` → `aux_entry.val`)
   - Added call to `auxv::Vector::initialize_unsafe()` for early AUXV setup

6. **libc/startup/linux/CMakeLists.txt**:
   - Added dependency on `libc.src.__support.OSUtil.linux.auxv`
@llvmbot llvmbot added the libc label Oct 7, 2025
@llvmbot
Copy link
Member

llvmbot commented Oct 7, 2025

@llvm/pr-subscribers-libc

Author: Schrodinger ZHU Yifan (SchrodingerZhu)

Changes

This patch introduces a new centralized AUXV (auxiliary vector) handling
mechanism for LLVM libc on Linux, replacing the previous scattered
implementation across multiple files.

Key Changes:

New Files:

  • libc/src/__support/OSUtil/linux/auxv.h: New header library providing
    a clean interface for AUXV access with:
    • auxv::Entry struct for AUXV entries (type and value)
    • auxv::Vector class with iterator support for traversing AUXV
    • auxv::get() function for retrieving specific AUXV values
    • Thread-safe initialization with fallback mechanisms (prctl and /proc/self/auxv)

Modified Files:

  1. libc/src/__support/OSUtil/linux/CMakeLists.txt:

    • Added auxv header library declaration with proper dependencies:
      • libc.hdr.fcntl_macros
      • libc.src.__support.OSUtil.osutil
      • libc.src.__support.common
      • libc.src.__support.CPP.optional
      • libc.src.__support.threads.callonce
  2. libc/config/linux/app.h:

    • Removed AuxEntry struct (moved to auxv.h as auxv::Entry)
    • Removed auxv_ptr from AppProperties struct
    • Simplified application properties structure
  3. libc/src/sys/auxv/linux/getauxval.cpp:

    • Completely refactored to use new auxv.h interface
    • Removed ~200 lines of complex initialization code
    • Simplified to just call auxv::get() function
    • Removed dependencies to external symbols (mman, prctl, fcntl, read, close, open)
  4. libc/src/sys/auxv/linux/CMakeLists.txt:

    • Updated dependencies to use new auxv header library
    • Removed dependencies to external symbols (prctl, mman, fcntl, unistd, etc.)
  5. libc/startup/linux/do_start.cpp:

    • Updated to use new auxv::Vector interface
    • Changed from pointer-based to iterator-based AUXV traversal
    • Updated field names (aux_entry->idaux_entry.type, aux_entry->valueaux_entry.val)
    • Added call to auxv::Vector::initialize_unsafe() for early AUXV setup
  6. libc/startup/linux/CMakeLists.txt:

    • Added dependency on libc.src.__support.OSUtil.linux.auxv

Full diff: https://github.com/llvm/llvm-project/pull/162326.diff

7 Files Affected:

  • (modified) libc/config/linux/app.h (-14)
  • (modified) libc/src/__support/OSUtil/linux/CMakeLists.txt (+12)
  • (added) libc/src/__support/OSUtil/linux/auxv.h (+145)
  • (modified) libc/src/sys/auxv/linux/CMakeLists.txt (+2-11)
  • (modified) libc/src/sys/auxv/linux/getauxval.cpp (+5-218)
  • (modified) libc/startup/linux/CMakeLists.txt (+1)
  • (modified) libc/startup/linux/do_start.cpp (+9-6)
diff --git a/libc/config/linux/app.h b/libc/config/linux/app.h
index f3d11da9fc14c..11ac6ee51e5a0 100644
--- a/libc/config/linux/app.h
+++ b/libc/config/linux/app.h
@@ -35,17 +35,6 @@ struct TLSImage {
   uintptr_t align;
 };
 
-// Linux manpage on `proc(5)` says that the aux vector is an array of
-// unsigned long pairs.
-// (see: https://man7.org/linux/man-pages/man5/proc.5.html)
-using AuxEntryType = unsigned long;
-// Using the naming convention from `proc(5)`.
-// TODO: Would be nice to use the aux entry structure from elf.h when available.
-struct AuxEntry {
-  AuxEntryType id;
-  AuxEntryType value;
-};
-
 struct Args {
   uintptr_t argc;
 
@@ -70,9 +59,6 @@ struct AppProperties {
 
   // Environment data.
   uintptr_t *env_ptr;
-
-  // Auxiliary vector data.
-  AuxEntry *auxv_ptr;
 };
 
 [[gnu::weak]] extern AppProperties app;
diff --git a/libc/src/__support/OSUtil/linux/CMakeLists.txt b/libc/src/__support/OSUtil/linux/CMakeLists.txt
index f303e54ce7b3b..f6377ca9ff5a2 100644
--- a/libc/src/__support/OSUtil/linux/CMakeLists.txt
+++ b/libc/src/__support/OSUtil/linux/CMakeLists.txt
@@ -24,6 +24,18 @@ add_object_library(
     libc.include.sys_syscall
 )
 
+add_header_library(
+  auxv
+  HDRS
+    auxv.h
+  DEPENDS
+    libc.hdr.fcntl_macros
+    libc.src.__support.OSUtil.osutil
+    libc.src.__support.common
+    libc.src.__support.CPP.optional
+    libc.src.__support.threads.callonce
+)
+
 add_header_library(
   getrandom
   HDRS
diff --git a/libc/src/__support/OSUtil/linux/auxv.h b/libc/src/__support/OSUtil/linux/auxv.h
new file mode 100644
index 0000000000000..e12add62a011d
--- /dev/null
+++ b/libc/src/__support/OSUtil/linux/auxv.h
@@ -0,0 +1,145 @@
+//===------------- Linux AUXV Header --------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_OSUTIL_LINUX_AUXV_H
+#define LLVM_LIBC_SRC___SUPPORT_OSUTIL_LINUX_AUXV_H
+
+#include "hdr/fcntl_macros.h" // For open flags
+#include "src/__support/OSUtil/syscall.h"
+#include "src/__support/common.h"
+#include "src/__support/threads/callonce.h"
+
+#include <linux/auxvec.h> // For AT_ macros
+#include <linux/mman.h>   // For mmap flags
+#include <linux/prctl.h>  // For prctl
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace auxv {
+struct Entry {
+  unsigned long type; // Entry type
+  unsigned long val;  // Integer value
+};
+
+class Vector {
+  LIBC_INLINE_VAR static constexpr Entry END = {AT_NULL, AT_NULL};
+  LIBC_INLINE_VAR static const Entry *entries = &END;
+  LIBC_INLINE_VAR static CallOnceFlag init_flag = callonce_impl::NOT_CALLED;
+  LIBC_INLINE_VAR constexpr static size_t FALLBACK_AUXV_ENTRIES = 64;
+
+  LIBC_INLINE static void fallback_initialize_unsync();
+  LIBC_INLINE static const Entry *get_entries() {
+    if (LIBC_LIKELY(entries != &END))
+      return entries;
+    callonce(&init_flag, fallback_initialize_unsync);
+    return entries;
+  }
+
+public:
+  class Iterator {
+    const Entry *current;
+
+  public:
+    LIBC_INLINE explicit Iterator(const Entry *entry) : current(entry) {}
+    LIBC_INLINE Iterator &operator++() {
+      ++current;
+      return *this;
+    }
+    LIBC_INLINE const Entry &operator*() const { return *current; }
+    LIBC_INLINE bool operator!=(const Iterator &other) const {
+      return current->type != other.current->type;
+    }
+    LIBC_INLINE bool operator==(const Iterator &other) const {
+      return current->type == other.current->type;
+    }
+  };
+  using iterator = Iterator;
+  LIBC_INLINE static Iterator begin() { return Iterator(get_entries()); }
+  LIBC_INLINE static Iterator end() { return Iterator(&END); }
+  LIBC_INLINE static void initialize_unsafe(const Entry *auxv);
+};
+
+// Initializes the auxv entries.
+// This function is intended to be called once inside crt0.
+LIBC_INLINE void Vector::initialize_unsafe(const Entry *auxv) {
+  init_flag = callonce_impl::FINISH;
+  entries = auxv;
+}
+
+// When CRT0 does not setup the global array, this function is called.
+// As its name suggests, this function is not thread-safe and should be
+// backed by a callonce guard.
+// This initialize routine will do a mmap to allocate a memory region.
+// Since auxv tends to live throughout the program lifetime, we do not
+// munmap it.
+LIBC_INLINE void Vector::fallback_initialize_unsync() {
+  constexpr size_t AUXV_MMAP_SIZE = FALLBACK_AUXV_ENTRIES * sizeof(Entry);
+  long mmap_ret = syscall_impl<long>(SYS_mmap, nullptr, AUXV_MMAP_SIZE,
+                                     PROT_READ | PROT_WRITE,
+                                     MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+  // We do not proceed if mmap fails.
+  if (mmap_ret <= 0)
+    return;
+
+  // Initialize the auxv array with AT_NULL entries.
+  Entry *vector = reinterpret_cast<Entry *>(mmap_ret);
+  for (size_t i = 0; i < FALLBACK_AUXV_ENTRIES; ++i) {
+    vector[i].type = AT_NULL;
+    vector[i].val = AT_NULL;
+  }
+  size_t avaiable_size = AUXV_MMAP_SIZE - sizeof(Entry);
+
+  // Attempt 1: use PRCTL to get the auxv.
+  // We guarantee that the vector is always padded with AT_NULL entries.
+  long prctl_ret = syscall_impl<long>(SYS_prctl, PR_GET_AUXV,
+                                      reinterpret_cast<unsigned long>(vector),
+                                      avaiable_size, 0, 0);
+  if (prctl_ret >= 0) {
+    entries = vector;
+    return;
+  }
+
+  // Attempt 2: read /proc/self/auxv.
+  int fd = syscall_impl<int>(SYS_open, "/proc/self/auxv", O_RDONLY | O_CLOEXEC);
+  if (fd < 0) {
+    syscall_impl<long>(SYS_munmap, vector, AUXV_MMAP_SIZE);
+    return;
+  }
+  uint8_t *cursor = reinterpret_cast<uint8_t *>(vector);
+  bool has_error = false;
+  while (avaiable_size != 0) {
+    long bytes_read = syscall_impl<long>(SYS_read, fd, cursor, avaiable_size);
+    if (bytes_read <= 0) {
+      if (bytes_read == -EINTR)
+        continue;
+      has_error = bytes_read < 0;
+      break;
+    }
+    avaiable_size -= bytes_read;
+    cursor += bytes_read;
+  }
+  syscall_impl<long>(SYS_close, fd);
+  if (has_error) {
+    syscall_impl<long>(SYS_munmap, vector, AUXV_MMAP_SIZE);
+    return;
+  }
+  entries = vector;
+}
+
+LIBC_INLINE cpp::optional<unsigned long> get(unsigned long type) {
+  Vector auxvec;
+  for (const auto &entry : auxvec) {
+    if (entry.type == type)
+      return entry.val;
+  }
+  return cpp::nullopt;
+}
+} // namespace auxv
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_OSUTIL_LINUX_AUXV_H
diff --git a/libc/src/sys/auxv/linux/CMakeLists.txt b/libc/src/sys/auxv/linux/CMakeLists.txt
index 4884184cc6053..39cfb7ba3f7ee 100644
--- a/libc/src/sys/auxv/linux/CMakeLists.txt
+++ b/libc/src/sys/auxv/linux/CMakeLists.txt
@@ -5,15 +5,6 @@ add_entrypoint_object(
   HDRS
     ../getauxval.h
   DEPENDS
-    libc.src.sys.prctl.prctl
-    libc.src.sys.mman.mmap
-    libc.src.sys.mman.munmap
-    libc.src.__support.threads.callonce
-    libc.src.__support.common
-    libc.src.errno.errno
-    libc.config.app_h
-    libc.src.fcntl.open
-    libc.src.unistd.read
-    libc.src.unistd.close
-    libc.include.sys_auxv
+    libc.src.__support.OSUtil.linux.auxv
+    libc.src.__support.libc_errno
 )
diff --git a/libc/src/sys/auxv/linux/getauxval.cpp b/libc/src/sys/auxv/linux/getauxval.cpp
index b50c5845bcc2b..52d5a988a9494 100644
--- a/libc/src/sys/auxv/linux/getauxval.cpp
+++ b/libc/src/sys/auxv/linux/getauxval.cpp
@@ -7,227 +7,14 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/sys/auxv/getauxval.h"
-#include "config/app.h"
-#include "hdr/fcntl_macros.h"
-#include "src/__support/OSUtil/fcntl.h"
-#include "src/__support/common.h"
+#include "src/__support/OSUtil/linux/auxv.h"
 #include "src/__support/libc_errno.h"
-#include "src/__support/macros/config.h"
-#include <linux/auxvec.h>
-
-// for guarded initialization
-#include "src/__support/threads/callonce.h"
-#include "src/__support/threads/linux/futex_word.h"
-
-// -----------------------------------------------------------------------------
-// TODO: This file should not include other public libc functions. Calling other
-// public libc functions is an antipattern within LLVM-libc. This needs to be
-// cleaned up. DO NOT COPY THIS.
-// -----------------------------------------------------------------------------
-
-// for mallocing the global auxv
-#include "src/sys/mman/mmap.h"
-#include "src/sys/mman/munmap.h"
-
-// for reading /proc/self/auxv
-#include "src/sys/prctl/prctl.h"
-#include "src/unistd/read.h"
-
-// getauxval will work either with or without __cxa_atexit support.
-// In order to detect if __cxa_atexit is supported, we define a weak symbol.
-// We prefer __cxa_atexit as it is always defined as a C symbol whileas atexit
-// may not be created via objcopy yet. Also, for glibc, atexit is provided via
-// libc_nonshared.a rather than libc.so. So, it is may not be made ready for
-// overlay builds.
-extern "C" [[gnu::weak]] int __cxa_atexit(void (*callback)(void *),
-                                          void *payload, void *);
 
 namespace LIBC_NAMESPACE_DECL {
-
-constexpr static size_t MAX_AUXV_ENTRIES = 64;
-
-// Helper to recover or set errno
-class AuxvErrnoGuard {
-public:
-  AuxvErrnoGuard() : saved(libc_errno), failure(false) {}
-  ~AuxvErrnoGuard() { libc_errno = failure ? ENOENT : saved; }
-  void mark_failure() { failure = true; }
-
-private:
-  int saved;
-  bool failure;
-};
-
-// Helper to manage the memory
-static AuxEntry *auxv = nullptr;
-
-class AuxvMMapGuard {
-public:
-  constexpr static size_t AUXV_MMAP_SIZE = sizeof(AuxEntry) * MAX_AUXV_ENTRIES;
-
-  AuxvMMapGuard()
-      : ptr(LIBC_NAMESPACE::mmap(nullptr, AUXV_MMAP_SIZE,
-                                 PROT_READ | PROT_WRITE,
-                                 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0)) {}
-  ~AuxvMMapGuard() {
-    if (ptr != MAP_FAILED)
-      LIBC_NAMESPACE::munmap(ptr, AUXV_MMAP_SIZE);
-  }
-  void submit_to_global() {
-    // atexit may fail, we do not set it to global in that case.
-    int ret = __cxa_atexit(
-        [](void *) {
-          LIBC_NAMESPACE::munmap(auxv, AUXV_MMAP_SIZE);
-          auxv = nullptr;
-        },
-        nullptr, nullptr);
-
-    if (ret != 0)
-      return;
-
-    auxv = reinterpret_cast<AuxEntry *>(ptr);
-    ptr = MAP_FAILED;
-  }
-  bool allocated() const { return ptr != MAP_FAILED; }
-  void *get() const { return ptr; }
-
-private:
-  void *ptr;
-};
-
-class AuxvFdGuard {
-public:
-  AuxvFdGuard() {
-    auto result = internal::open("/proc/self/auxv", O_RDONLY | O_CLOEXEC);
-    if (!result.has_value())
-      fd = -1;
-
-    fd = result.value();
-  }
-  ~AuxvFdGuard() {
-    if (fd != -1)
-      internal::close(fd);
-  }
-  bool valid() const { return fd != -1; }
-  int get() const { return fd; }
-
-private:
-  int fd;
-};
-
-static void initialize_auxv_once(void) {
-  // If we cannot get atexit, we cannot register the cleanup function.
-  if (&__cxa_atexit == nullptr)
-    return;
-
-  AuxvMMapGuard mmap_guard;
-  if (!mmap_guard.allocated())
-    return;
-  auto *ptr = reinterpret_cast<AuxEntry *>(mmap_guard.get());
-
-  // We get one less than the max size to make sure the search always
-  // terminates. MMAP private pages are zeroed out already.
-  size_t available_size = AuxvMMapGuard::AUXV_MMAP_SIZE - sizeof(AuxEntryType);
-  // PR_GET_AUXV is only available on Linux kernel 6.1 and above. If this is not
-  // defined, we direcly fall back to reading /proc/self/auxv. In case the libc
-  // is compiled and run on separate kernels, we also check the return value of
-  // prctl.
-#ifdef PR_GET_AUXV
-  int ret = prctl(PR_GET_AUXV, reinterpret_cast<unsigned long>(ptr),
-                  available_size, 0, 0);
-  if (ret >= 0) {
-    mmap_guard.submit_to_global();
-    return;
-  }
-#endif
-  AuxvFdGuard fd_guard;
-  if (!fd_guard.valid())
-    return;
-  auto *buf = reinterpret_cast<char *>(ptr);
-  libc_errno = 0;
-  bool error_detected = false;
-  // Read until we use up all the available space or we finish reading the file.
-  while (available_size != 0) {
-    ssize_t bytes_read =
-        LIBC_NAMESPACE::read(fd_guard.get(), buf, available_size);
-    if (bytes_read <= 0) {
-      if (libc_errno == EINTR)
-        continue;
-      // Now, we either have an non-recoverable error or we have reached the end
-      // of the file. Mark `error_detected` accordingly.
-      if (bytes_read == -1)
-        error_detected = true;
-      break;
-    }
-    buf += bytes_read;
-    available_size -= bytes_read;
-  }
-  // If we get out of the loop without an error, the auxv is ready.
-  if (!error_detected)
-    mmap_guard.submit_to_global();
-}
-
-static AuxEntry read_entry(int fd) {
-  AuxEntry buf;
-  size_t size = sizeof(AuxEntry);
-  char *ptr = reinterpret_cast<char *>(&buf);
-  while (size > 0) {
-    ssize_t ret = LIBC_NAMESPACE::read(fd, ptr, size);
-    if (ret < 0) {
-      if (libc_errno == EINTR)
-        continue;
-      // Error detected, return AT_NULL
-      buf.id = AT_NULL;
-      buf.value = AT_NULL;
-      break;
-    }
-    ptr += ret;
-    size -= ret;
-  }
-  return buf;
-}
-
 LLVM_LIBC_FUNCTION(unsigned long, getauxval, (unsigned long id)) {
-  // Fast path when libc is loaded by its own initialization code. In this case,
-  // app.auxv_ptr is already set to the auxv passed on the initial stack of the
-  // process.
-  AuxvErrnoGuard errno_guard;
-
-  auto search_auxv = [&errno_guard](AuxEntry *auxv,
-                                    unsigned long id) -> AuxEntryType {
-    for (auto *ptr = auxv; ptr->id != AT_NULL; ptr++)
-      if (ptr->id == id)
-        return ptr->value;
-
-    errno_guard.mark_failure();
-    return AT_NULL;
-  };
-
-  // App is a weak symbol that is only defined if libc is linked to its own
-  // initialization routine. We need to check if it is null.
-  if (&app != nullptr)
-    return search_auxv(app.auxv_ptr, id);
-
-  static FutexWordType once_flag;
-  LIBC_NAMESPACE::callonce(reinterpret_cast<CallOnceFlag *>(&once_flag),
-                           initialize_auxv_once);
-  if (auxv != nullptr)
-    return search_auxv(auxv, id);
-
-  // Fallback to use read without mmap
-  AuxvFdGuard fd_guard;
-  if (fd_guard.valid()) {
-    while (true) {
-      AuxEntry buf = read_entry(fd_guard.get());
-      if (buf.id == AT_NULL)
-        break;
-      if (buf.id == id)
-        return buf.value;
-    }
-  }
-
-  // cannot find the entry after all methods, mark failure and return 0
-  errno_guard.mark_failure();
-  return AT_NULL;
+  if (cpp::optional<unsigned long> val = auxv::get(id))
+    return *val;
+  libc_errno = ENOENT;
+  return 0;
 }
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/startup/linux/CMakeLists.txt b/libc/startup/linux/CMakeLists.txt
index 7af1819c57c17..df2c4b9ec508c 100644
--- a/libc/startup/linux/CMakeLists.txt
+++ b/libc/startup/linux/CMakeLists.txt
@@ -105,6 +105,7 @@ add_object_library(
     libc.src.stdlib.exit
     libc.src.stdlib.atexit
     libc.src.unistd.environ
+    libc.src.__support.OSUtil.linux.auxv
   COMPILE_OPTIONS
     -ffreestanding       # To avoid compiler warnings about calling the main function.
     -fno-builtin         # avoid emit unexpected calls
diff --git a/libc/startup/linux/do_start.cpp b/libc/startup/linux/do_start.cpp
index 94c4ec7092861..a67bf188b1ae3 100644
--- a/libc/startup/linux/do_start.cpp
+++ b/libc/startup/linux/do_start.cpp
@@ -9,6 +9,7 @@
 #include "config/linux/app.h"
 #include "hdr/stdint_proxy.h"
 #include "include/llvm-libc-macros/link-macros.h"
+#include "src/__support/OSUtil/linux/auxv.h"
 #include "src/__support/OSUtil/syscall.h"
 #include "src/__support/macros/config.h"
 #include "src/__support/threads/thread.h"
@@ -88,17 +89,19 @@ void teardown_main_tls() { cleanup_tls(tls.addr, tls.size); }
   // denoted by an AT_NULL entry.
   ElfW(Phdr) *program_hdr_table = nullptr;
   uintptr_t program_hdr_count = 0;
-  app.auxv_ptr = reinterpret_cast<AuxEntry *>(env_end_marker + 1);
-  for (auto *aux_entry = app.auxv_ptr; aux_entry->id != AT_NULL; ++aux_entry) {
-    switch (aux_entry->id) {
+  auxv::Vector::initialize_unsafe(
+      reinterpret_cast<const auxv::Entry *>(env_end_marker + 1));
+  auxv::Vector auxvec;
+  for (const auto &aux_entry : auxvec) {
+    switch (aux_entry.type) {
     case AT_PHDR:
-      program_hdr_table = reinterpret_cast<ElfW(Phdr) *>(aux_entry->value);
+      program_hdr_table = reinterpret_cast<ElfW(Phdr) *>(aux_entry.val);
       break;
     case AT_PHNUM:
-      program_hdr_count = aux_entry->value;
+      program_hdr_count = aux_entry.val;
       break;
     case AT_PAGESZ:
-      app.page_size = aux_entry->value;
+      app.page_size = aux_entry.val;
       break;
     default:
       break; // TODO: Read other useful entries from the aux vector.

@SchrodingerZhu SchrodingerZhu merged commit 0db5ba0 into llvm:main Oct 8, 2025
19 checks passed
@SchrodingerZhu SchrodingerZhu deleted the libc-refact-auxv branch October 8, 2025 14:00
@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 8, 2025

LLVM Buildbot has detected a new failure on builder libc-aarch64-ubuntu-dbg running on libc-aarch64-ubuntu while building libc at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/104/builds/33019

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py ...' (failure)
...
-- Set CPU features: FullFP16
-- Compiler features available: builtin_ceil_floor_rint_trunc;builtin_fmax_fmin;builtin_fmaxf16_fminf16;builtin_round;cfloat128;float128;float16
-- Using getrandom for hashtable randomness
-- check-runtimes does nothing.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu/build
@@@BUILD_STEP build libc@@@
Running: ninja libc
[1/2] Building CXX object libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o
FAILED: libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o 
/usr/bin/clang++ -DLIBC_NAMESPACE=__llvm_libc_20_0_0_git -D_DEBUG -I/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu/llvm-project/libc -isystem libc/include -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wstring-conversion -fdiagnostics-color -g -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -DLIBC_ADD_NULL_CHECKS -DLIBC_ERRNO_MODE=LIBC_ERRNO_MODE_DEFAULT -DLIBC_THREAD_MODE=LIBC_THREAD_MODE_PLATFORM -fpie -fno-builtin -fno-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -Wdeprecated -Wno-c99-extensions -Wno-gnu-imaginary-constant -Wno-pedantic -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wstrict-prototypes -Wthread-safety -Wglobal-constructors -DLIBC_COPT_PUBLIC_PACKAGING -std=gnu++17 -MD -MT libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o -MF libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o.d -o libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o -c /home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu/llvm-project/libc/src/sys/auxv/linux/getauxval.cpp
In file included from /home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu/llvm-project/libc/src/sys/auxv/linux/getauxval.cpp:10:
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu/llvm-project/libc/src/__support/OSUtil/linux/auxv.h:101:50: error: use of undeclared identifier 'PR_GET_AUXV'
  long prctl_ret = syscall_impl<long>(SYS_prctl, PR_GET_AUXV,
                                                 ^
1 error generated.
ninja: build stopped: subcommand failed.
['ninja', 'libc'] exited with return code 1.
The build step threw an exception...
Traceback (most recent call last):
  File "../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 181, in step
    yield
  File "../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 143, in main
    run_command(['ninja', 'libc'])
  File "../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 196, in run_command
    util.report_run_cmd(cmd, cwd=directory)
  File "/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu/llvm-zorg/zorg/buildbot/builders/annotated/util.py", line 49, in report_run_cmd
    subprocess.check_call(cmd, shell=shell, *args, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 190, in check_call
    raise CalledProcessError(retcode, cmd)
CalledProcessError: Command '['ninja', 'libc']' returned non-zero exit status 1
@@@STEP_FAILURE@@@
@@@BUILD_STEP libc-unit-tests@@@
Running: ninja libc-unit-tests
[1/1167] Running unit test libc.test.src.stdio.vsnprintf_test.__unit__
[==========] Running 2 tests from 1 test suite.
[ RUN      ] LlvmLibcVSNPrintfTest.CutOff
[       OK ] LlvmLibcVSNPrintfTest.CutOff (15 us)
[ RUN      ] LlvmLibcVSNPrintfTest.NoCutOff
[       OK ] LlvmLibcVSNPrintfTest.NoCutOff (4 us)
Ran 2 tests.  PASS: 2  FAIL: 0
[2/1167] Running unit test libc.test.src.stdio.vsprintf_test.__unit__
[==========] Running 3 tests from 1 test suite.
[ RUN      ] LlvmLibcVSPrintfTest.SimpleNoConv
[       OK ] LlvmLibcVSPrintfTest.SimpleNoConv (6 us)
[ RUN      ] LlvmLibcVSPrintfTest.PercentConv
[       OK ] LlvmLibcVSPrintfTest.PercentConv (5 us)
[ RUN      ] LlvmLibcVSPrintfTest.CharConv

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 8, 2025

LLVM Buildbot has detected a new failure on builder libc-aarch64-ubuntu-fullbuild-dbg running on libc-aarch64-ubuntu while building libc at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/71/builds/32997

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py ...' (failure)
...
-- For aarch64 builtins preferring aarch64/fp_mode.c to fp_mode.c
-- check-runtimes does nothing.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/build
@@@BUILD_STEP build libc@@@
Running: ninja libc
[1/12] Building CXX object libc/startup/linux/aarch64/CMakeFiles/libc.startup.linux.aarch64.start.dir/start.cpp.o
[2/12] Building CXX object libc/src/stdlib/CMakeFiles/libc.src.stdlib.getenv.dir/getenv.cpp.o
[3/12] Building CXX object libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o
FAILED: libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o 
/usr/bin/clang++ -DLIBC_NAMESPACE=__llvm_libc_20_0_0_git -D_DEBUG -I/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc -isystem libc/include -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wstring-conversion -fdiagnostics-color -g -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -DLIBC_ADD_NULL_CHECKS -DLIBC_ERRNO_MODE=LIBC_ERRNO_MODE_DEFAULT -DLIBC_THREAD_MODE=LIBC_THREAD_MODE_PLATFORM -fpie -ffreestanding -DLIBC_FULL_BUILD -nostdlibinc -idirafter/usr/include -fno-builtin -fno-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -Wdeprecated -Wno-c99-extensions -Wno-gnu-imaginary-constant -Wno-pedantic -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wstrict-prototypes -Wthread-safety -Wglobal-constructors -DLIBC_COPT_PUBLIC_PACKAGING -std=gnu++17 -MD -MT libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o -MF libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o.d -o libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o -c /home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/src/sys/auxv/linux/getauxval.cpp
In file included from /home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/src/sys/auxv/linux/getauxval.cpp:10:
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/src/__support/OSUtil/linux/auxv.h:101:50: error: use of undeclared identifier 'PR_GET_AUXV'
  long prctl_ret = syscall_impl<long>(SYS_prctl, PR_GET_AUXV,
                                                 ^
1 error generated.
[4/12] Building CXX object libc/src/threads/CMakeFiles/libc.src.threads.call_once.dir/call_once.cpp.o
[5/12] Building CXX object libc/src/pthread/CMakeFiles/libc.src.pthread.pthread_once.dir/pthread_once.cpp.o
[6/12] Building CXX object libc/src/__support/time/linux/CMakeFiles/libc.src.__support.time.linux.clock_gettime.dir/clock_gettime.cpp.o
[7/12] Building CXX object libc/startup/linux/CMakeFiles/libc.startup.linux.do_start.dir/do_start.cpp.o
FAILED: libc/startup/linux/CMakeFiles/libc.startup.linux.do_start.dir/do_start.cpp.o 
/usr/bin/clang++ -DLIBC_NAMESPACE=__llvm_libc_20_0_0_git -D_DEBUG -I/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc -isystem libc/include -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wstring-conversion -fdiagnostics-color -g -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -DLIBC_ADD_NULL_CHECKS -DLIBC_ERRNO_MODE=LIBC_ERRNO_MODE_DEFAULT -DLIBC_THREAD_MODE=LIBC_THREAD_MODE_PLATFORM -fpie -ffreestanding -DLIBC_FULL_BUILD -nostdlibinc -idirafter/usr/include -fno-builtin -fno-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -Wdeprecated -Wno-c99-extensions -Wno-gnu-imaginary-constant -Wno-pedantic -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wstrict-prototypes -Wthread-safety -Wglobal-constructors -fno-stack-protector -DLIBC_COPT_RAW_MUTEX_DEFAULT_SPIN_COUNT=100 -DLIBC_COPT_TIMEOUT_ENSURE_MONOTONICITY=1 -std=gnu++17 -MD -MT libc/startup/linux/CMakeFiles/libc.startup.linux.do_start.dir/do_start.cpp.o -MF libc/startup/linux/CMakeFiles/libc.startup.linux.do_start.dir/do_start.cpp.o.d -o libc/startup/linux/CMakeFiles/libc.startup.linux.do_start.dir/do_start.cpp.o -c /home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/startup/linux/do_start.cpp
In file included from /home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/startup/linux/do_start.cpp:12:
/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-project/libc/src/__support/OSUtil/linux/auxv.h:101:50: error: use of undeclared identifier 'PR_GET_AUXV'
  long prctl_ret = syscall_impl<long>(SYS_prctl, PR_GET_AUXV,
                                                 ^
1 error generated.
[8/12] Building CXX object libc/src/__support/OSUtil/linux/CMakeFiles/libc.src.__support.OSUtil.linux.vdso.dir/vdso.cpp.o
[9/12] Building CXX object libc/startup/linux/aarch64/CMakeFiles/libc.startup.linux.aarch64.tls.dir/tls.cpp.o
[10/12] Building CXX object libc/src/__support/threads/linux/CMakeFiles/libc.src.__support.threads.linux.thread.dir/thread.cpp.o
ninja: build stopped: subcommand failed.
['ninja', 'libc'] exited with return code 1.
The build step threw an exception...
Traceback (most recent call last):
  File "../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 181, in step
    yield
  File "../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 143, in main
    run_command(['ninja', 'libc'])
  File "../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 196, in run_command
    util.report_run_cmd(cmd, cwd=directory)
  File "/home/libc-buildbot/libc-aarch64-ubuntu/libc-aarch64-ubuntu-fullbuild-dbg/llvm-zorg/zorg/buildbot/builders/annotated/util.py", line 49, in report_run_cmd
    subprocess.check_call(cmd, shell=shell, *args, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 190, in check_call
    raise CalledProcessError(retcode, cmd)
CalledProcessError: Command '['ninja', 'libc']' returned non-zero exit status 1
@@@STEP_FAILURE@@@
@@@BUILD_STEP build libc-startup@@@
Running: ninja libc-startup

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 8, 2025

LLVM Buildbot has detected a new failure on builder libc-x86_64-debian-gcc-fullbuild-dbg running on libc-x86_64-debian-fullbuild while building libc at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/131/builds/31977

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py ...' (failure)
...
-- For x86_64 builtins preferring x86_64/floatundixf.S to floatundixf.c
-- check-runtimes does nothing.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/build
@@@BUILD_STEP build libc@@@
Running: ninja libc
[1/12] Building CXX object libc/startup/linux/x86_64/CMakeFiles/libc.startup.linux.x86_64.start.dir/start.cpp.o
[2/12] Building CXX object libc/src/stdlib/CMakeFiles/libc.src.stdlib.getenv.dir/getenv.cpp.o
[3/12] Building CXX object libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o
FAILED: libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o 
/usr/bin/g++ -DLIBC_NAMESPACE=__llvm_libc_20_0_0_git -D_DEBUG -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc -isystem /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/build/libc/include -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -Wimplicit-fallthrough -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-array-bounds -Wno-stringop-overread -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -Wno-pass-failed -fdiagnostics-color -g -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -DLIBC_ADD_NULL_CHECKS -DLIBC_ERRNO_MODE=LIBC_ERRNO_MODE_DEFAULT -DLIBC_THREAD_MODE=LIBC_THREAD_MODE_PLATFORM -fpie -ffreestanding -DLIBC_FULL_BUILD -isystem/usr/lib/gcc/x86_64-linux-gnu/12//include -nostdinc -idirafter/usr/include -fno-builtin -fno-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -Wdeprecated -fext-numeric-literals -Wno-pedantic -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -DLIBC_COPT_PUBLIC_PACKAGING -std=gnu++17 -MD -MT libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o -MF libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o.d -o libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o -c /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/sys/auxv/linux/getauxval.cpp
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/sys/auxv/linux/getauxval.cpp:10:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/OSUtil/linux/auxv.h: In static member function ‘static void __llvm_libc_20_0_0_git::auxv::Vector::fallback_initialize_unsync()’:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/OSUtil/linux/auxv.h:101:50: error: ‘PR_GET_AUXV’ was not declared in this scope; did you mean ‘PR_SET_MM_AUXV’?
  101 |   long prctl_ret = syscall_impl<long>(SYS_prctl, PR_GET_AUXV,
      |                                                  ^~~~~~~~~~~
      |                                                  PR_SET_MM_AUXV
At global scope:
cc1plus: note: unrecognized command-line option ‘-Wno-pass-failed’ may have been intended to silence earlier diagnostics
[4/12] Building CXX object libc/src/pthread/CMakeFiles/libc.src.pthread.pthread_once.dir/pthread_once.cpp.o
[5/12] Building CXX object libc/src/threads/CMakeFiles/libc.src.threads.call_once.dir/call_once.cpp.o
[6/12] Building CXX object libc/startup/linux/CMakeFiles/libc.startup.linux.do_start.dir/do_start.cpp.o
FAILED: libc/startup/linux/CMakeFiles/libc.startup.linux.do_start.dir/do_start.cpp.o 
/usr/bin/g++ -DLIBC_NAMESPACE=__llvm_libc_20_0_0_git -D_DEBUG -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc -isystem /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/build/libc/include -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -Wimplicit-fallthrough -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-array-bounds -Wno-stringop-overread -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -Wno-pass-failed -fdiagnostics-color -g -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -DLIBC_ADD_NULL_CHECKS -DLIBC_ERRNO_MODE=LIBC_ERRNO_MODE_DEFAULT -DLIBC_THREAD_MODE=LIBC_THREAD_MODE_PLATFORM -fpie -ffreestanding -DLIBC_FULL_BUILD -isystem/usr/lib/gcc/x86_64-linux-gnu/12//include -nostdinc -idirafter/usr/include -fno-builtin -fno-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -Wdeprecated -fext-numeric-literals -Wno-pedantic -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -fno-stack-protector -DLIBC_COPT_RAW_MUTEX_DEFAULT_SPIN_COUNT=100 -DLIBC_COPT_TIMEOUT_ENSURE_MONOTONICITY=1 -std=gnu++17 -MD -MT libc/startup/linux/CMakeFiles/libc.startup.linux.do_start.dir/do_start.cpp.o -MF libc/startup/linux/CMakeFiles/libc.startup.linux.do_start.dir/do_start.cpp.o.d -o libc/startup/linux/CMakeFiles/libc.startup.linux.do_start.dir/do_start.cpp.o -c /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/startup/linux/do_start.cpp
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/startup/linux/do_start.cpp:12:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/OSUtil/linux/auxv.h: In static member function ‘static void __llvm_libc_20_0_0_git::auxv::Vector::fallback_initialize_unsync()’:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/OSUtil/linux/auxv.h:101:50: error: ‘PR_GET_AUXV’ was not declared in this scope; did you mean ‘PR_SET_MM_AUXV’?
  101 |   long prctl_ret = syscall_impl<long>(SYS_prctl, PR_GET_AUXV,
      |                                                  ^~~~~~~~~~~
      |                                                  PR_SET_MM_AUXV
At global scope:
cc1plus: note: unrecognized command-line option ‘-Wno-pass-failed’ may have been intended to silence earlier diagnostics
[7/12] Building CXX object libc/src/__support/time/linux/CMakeFiles/libc.src.__support.time.linux.clock_gettime.dir/clock_gettime.cpp.o
[8/12] Building CXX object libc/src/__support/OSUtil/linux/CMakeFiles/libc.src.__support.OSUtil.linux.vdso.dir/vdso.cpp.o
[9/12] Building CXX object libc/src/__support/threads/linux/CMakeFiles/libc.src.__support.threads.linux.thread.dir/thread.cpp.o
[10/12] Building CXX object libc/startup/linux/x86_64/CMakeFiles/libc.startup.linux.x86_64.tls.dir/tls.cpp.o
ninja: build stopped: subcommand failed.
['ninja', 'libc'] exited with return code 1.
The build step threw an exception...
Traceback (most recent call last):
  File "/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/build/../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 181, in step
    yield
  File "/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/build/../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 143, in main
    run_command(['ninja', 'libc'])
  File "/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/build/../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 196, in run_command
    util.report_run_cmd(cmd, cwd=directory)
  File "/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-zorg/zorg/buildbot/builders/annotated/util.py", line 49, in report_run_cmd
    subprocess.check_call(cmd, shell=shell, *args, **kwargs)
Step 6 (build libc) failure: build libc (failure)
@@@BUILD_STEP build libc@@@
Running: ninja libc
[1/12] Building CXX object libc/startup/linux/x86_64/CMakeFiles/libc.startup.linux.x86_64.start.dir/start.cpp.o
[2/12] Building CXX object libc/src/stdlib/CMakeFiles/libc.src.stdlib.getenv.dir/getenv.cpp.o
[3/12] Building CXX object libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o
FAILED: libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o 
/usr/bin/g++ -DLIBC_NAMESPACE=__llvm_libc_20_0_0_git -D_DEBUG -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc -isystem /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/build/libc/include -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -Wimplicit-fallthrough -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-array-bounds -Wno-stringop-overread -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -Wno-pass-failed -fdiagnostics-color -g -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -DLIBC_ADD_NULL_CHECKS -DLIBC_ERRNO_MODE=LIBC_ERRNO_MODE_DEFAULT -DLIBC_THREAD_MODE=LIBC_THREAD_MODE_PLATFORM -fpie -ffreestanding -DLIBC_FULL_BUILD -isystem/usr/lib/gcc/x86_64-linux-gnu/12//include -nostdinc -idirafter/usr/include -fno-builtin -fno-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -Wdeprecated -fext-numeric-literals -Wno-pedantic -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -DLIBC_COPT_PUBLIC_PACKAGING -std=gnu++17 -MD -MT libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o -MF libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o.d -o libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o -c /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/sys/auxv/linux/getauxval.cpp
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/sys/auxv/linux/getauxval.cpp:10:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/OSUtil/linux/auxv.h: In static member function ‘static void __llvm_libc_20_0_0_git::auxv::Vector::fallback_initialize_unsync()’:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/OSUtil/linux/auxv.h:101:50: error: ‘PR_GET_AUXV’ was not declared in this scope; did you mean ‘PR_SET_MM_AUXV’?
  101 |   long prctl_ret = syscall_impl<long>(SYS_prctl, PR_GET_AUXV,
      |                                                  ^~~~~~~~~~~
      |                                                  PR_SET_MM_AUXV
At global scope:
cc1plus: note: unrecognized command-line option ‘-Wno-pass-failed’ may have been intended to silence earlier diagnostics
[4/12] Building CXX object libc/src/pthread/CMakeFiles/libc.src.pthread.pthread_once.dir/pthread_once.cpp.o
[5/12] Building CXX object libc/src/threads/CMakeFiles/libc.src.threads.call_once.dir/call_once.cpp.o
[6/12] Building CXX object libc/startup/linux/CMakeFiles/libc.startup.linux.do_start.dir/do_start.cpp.o
FAILED: libc/startup/linux/CMakeFiles/libc.startup.linux.do_start.dir/do_start.cpp.o 
/usr/bin/g++ -DLIBC_NAMESPACE=__llvm_libc_20_0_0_git -D_DEBUG -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc -isystem /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/build/libc/include -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -Wimplicit-fallthrough -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-array-bounds -Wno-stringop-overread -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -Wno-pass-failed -fdiagnostics-color -g -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -DLIBC_ADD_NULL_CHECKS -DLIBC_ERRNO_MODE=LIBC_ERRNO_MODE_DEFAULT -DLIBC_THREAD_MODE=LIBC_THREAD_MODE_PLATFORM -fpie -ffreestanding -DLIBC_FULL_BUILD -isystem/usr/lib/gcc/x86_64-linux-gnu/12//include -nostdinc -idirafter/usr/include -fno-builtin -fno-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -Wdeprecated -fext-numeric-literals -Wno-pedantic -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -fno-stack-protector -DLIBC_COPT_RAW_MUTEX_DEFAULT_SPIN_COUNT=100 -DLIBC_COPT_TIMEOUT_ENSURE_MONOTONICITY=1 -std=gnu++17 -MD -MT libc/startup/linux/CMakeFiles/libc.startup.linux.do_start.dir/do_start.cpp.o -MF libc/startup/linux/CMakeFiles/libc.startup.linux.do_start.dir/do_start.cpp.o.d -o libc/startup/linux/CMakeFiles/libc.startup.linux.do_start.dir/do_start.cpp.o -c /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/startup/linux/do_start.cpp
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/startup/linux/do_start.cpp:12:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/OSUtil/linux/auxv.h: In static member function ‘static void __llvm_libc_20_0_0_git::auxv::Vector::fallback_initialize_unsync()’:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/OSUtil/linux/auxv.h:101:50: error: ‘PR_GET_AUXV’ was not declared in this scope; did you mean ‘PR_SET_MM_AUXV’?
  101 |   long prctl_ret = syscall_impl<long>(SYS_prctl, PR_GET_AUXV,
      |                                                  ^~~~~~~~~~~
      |                                                  PR_SET_MM_AUXV
At global scope:
cc1plus: note: unrecognized command-line option ‘-Wno-pass-failed’ may have been intended to silence earlier diagnostics
[7/12] Building CXX object libc/src/__support/time/linux/CMakeFiles/libc.src.__support.time.linux.clock_gettime.dir/clock_gettime.cpp.o
[8/12] Building CXX object libc/src/__support/OSUtil/linux/CMakeFiles/libc.src.__support.OSUtil.linux.vdso.dir/vdso.cpp.o
[9/12] Building CXX object libc/src/__support/threads/linux/CMakeFiles/libc.src.__support.threads.linux.thread.dir/thread.cpp.o
[10/12] Building CXX object libc/startup/linux/x86_64/CMakeFiles/libc.startup.linux.x86_64.tls.dir/tls.cpp.o
ninja: build stopped: subcommand failed.
['ninja', 'libc'] exited with return code 1.
The build step threw an exception...
Traceback (most recent call last):
  File "/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/build/../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 181, in step
    yield
  File "/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/build/../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 143, in main
    run_command(['ninja', 'libc'])
  File "/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/build/../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 196, in run_command
    util.report_run_cmd(cmd, cwd=directory)
  File "/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-zorg/zorg/buildbot/builders/annotated/util.py", line 49, in report_run_cmd
    subprocess.check_call(cmd, shell=shell, *args, **kwargs)
  File "/usr/lib/python3.11/subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ninja', 'libc']' returned non-zero exit status 1.

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 8, 2025

LLVM Buildbot has detected a new failure on builder libc-x86_64-debian-fullbuild-dbg-asan running on libc-x86_64-debian-fullbuild while building libc at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/171/builds/32159

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py ...' (failure)
...
-- Skipping test for 'libc.src.strings.bzero_x86_64_opt_avx512' insufficient host cpu features 'AVX512F'
-- check-runtimes does nothing.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/build
@@@BUILD_STEP build libc@@@
Running: ninja libc
[1/12] Building CXX object libc/startup/linux/x86_64/CMakeFiles/libc.startup.linux.x86_64.start.dir/start.cpp.o
[2/12] Building CXX object libc/src/stdlib/CMakeFiles/libc.src.stdlib.getenv.dir/getenv.cpp.o
[3/12] Building CXX object libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o
FAILED: libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o 
/usr/bin/clang++ -DLIBC_NAMESPACE=__llvm_libc_20_0_0_git -D_DEBUG -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc -isystem /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/build/libc/include -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -Wno-pass-failed -fno-omit-frame-pointer -fsanitize=address -fdiagnostics-color -g -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -DLIBC_ADD_NULL_CHECKS -DLIBC_ERRNO_MODE=LIBC_ERRNO_MODE_DEFAULT -DLIBC_THREAD_MODE=LIBC_THREAD_MODE_PLATFORM -fpie -ffreestanding -DLIBC_FULL_BUILD -nostdlibinc -idirafter/usr/include -fno-builtin -fno-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -Wdeprecated -Wno-c99-extensions -Wno-gnu-imaginary-constant -Wno-pedantic -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wstrict-prototypes -Wthread-safety -Wglobal-constructors -DLIBC_COPT_PUBLIC_PACKAGING -std=gnu++17 -MD -MT libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o -MF libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o.d -o libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o -c /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/src/sys/auxv/linux/getauxval.cpp
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/src/sys/auxv/linux/getauxval.cpp:10:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/src/__support/OSUtil/linux/auxv.h:101:50: error: use of undeclared identifier 'PR_GET_AUXV'
  long prctl_ret = syscall_impl<long>(SYS_prctl, PR_GET_AUXV,
                                                 ^
1 error generated.
[4/12] Building CXX object libc/src/threads/CMakeFiles/libc.src.threads.call_once.dir/call_once.cpp.o
[5/12] Building CXX object libc/src/pthread/CMakeFiles/libc.src.pthread.pthread_once.dir/pthread_once.cpp.o
[6/12] Building CXX object libc/src/__support/OSUtil/linux/CMakeFiles/libc.src.__support.OSUtil.linux.vdso.dir/vdso.cpp.o
[7/12] Building CXX object libc/startup/linux/CMakeFiles/libc.startup.linux.do_start.dir/do_start.cpp.o
FAILED: libc/startup/linux/CMakeFiles/libc.startup.linux.do_start.dir/do_start.cpp.o 
/usr/bin/clang++ -DLIBC_NAMESPACE=__llvm_libc_20_0_0_git -D_DEBUG -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc -isystem /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/build/libc/include -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -Wno-pass-failed -fno-omit-frame-pointer -fsanitize=address -fdiagnostics-color -g -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -DLIBC_ADD_NULL_CHECKS -DLIBC_ERRNO_MODE=LIBC_ERRNO_MODE_DEFAULT -DLIBC_THREAD_MODE=LIBC_THREAD_MODE_PLATFORM -fpie -ffreestanding -DLIBC_FULL_BUILD -nostdlibinc -idirafter/usr/include -fno-builtin -fno-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -Wdeprecated -Wno-c99-extensions -Wno-gnu-imaginary-constant -Wno-pedantic -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wstrict-prototypes -Wthread-safety -Wglobal-constructors -fno-stack-protector -DLIBC_COPT_RAW_MUTEX_DEFAULT_SPIN_COUNT=100 -DLIBC_COPT_TIMEOUT_ENSURE_MONOTONICITY=1 -std=gnu++17 -MD -MT libc/startup/linux/CMakeFiles/libc.startup.linux.do_start.dir/do_start.cpp.o -MF libc/startup/linux/CMakeFiles/libc.startup.linux.do_start.dir/do_start.cpp.o.d -o libc/startup/linux/CMakeFiles/libc.startup.linux.do_start.dir/do_start.cpp.o -c /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/startup/linux/do_start.cpp
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/startup/linux/do_start.cpp:12:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/src/__support/OSUtil/linux/auxv.h:101:50: error: use of undeclared identifier 'PR_GET_AUXV'
  long prctl_ret = syscall_impl<long>(SYS_prctl, PR_GET_AUXV,
                                                 ^
1 error generated.
[8/12] Building CXX object libc/src/__support/time/linux/CMakeFiles/libc.src.__support.time.linux.clock_gettime.dir/clock_gettime.cpp.o
[9/12] Building CXX object libc/src/__support/threads/linux/CMakeFiles/libc.src.__support.threads.linux.thread.dir/thread.cpp.o
[10/12] Building CXX object libc/startup/linux/x86_64/CMakeFiles/libc.startup.linux.x86_64.tls.dir/tls.cpp.o
ninja: build stopped: subcommand failed.
['ninja', 'libc'] exited with return code 1.
The build step threw an exception...
Traceback (most recent call last):
  File "/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/build/../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 181, in step
    yield
  File "/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/build/../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 143, in main
    run_command(['ninja', 'libc'])
  File "/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/build/../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 196, in run_command
    util.report_run_cmd(cmd, cwd=directory)
  File "/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-zorg/zorg/buildbot/builders/annotated/util.py", line 49, in report_run_cmd
    subprocess.check_call(cmd, shell=shell, *args, **kwargs)
  File "/usr/lib/python3.11/subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ninja', 'libc']' returned non-zero exit status 1.
@@@STEP_FAILURE@@@
@@@BUILD_STEP build libc-startup@@@
Running: ninja libc-startup

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 8, 2025

LLVM Buildbot has detected a new failure on builder libc-x86_64-debian running on libc-x86_64-debian while building libc at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/43/builds/30980

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py ...' (failure)
...
-- Skipping test for 'libc.src.string.memset_x86_64_opt_avx512' insufficient host cpu features 'AVX512F'
-- Skipping test for 'libc.src.strings.bcmp_x86_64_opt_avx512' insufficient host cpu features 'AVX512BW'
-- Skipping test for 'libc.src.strings.bzero_x86_64_opt_avx512' insufficient host cpu features 'AVX512F'
-- check-runtimes does nothing.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian/build
@@@BUILD_STEP build libc@@@
Running: ninja libc
[1/2] Building CXX object libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o
FAILED: libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o 
/usr/bin/clang++ -DLIBC_NAMESPACE=__llvm_libc_20_0_0_git -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian/llvm-project/libc -isystem /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian/build/libc/include -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -Wno-pass-failed -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -DLIBC_ADD_NULL_CHECKS -DLIBC_ERRNO_MODE=LIBC_ERRNO_MODE_DEFAULT -DLIBC_THREAD_MODE=LIBC_THREAD_MODE_PLATFORM -fpie -fno-builtin -fno-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -Wdeprecated -Wno-c99-extensions -Wno-gnu-imaginary-constant -Wno-pedantic -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wstrict-prototypes -Wthread-safety -Wglobal-constructors -DLIBC_COPT_PUBLIC_PACKAGING -std=gnu++17 -MD -MT libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o -MF libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o.d -o libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o -c /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian/llvm-project/libc/src/sys/auxv/linux/getauxval.cpp
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian/llvm-project/libc/src/sys/auxv/linux/getauxval.cpp:10:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian/llvm-project/libc/src/__support/OSUtil/linux/auxv.h:101:50: error: use of undeclared identifier 'PR_GET_AUXV'
  long prctl_ret = syscall_impl<long>(SYS_prctl, PR_GET_AUXV,
                                                 ^
1 error generated.
ninja: build stopped: subcommand failed.
['ninja', 'libc'] exited with return code 1.
The build step threw an exception...
Traceback (most recent call last):
  File "/home/llvm-libc-buildbot/home/sivachandra/libc-x86_64-debian/libc-x86_64-debian/build/../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 181, in step
    yield
  File "/home/llvm-libc-buildbot/home/sivachandra/libc-x86_64-debian/libc-x86_64-debian/build/../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 143, in main
    run_command(['ninja', 'libc'])
  File "/home/llvm-libc-buildbot/home/sivachandra/libc-x86_64-debian/libc-x86_64-debian/build/../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 196, in run_command
    util.report_run_cmd(cmd, cwd=directory)
  File "/home/llvm-libc-buildbot/home/sivachandra/libc-x86_64-debian/libc-x86_64-debian/llvm-zorg/zorg/buildbot/builders/annotated/util.py", line 49, in report_run_cmd
    subprocess.check_call(cmd, shell=shell, *args, **kwargs)
  File "/usr/lib/python3.11/subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ninja', 'libc']' returned non-zero exit status 1.
@@@STEP_FAILURE@@@
@@@BUILD_STEP libc-unit-tests@@@
Running: ninja libc-unit-tests
[1/1282] Running unit test libc.test.src.__support.block_test.__unit__
[==========] Running 23 tests from 1 test suite.
[ RUN      ] LlvmLibcBlockTest.CanCreateSingleAlignedBlock
[       OK ] LlvmLibcBlockTest.CanCreateSingleAlignedBlock (11 us)
[ RUN      ] LlvmLibcBlockTest.CanCreateUnalignedSingleBlock
[       OK ] LlvmLibcBlockTest.CanCreateUnalignedSingleBlock (1 us)
[ RUN      ] LlvmLibcBlockTest.CannotCreateTooSmallBlock
[       OK ] LlvmLibcBlockTest.CannotCreateTooSmallBlock (5 us)
[ RUN      ] LlvmLibcBlockTest.CanSplitBlock
[       OK ] LlvmLibcBlockTest.CanSplitBlock (2 us)
[ RUN      ] LlvmLibcBlockTest.CanSplitBlockUnaligned
[       OK ] LlvmLibcBlockTest.CanSplitBlockUnaligned (2 us)
[ RUN      ] LlvmLibcBlockTest.CanSplitMidBlock
[       OK ] LlvmLibcBlockTest.CanSplitMidBlock (41 us)

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 8, 2025

LLVM Buildbot has detected a new failure on builder libc-x86_64-debian-fullbuild-dbg running on libc-x86_64-debian-fullbuild while building libc at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/179/builds/32381

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py ...' (failure)
...
-- For x86_64 builtins preferring x86_64/floatundixf.S to floatundixf.c
-- check-runtimes does nothing.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/build
@@@BUILD_STEP build libc@@@
Running: ninja libc
[1/12] Building CXX object libc/startup/linux/x86_64/CMakeFiles/libc.startup.linux.x86_64.start.dir/start.cpp.o
[2/12] Building CXX object libc/src/stdlib/CMakeFiles/libc.src.stdlib.getenv.dir/getenv.cpp.o
[3/12] Building CXX object libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o
FAILED: libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o 
/usr/bin/clang++ -DLIBC_NAMESPACE=__llvm_libc_20_0_0_git -D_DEBUG -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc -isystem /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/build/libc/include -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -Wno-pass-failed -fdiagnostics-color -g -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -DLIBC_ADD_NULL_CHECKS -DLIBC_ERRNO_MODE=LIBC_ERRNO_MODE_DEFAULT -DLIBC_THREAD_MODE=LIBC_THREAD_MODE_PLATFORM -fpie -ffreestanding -DLIBC_FULL_BUILD -nostdlibinc -idirafter/usr/include -fno-builtin -fno-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -Wdeprecated -Wno-c99-extensions -Wno-gnu-imaginary-constant -Wno-pedantic -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wstrict-prototypes -Wthread-safety -Wglobal-constructors -DLIBC_COPT_PUBLIC_PACKAGING -std=gnu++17 -MD -MT libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o -MF libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o.d -o libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o -c /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/src/sys/auxv/linux/getauxval.cpp
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/src/sys/auxv/linux/getauxval.cpp:10:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/src/__support/OSUtil/linux/auxv.h:101:50: error: use of undeclared identifier 'PR_GET_AUXV'
  long prctl_ret = syscall_impl<long>(SYS_prctl, PR_GET_AUXV,
                                                 ^
1 error generated.
[4/12] Building CXX object libc/src/pthread/CMakeFiles/libc.src.pthread.pthread_once.dir/pthread_once.cpp.o
[5/12] Building CXX object libc/src/threads/CMakeFiles/libc.src.threads.call_once.dir/call_once.cpp.o
[6/12] Building CXX object libc/src/__support/time/linux/CMakeFiles/libc.src.__support.time.linux.clock_gettime.dir/clock_gettime.cpp.o
[7/12] Building CXX object libc/src/__support/OSUtil/linux/CMakeFiles/libc.src.__support.OSUtil.linux.vdso.dir/vdso.cpp.o
[8/12] Building CXX object libc/startup/linux/CMakeFiles/libc.startup.linux.do_start.dir/do_start.cpp.o
FAILED: libc/startup/linux/CMakeFiles/libc.startup.linux.do_start.dir/do_start.cpp.o 
/usr/bin/clang++ -DLIBC_NAMESPACE=__llvm_libc_20_0_0_git -D_DEBUG -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc -isystem /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/build/libc/include -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -Wno-pass-failed -fdiagnostics-color -g -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -DLIBC_ADD_NULL_CHECKS -DLIBC_ERRNO_MODE=LIBC_ERRNO_MODE_DEFAULT -DLIBC_THREAD_MODE=LIBC_THREAD_MODE_PLATFORM -fpie -ffreestanding -DLIBC_FULL_BUILD -nostdlibinc -idirafter/usr/include -fno-builtin -fno-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -Wdeprecated -Wno-c99-extensions -Wno-gnu-imaginary-constant -Wno-pedantic -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wstrict-prototypes -Wthread-safety -Wglobal-constructors -fno-stack-protector -DLIBC_COPT_RAW_MUTEX_DEFAULT_SPIN_COUNT=100 -DLIBC_COPT_TIMEOUT_ENSURE_MONOTONICITY=1 -std=gnu++17 -MD -MT libc/startup/linux/CMakeFiles/libc.startup.linux.do_start.dir/do_start.cpp.o -MF libc/startup/linux/CMakeFiles/libc.startup.linux.do_start.dir/do_start.cpp.o.d -o libc/startup/linux/CMakeFiles/libc.startup.linux.do_start.dir/do_start.cpp.o -c /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/startup/linux/do_start.cpp
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/startup/linux/do_start.cpp:12:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-project/libc/src/__support/OSUtil/linux/auxv.h:101:50: error: use of undeclared identifier 'PR_GET_AUXV'
  long prctl_ret = syscall_impl<long>(SYS_prctl, PR_GET_AUXV,
                                                 ^
1 error generated.
[9/12] Building CXX object libc/src/__support/threads/linux/CMakeFiles/libc.src.__support.threads.linux.thread.dir/thread.cpp.o
[10/12] Building CXX object libc/startup/linux/x86_64/CMakeFiles/libc.startup.linux.x86_64.tls.dir/tls.cpp.o
ninja: build stopped: subcommand failed.
['ninja', 'libc'] exited with return code 1.
The build step threw an exception...
Traceback (most recent call last):
  File "/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/build/../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 181, in step
    yield
  File "/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/build/../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 143, in main
    run_command(['ninja', 'libc'])
  File "/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/build/../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 196, in run_command
    util.report_run_cmd(cmd, cwd=directory)
  File "/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg/llvm-zorg/zorg/buildbot/builders/annotated/util.py", line 49, in report_run_cmd
    subprocess.check_call(cmd, shell=shell, *args, **kwargs)
  File "/usr/lib/python3.11/subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ninja', 'libc']' returned non-zero exit status 1.
@@@STEP_FAILURE@@@
@@@BUILD_STEP build libc-startup@@@
Running: ninja libc-startup

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 8, 2025

LLVM Buildbot has detected a new failure on builder libc-x86_64-debian-dbg running on libc-x86_64-debian while building libc at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/93/builds/31513

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py ...' (failure)
...
-- Skipping test for 'libc.src.string.memset_x86_64_opt_avx512' insufficient host cpu features 'AVX512F'
-- Skipping test for 'libc.src.strings.bcmp_x86_64_opt_avx512' insufficient host cpu features 'AVX512BW'
-- Skipping test for 'libc.src.strings.bzero_x86_64_opt_avx512' insufficient host cpu features 'AVX512F'
-- check-runtimes does nothing.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg/build
@@@BUILD_STEP build libc@@@
Running: ninja libc
[1/2] Building CXX object libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o
FAILED: libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o 
/usr/bin/clang++ -DLIBC_NAMESPACE=__llvm_libc_20_0_0_git -D_DEBUG -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg/llvm-project/libc -isystem /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg/build/libc/include -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -Wno-pass-failed -fdiagnostics-color -g -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -DLIBC_ADD_NULL_CHECKS -DLIBC_ERRNO_MODE=LIBC_ERRNO_MODE_DEFAULT -DLIBC_THREAD_MODE=LIBC_THREAD_MODE_PLATFORM -fpie -fno-builtin -fno-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -Wdeprecated -Wno-c99-extensions -Wno-gnu-imaginary-constant -Wno-pedantic -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wstrict-prototypes -Wthread-safety -Wglobal-constructors -DLIBC_COPT_PUBLIC_PACKAGING -std=gnu++17 -MD -MT libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o -MF libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o.d -o libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o -c /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg/llvm-project/libc/src/sys/auxv/linux/getauxval.cpp
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg/llvm-project/libc/src/sys/auxv/linux/getauxval.cpp:10:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg/llvm-project/libc/src/__support/OSUtil/linux/auxv.h:101:50: error: use of undeclared identifier 'PR_GET_AUXV'
  long prctl_ret = syscall_impl<long>(SYS_prctl, PR_GET_AUXV,
                                                 ^
1 error generated.
ninja: build stopped: subcommand failed.
['ninja', 'libc'] exited with return code 1.
The build step threw an exception...
Traceback (most recent call last):
  File "/home/llvm-libc-buildbot/home/sivachandra/libc-x86_64-debian/libc-x86_64-debian-dbg/build/../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 181, in step
    yield
  File "/home/llvm-libc-buildbot/home/sivachandra/libc-x86_64-debian/libc-x86_64-debian-dbg/build/../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 143, in main
    run_command(['ninja', 'libc'])
  File "/home/llvm-libc-buildbot/home/sivachandra/libc-x86_64-debian/libc-x86_64-debian-dbg/build/../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 196, in run_command
    util.report_run_cmd(cmd, cwd=directory)
  File "/home/llvm-libc-buildbot/home/sivachandra/libc-x86_64-debian/libc-x86_64-debian-dbg/llvm-zorg/zorg/buildbot/builders/annotated/util.py", line 49, in report_run_cmd
    subprocess.check_call(cmd, shell=shell, *args, **kwargs)
  File "/usr/lib/python3.11/subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ninja', 'libc']' returned non-zero exit status 1.
@@@STEP_FAILURE@@@
@@@BUILD_STEP libc-unit-tests@@@
Running: ninja libc-unit-tests
[1/1282] Running unit test libc.test.src.__support.block_test.__unit__
[==========] Running 23 tests from 1 test suite.
[ RUN      ] LlvmLibcBlockTest.CanCreateSingleAlignedBlock
[       OK ] LlvmLibcBlockTest.CanCreateSingleAlignedBlock (16 us)
[ RUN      ] LlvmLibcBlockTest.CanCreateUnalignedSingleBlock
[       OK ] LlvmLibcBlockTest.CanCreateUnalignedSingleBlock (2 us)
[ RUN      ] LlvmLibcBlockTest.CannotCreateTooSmallBlock
[       OK ] LlvmLibcBlockTest.CannotCreateTooSmallBlock (2 us)
[ RUN      ] LlvmLibcBlockTest.CanSplitBlock
[       OK ] LlvmLibcBlockTest.CanSplitBlock (3 us)
[ RUN      ] LlvmLibcBlockTest.CanSplitBlockUnaligned
[       OK ] LlvmLibcBlockTest.CanSplitBlockUnaligned (3 us)
[ RUN      ] LlvmLibcBlockTest.CanSplitMidBlock
[       OK ] LlvmLibcBlockTest.CanSplitMidBlock (2 us)

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 8, 2025

LLVM Buildbot has detected a new failure on builder libc-x86_64-debian-dbg-asan running on libc-x86_64-debian while building libc at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/147/builds/30751

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py ...' (failure)
...
-- Skipping test for 'libc.src.string.memset_x86_64_opt_avx512' insufficient host cpu features 'AVX512F'
-- Skipping test for 'libc.src.strings.bcmp_x86_64_opt_avx512' insufficient host cpu features 'AVX512BW'
-- Skipping test for 'libc.src.strings.bzero_x86_64_opt_avx512' insufficient host cpu features 'AVX512F'
-- check-runtimes does nothing.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/build
@@@BUILD_STEP build libc@@@
Running: ninja libc
[1/2] Building CXX object libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o
FAILED: libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o 
/usr/bin/clang++ -DLIBC_NAMESPACE=__llvm_libc_20_0_0_git -D_DEBUG -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc -isystem /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/build/libc/include -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -Wno-pass-failed -fno-omit-frame-pointer -fsanitize=address -fdiagnostics-color -g -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -DLIBC_ADD_NULL_CHECKS -DLIBC_ERRNO_MODE=LIBC_ERRNO_MODE_DEFAULT -DLIBC_THREAD_MODE=LIBC_THREAD_MODE_PLATFORM -fpie -fno-builtin -fno-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -Wdeprecated -Wno-c99-extensions -Wno-gnu-imaginary-constant -Wno-pedantic -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wstrict-prototypes -Wthread-safety -Wglobal-constructors -DLIBC_COPT_PUBLIC_PACKAGING -std=gnu++17 -MD -MT libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o -MF libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o.d -o libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o -c /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/src/sys/auxv/linux/getauxval.cpp
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/src/sys/auxv/linux/getauxval.cpp:10:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/src/__support/OSUtil/linux/auxv.h:101:50: error: use of undeclared identifier 'PR_GET_AUXV'
  long prctl_ret = syscall_impl<long>(SYS_prctl, PR_GET_AUXV,
                                                 ^
1 error generated.
ninja: build stopped: subcommand failed.
['ninja', 'libc'] exited with return code 1.
The build step threw an exception...
Traceback (most recent call last):
  File "/home/llvm-libc-buildbot/home/sivachandra/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/build/../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 181, in step
    yield
  File "/home/llvm-libc-buildbot/home/sivachandra/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/build/../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 143, in main
    run_command(['ninja', 'libc'])
  File "/home/llvm-libc-buildbot/home/sivachandra/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/build/../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 196, in run_command
    util.report_run_cmd(cmd, cwd=directory)
  File "/home/llvm-libc-buildbot/home/sivachandra/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-zorg/zorg/buildbot/builders/annotated/util.py", line 49, in report_run_cmd
    subprocess.check_call(cmd, shell=shell, *args, **kwargs)
  File "/usr/lib/python3.11/subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ninja', 'libc']' returned non-zero exit status 1.
@@@STEP_FAILURE@@@
@@@BUILD_STEP libc-unit-tests@@@
Running: ninja libc-unit-tests
[1/1279] Running unit test libc.test.src.__support.block_test.__unit__
[==========] Running 23 tests from 1 test suite.
[ RUN      ] LlvmLibcBlockTest.CanCreateSingleAlignedBlock
[       OK ] LlvmLibcBlockTest.CanCreateSingleAlignedBlock (62 us)
[ RUN      ] LlvmLibcBlockTest.CanCreateUnalignedSingleBlock
[       OK ] LlvmLibcBlockTest.CanCreateUnalignedSingleBlock (5 us)
[ RUN      ] LlvmLibcBlockTest.CannotCreateTooSmallBlock
[       OK ] LlvmLibcBlockTest.CannotCreateTooSmallBlock (2 us)
[ RUN      ] LlvmLibcBlockTest.CanSplitBlock
[       OK ] LlvmLibcBlockTest.CanSplitBlock (13 us)
[ RUN      ] LlvmLibcBlockTest.CanSplitBlockUnaligned
[       OK ] LlvmLibcBlockTest.CanSplitBlockUnaligned (8 us)
[ RUN      ] LlvmLibcBlockTest.CanSplitMidBlock
[       OK ] LlvmLibcBlockTest.CanSplitMidBlock (12 us)

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 8, 2025

LLVM Buildbot has detected a new failure on builder openmp-offload-amdgpu-runtime-2 running on rocm-worker-hw-02 while building libc at step 5 "compile-openmp".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/10/builds/15039

Here is the relevant piece of the build log for the reference
Step 5 (compile-openmp) failure: build (failure)
...
-- Performing Test C_WCOMMENT_ALLOWS_LINE_WRAP
-- Performing Test C_WCOMMENT_ALLOWS_LINE_WRAP - Success
-- Performing Test C_SUPPORTS_MISLEADING_INDENTATION_FLAG
-- Performing Test C_SUPPORTS_MISLEADING_INDENTATION_FLAG - Success
-- Performing Test CXX_SUPPORTS_MISLEADING_INDENTATION_FLAG
-- Performing Test CXX_SUPPORTS_MISLEADING_INDENTATION_FLAG - Success
-- Performing Test C_SUPPORTS_CTAD_MAYBE_UNSPPORTED_FLAG
-- Performing Test C_SUPPORTS_CTAD_MAYBE_UNSPPORTED_FLAG - Success
-- Performing Test CXX_SUPPORTS_CTAD_MAYBE_UNSPPORTED_FLAG
-- Performing Test CXX_SUPPORTS_CTAD_MAYBE_UNSPPORTED_FLAG - Success
-- Performing Test C_SUPPORTS_NO_PASS_FAILED_FLAG
-- Performing Test C_SUPPORTS_NO_PASS_FAILED_FLAG - Success
-- Performing Test CXX_SUPPORTS_NO_PASS_FAILED_FLAG
-- Performing Test CXX_SUPPORTS_NO_PASS_FAILED_FLAG - Success
-- Performing Test LINKER_SUPPORTS_COLOR_DIAGNOSTICS
-- Performing Test LINKER_SUPPORTS_COLOR_DIAGNOSTICS - Success
-- Looking for os_signpost_interval_begin
-- Looking for os_signpost_interval_begin - not found
-- Looking for flock
-- Looking for flock - not found
-- Found Python3: /usr/bin/python3.10 (found version "3.10.12") found components: Interpreter 
-- LLVM host triple: x86_64-unknown-linux-gnu
-- LLVM default target triple: amdgcn-amd-amdhsa
-- Setting LIBC_NAMESPACE namespace to '__llvm_libc_22_0_0_git'
-- Set COMPILER_RESOURCE_DIR to /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/lib/clang/22 using --print-resource-dir
-- Building libc for amdgpu on gpu with
        LIBC_COMPILE_OPTIONS_DEFAULT: --target=amdgcn-amd-amdhsa
-- LIBC_CONF_ENABLE_STRONG_STACK_PROTECTOR: ON
-- LIBC_CONF_KEEP_FRAME_POINTER: ON
-- LIBC_CONF_ERRNO_MODE: LIBC_ERRNO_MODE_DEFAULT
-- LIBC_ADD_NULL_CHECKS: ON
-- LIBC_CONF_FREXP_INF_NAN_EXPONENT: 
-- LIBC_CONF_MATH_OPTIMIZATIONS: 0
-- LIBC_CONF_PRINTF_DISABLE_FIXED_POINT: OFF
-- LIBC_CONF_PRINTF_DISABLE_FLOAT: OFF
-- LIBC_CONF_PRINTF_DISABLE_INDEX_MODE: OFF
-- LIBC_CONF_PRINTF_DISABLE_STRERROR: OFF
-- LIBC_CONF_PRINTF_DISABLE_WRITE_INT: OFF
-- LIBC_CONF_PRINTF_FLOAT_TO_STR_NO_SPECIALIZE_LD: OFF
-- LIBC_CONF_PRINTF_FLOAT_TO_STR_USE_DYADIC_FLOAT: OFF
-- LIBC_CONF_PRINTF_FLOAT_TO_STR_USE_FLOAT320: OFF
-- LIBC_CONF_PRINTF_FLOAT_TO_STR_USE_MEGA_LONG_DOUBLE_TABLE: OFF
-- LIBC_CONF_PRINTF_RUNTIME_DISPATCH: ON
-- LIBC_CONF_RAW_MUTEX_DEFAULT_SPIN_COUNT: 100
-- LIBC_CONF_RWLOCK_DEFAULT_SPIN_COUNT: 100
-- LIBC_CONF_TIMEOUT_ENSURE_MONOTONICITY: ON
-- LIBC_CONF_QSORT_IMPL: LIBC_QSORT_QUICK_SORT
-- LIBC_CONF_SCANF_DISABLE_FLOAT: OFF
-- LIBC_CONF_SCANF_DISABLE_INDEX_MODE: OFF

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 8, 2025

LLVM Buildbot has detected a new failure on builder libc-x86_64-debian-dbg-bootstrap-build running on libc-x86_64-debian while building libc at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/200/builds/18378

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py ...' (failure)
...
-- Skipping test for 'libc.src.string.memcpy_x86_64_opt_avx512' insufficient host cpu features 'AVX512F'
-- Skipping test for 'libc.src.string.memmove_x86_64_opt_avx512' insufficient host cpu features 'AVX512F'
-- Skipping test for 'libc.src.string.memset_x86_64_opt_avx512' insufficient host cpu features 'AVX512F'
-- Skipping test for 'libc.src.strings.bcmp_x86_64_opt_avx512' insufficient host cpu features 'AVX512BW'
-- Skipping test for 'libc.src.strings.bzero_x86_64_opt_avx512' insufficient host cpu features 'AVX512F'
-- check-runtimes does nothing.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-bootstrap-build/build/runtimes/runtimes-bins
[1/2] Building CXX object libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o
FAILED: libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o 
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-bootstrap-build/build/./bin/clang++ --target=x86_64-unknown-linux-gnu -DLIBC_NAMESPACE=__llvm_libc_22_0_0_git -D_DEBUG -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-bootstrap-build/llvm-project/libc -isystem /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-bootstrap-build/build/runtimes/runtimes-bins/libc/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -Wno-pass-failed -fdiagnostics-color -g -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -DLIBC_ADD_NULL_CHECKS -DLIBC_ERRNO_MODE=LIBC_ERRNO_MODE_DEFAULT -DLIBC_THREAD_MODE=LIBC_THREAD_MODE_PLATFORM -fpie -ffixed-point -fno-builtin -fno-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -Wdeprecated -Wno-c99-extensions -Wno-gnu-imaginary-constant -Wno-pedantic -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wstrict-prototypes -Wthread-safety -Wglobal-constructors -DLIBC_COPT_PUBLIC_PACKAGING -std=gnu++17 -MD -MT libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o -MF libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o.d -o libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o -c /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-bootstrap-build/llvm-project/libc/src/sys/auxv/linux/getauxval.cpp
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-bootstrap-build/llvm-project/libc/src/sys/auxv/linux/getauxval.cpp:10:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-bootstrap-build/llvm-project/libc/src/__support/OSUtil/linux/auxv.h:101:50: error: use of undeclared identifier 'PR_GET_AUXV'
  101 |   long prctl_ret = syscall_impl<long>(SYS_prctl, PR_GET_AUXV,
      |                                                  ^~~~~~~~~~~
1 error generated.
ninja: build stopped: subcommand failed.
FAILED: runtimes/CMakeFiles/libc /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-bootstrap-build/build/runtimes/CMakeFiles/libc 
cd /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-bootstrap-build/build/runtimes/runtimes-bins && /usr/bin/cmake --build /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-bootstrap-build/build/runtimes/runtimes-bins/ --target libc --config Debug
ninja: build stopped: subcommand failed.
['ninja', 'libc'] exited with return code 1.
The build step threw an exception...
Traceback (most recent call last):
  File "/home/llvm-libc-buildbot/home/sivachandra/libc-x86_64-debian/libc-x86_64-debian-dbg-bootstrap-build/build/../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 181, in step
    yield
  File "/home/llvm-libc-buildbot/home/sivachandra/libc-x86_64-debian/libc-x86_64-debian-dbg-bootstrap-build/build/../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 143, in main
    run_command(['ninja', 'libc'])
  File "/home/llvm-libc-buildbot/home/sivachandra/libc-x86_64-debian/libc-x86_64-debian-dbg-bootstrap-build/build/../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 196, in run_command
    util.report_run_cmd(cmd, cwd=directory)
  File "/home/llvm-libc-buildbot/home/sivachandra/libc-x86_64-debian/libc-x86_64-debian-dbg-bootstrap-build/llvm-zorg/zorg/buildbot/builders/annotated/util.py", line 49, in report_run_cmd
    subprocess.check_call(cmd, shell=shell, *args, **kwargs)
  File "/usr/lib/python3.11/subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ninja', 'libc']' returned non-zero exit status 1.
@@@STEP_FAILURE@@@
@@@BUILD_STEP check-libc@@@
Running: ninja check-libc
[1/3158] Building CommentHTMLTags.inc...
[2/3158] Building CommentHTMLTagsProperties.inc...
[3/3158] Building StmtDataCollectors.inc...
[4/3158] Building BuiltinTemplates.inc...
[5/3033] Building CommentHTMLNamedCharacterReferences.inc...
[6/3033] Building Attributes.inc...
[7/2349] Building GenVT.inc...
[8/604] Building AbstractBasicReader.inc...
[9/604] Building AbstractBasicWriter.inc...
[10/604] Building CommentCommandInfo.inc...
[11/604] Building CommentCommandList.inc...
Step 6 (build libc) failure: build libc (failure)
...
-- Skipping test for 'libc.src.string.memcpy_x86_64_opt_avx512' insufficient host cpu features 'AVX512F'
-- Skipping test for 'libc.src.string.memmove_x86_64_opt_avx512' insufficient host cpu features 'AVX512F'
-- Skipping test for 'libc.src.string.memset_x86_64_opt_avx512' insufficient host cpu features 'AVX512F'
-- Skipping test for 'libc.src.strings.bcmp_x86_64_opt_avx512' insufficient host cpu features 'AVX512BW'
-- Skipping test for 'libc.src.strings.bzero_x86_64_opt_avx512' insufficient host cpu features 'AVX512F'
-- check-runtimes does nothing.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-bootstrap-build/build/runtimes/runtimes-bins
[1/2] Building CXX object libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o
FAILED: libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o 
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-bootstrap-build/build/./bin/clang++ --target=x86_64-unknown-linux-gnu -DLIBC_NAMESPACE=__llvm_libc_22_0_0_git -D_DEBUG -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-bootstrap-build/llvm-project/libc -isystem /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-bootstrap-build/build/runtimes/runtimes-bins/libc/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -Wno-pass-failed -fdiagnostics-color -g -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -DLIBC_ADD_NULL_CHECKS -DLIBC_ERRNO_MODE=LIBC_ERRNO_MODE_DEFAULT -DLIBC_THREAD_MODE=LIBC_THREAD_MODE_PLATFORM -fpie -ffixed-point -fno-builtin -fno-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -Wdeprecated -Wno-c99-extensions -Wno-gnu-imaginary-constant -Wno-pedantic -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wstrict-prototypes -Wthread-safety -Wglobal-constructors -DLIBC_COPT_PUBLIC_PACKAGING -std=gnu++17 -MD -MT libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o -MF libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o.d -o libc/src/sys/auxv/linux/CMakeFiles/libc.src.sys.auxv.linux.getauxval.dir/getauxval.cpp.o -c /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-bootstrap-build/llvm-project/libc/src/sys/auxv/linux/getauxval.cpp
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-bootstrap-build/llvm-project/libc/src/sys/auxv/linux/getauxval.cpp:10:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-bootstrap-build/llvm-project/libc/src/__support/OSUtil/linux/auxv.h:101:50: error: use of undeclared identifier 'PR_GET_AUXV'
  101 |   long prctl_ret = syscall_impl<long>(SYS_prctl, PR_GET_AUXV,
      |                                                  ^~~~~~~~~~~
1 error generated.
ninja: build stopped: subcommand failed.
FAILED: runtimes/CMakeFiles/libc /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-bootstrap-build/build/runtimes/CMakeFiles/libc 
cd /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-bootstrap-build/build/runtimes/runtimes-bins && /usr/bin/cmake --build /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-bootstrap-build/build/runtimes/runtimes-bins/ --target libc --config Debug
ninja: build stopped: subcommand failed.
['ninja', 'libc'] exited with return code 1.
The build step threw an exception...
Traceback (most recent call last):
  File "/home/llvm-libc-buildbot/home/sivachandra/libc-x86_64-debian/libc-x86_64-debian-dbg-bootstrap-build/build/../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 181, in step
    yield
  File "/home/llvm-libc-buildbot/home/sivachandra/libc-x86_64-debian/libc-x86_64-debian-dbg-bootstrap-build/build/../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 143, in main
    run_command(['ninja', 'libc'])
  File "/home/llvm-libc-buildbot/home/sivachandra/libc-x86_64-debian/libc-x86_64-debian-dbg-bootstrap-build/build/../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py", line 196, in run_command
    util.report_run_cmd(cmd, cwd=directory)
  File "/home/llvm-libc-buildbot/home/sivachandra/libc-x86_64-debian/libc-x86_64-debian-dbg-bootstrap-build/llvm-zorg/zorg/buildbot/builders/annotated/util.py", line 49, in report_run_cmd
    subprocess.check_call(cmd, shell=shell, *args, **kwargs)
  File "/usr/lib/python3.11/subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ninja', 'libc']' returned non-zero exit status 1.

svkeerthy pushed a commit that referenced this pull request Oct 9, 2025
Closes #153666

This patch introduces a new centralized AUXV (auxiliary vector) handling
mechanism for LLVM libc on Linux, replacing the previous scattered
implementation across multiple files.

## Key Changes:

### New Files:
- **libc/src/__support/OSUtil/linux/auxv.h**: New header library
providing
  a clean interface for AUXV access with:
  - `auxv::Entry` struct for AUXV entries (type and value)
  - `auxv::Vector` class with iterator support for traversing AUXV
  - `auxv::get()` function for retrieving specific AUXV values
- Thread-safe initialization with fallback mechanisms (prctl and
/proc/self/auxv)

### Modified Files:

1. **libc/src/__support/OSUtil/linux/CMakeLists.txt**:
   - Added `auxv` header library declaration with proper dependencies:
     - libc.hdr.fcntl_macros
     - libc.src.__support.OSUtil.osutil
     - libc.src.__support.common
     - libc.src.__support.CPP.optional
     - libc.src.__support.threads.callonce

2. **libc/config/linux/app.h**:
   - Removed `AuxEntry` struct (moved to auxv.h as `auxv::Entry`)
   - Removed `auxv_ptr` from `AppProperties` struct
   - Simplified application properties structure

3. **libc/src/sys/auxv/linux/getauxval.cpp**:
   - Completely refactored to use new auxv.h interface
   - Removed ~200 lines of complex initialization code
   - Simplified to just call `auxv::get()` function
- Removed dependencies to external symbols (mman, prctl, fcntl, read,
close, open)

4. **libc/src/sys/auxv/linux/CMakeLists.txt**:
   - Updated dependencies to use new auxv header library
- Removed dependencies to external symbols (prctl, mman, fcntl, unistd,
etc.)

5. **libc/startup/linux/do_start.cpp**:
   - Updated to use new `auxv::Vector` interface
   - Changed from pointer-based to iterator-based AUXV traversal
- Updated field names (`aux_entry->id` → `aux_entry.type`,
`aux_entry->value` → `aux_entry.val`)
- Added call to `auxv::Vector::initialize_unsafe()` for early AUXV setup

6. **libc/startup/linux/CMakeLists.txt**:
   - Added dependency on `libc.src.__support.OSUtil.linux.auxv`
clingfei pushed a commit to clingfei/llvm-project that referenced this pull request Oct 10, 2025
…2326)

Closes llvm#153666

This patch introduces a new centralized AUXV (auxiliary vector) handling
mechanism for LLVM libc on Linux, replacing the previous scattered
implementation across multiple files.

## Key Changes:

### New Files:
- **libc/src/__support/OSUtil/linux/auxv.h**: New header library
providing
  a clean interface for AUXV access with:
  - `auxv::Entry` struct for AUXV entries (type and value)
  - `auxv::Vector` class with iterator support for traversing AUXV
  - `auxv::get()` function for retrieving specific AUXV values
- Thread-safe initialization with fallback mechanisms (prctl and
/proc/self/auxv)

### Modified Files:

1. **libc/src/__support/OSUtil/linux/CMakeLists.txt**:
   - Added `auxv` header library declaration with proper dependencies:
     - libc.hdr.fcntl_macros
     - libc.src.__support.OSUtil.osutil
     - libc.src.__support.common
     - libc.src.__support.CPP.optional
     - libc.src.__support.threads.callonce

2. **libc/config/linux/app.h**:
   - Removed `AuxEntry` struct (moved to auxv.h as `auxv::Entry`)
   - Removed `auxv_ptr` from `AppProperties` struct
   - Simplified application properties structure

3. **libc/src/sys/auxv/linux/getauxval.cpp**:
   - Completely refactored to use new auxv.h interface
   - Removed ~200 lines of complex initialization code
   - Simplified to just call `auxv::get()` function
- Removed dependencies to external symbols (mman, prctl, fcntl, read,
close, open)

4. **libc/src/sys/auxv/linux/CMakeLists.txt**:
   - Updated dependencies to use new auxv header library
- Removed dependencies to external symbols (prctl, mman, fcntl, unistd,
etc.)

5. **libc/startup/linux/do_start.cpp**:
   - Updated to use new `auxv::Vector` interface
   - Changed from pointer-based to iterator-based AUXV traversal
- Updated field names (`aux_entry->id` → `aux_entry.type`,
`aux_entry->value` → `aux_entry.val`)
- Added call to `auxv::Vector::initialize_unsafe()` for early AUXV setup

6. **libc/startup/linux/CMakeLists.txt**:
   - Added dependency on `libc.src.__support.OSUtil.linux.auxv`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[libc] Rework getauxval to make it usable internally
4 participants