[libc-commits] [libc] [libc] use PR_GET_AUXV only if UAPI provides it (PR #162492)

via libc-commits libc-commits at lists.llvm.org
Wed Oct 8 07:37:48 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Schrodinger ZHU Yifan (SchrodingerZhu)

<details>
<summary>Changes</summary>



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


1 Files Affected:

- (modified) libc/src/__support/OSUtil/linux/auxv.h (+4-2) 


``````````diff
diff --git a/libc/src/__support/OSUtil/linux/auxv.h b/libc/src/__support/OSUtil/linux/auxv.h
index 17108e2e54794..7fb996f01dd84 100644
--- a/libc/src/__support/OSUtil/linux/auxv.h
+++ b/libc/src/__support/OSUtil/linux/auxv.h
@@ -96,8 +96,9 @@ LIBC_INLINE void Vector::fallback_initialize_unsync() {
   }
   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.
+// Attempt 1: use PRCTL to get the auxv.
+// We guarantee that the vector is always padded with AT_NULL entries.
+#ifdef PR_GET_AUXV
   long prctl_ret = syscall_impl<long>(SYS_prctl, PR_GET_AUXV,
                                       reinterpret_cast<unsigned long>(vector),
                                       avaiable_size, 0, 0);
@@ -105,6 +106,7 @@ LIBC_INLINE void Vector::fallback_initialize_unsync() {
     entries = vector;
     return;
   }
+#endif
 
   // Attempt 2: read /proc/self/auxv.
 #ifdef SYS_openat

``````````

</details>


https://github.com/llvm/llvm-project/pull/162492


More information about the libc-commits mailing list