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

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


Author: Schrodinger ZHU Yifan
Date: 2025-10-08T10:37:49-04:00
New Revision: 8c3d929f0e0e8bfa535f7958a49695f9142742f2

URL: https://github.com/llvm/llvm-project/commit/8c3d929f0e0e8bfa535f7958a49695f9142742f2
DIFF: https://github.com/llvm/llvm-project/commit/8c3d929f0e0e8bfa535f7958a49695f9142742f2.diff

LOG: [libc] use PR_GET_AUXV only if UAPI provides it (#162492)

Added: 
    

Modified: 
    libc/src/__support/OSUtil/linux/auxv.h

Removed: 
    


################################################################################
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


        


More information about the libc-commits mailing list