[libc-commits] [libc] [libc] fix sysconf test for rv32 (PR #162685)

Schrodinger ZHU Yifan via libc-commits libc-commits at lists.llvm.org
Thu Oct 9 08:50:18 PDT 2025


https://github.com/SchrodingerZhu created https://github.com/llvm/llvm-project/pull/162685

None

>From 06b1f1176f60f172adebc5ff36999d94cf942c4d Mon Sep 17 00:00:00 2001
From: Schrodinger ZHU Yifan <yifanzhu at rochester.edu>
Date: Thu, 9 Oct 2025 11:49:42 -0400
Subject: [PATCH] [libc] fix sysconf test for rv32

---
 libc/src/__support/OSUtil/linux/auxv.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libc/src/__support/OSUtil/linux/auxv.h b/libc/src/__support/OSUtil/linux/auxv.h
index 894868ae5824d..cca0f358e2366 100644
--- a/libc/src/__support/OSUtil/linux/auxv.h
+++ b/libc/src/__support/OSUtil/linux/auxv.h
@@ -16,6 +16,7 @@
 
 #include <linux/auxvec.h> // For AT_ macros
 #include <linux/mman.h>   // For mmap flags
+#include <linux/param.h>  // For EXEC_PAGESIZE
 #include <linux/prctl.h>  // For prctl
 #include <sys/syscall.h>  // For syscall numbers
 
@@ -90,7 +91,7 @@ LIBC_INLINE void Vector::fallback_initialize_unsync() {
                                      PROT_READ | PROT_WRITE,
                                      MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
   // We do not proceed if mmap fails.
-  if (mmap_ret <= 0)
+  if (mmap_ret <= 0 && mmap_ret > -EXEC_PAGESIZE)
     return;
 
   // Initialize the auxv array with AT_NULL entries.



More information about the libc-commits mailing list