[llvm] [orc-rt] Add context to detectPageSize's sysconf error. (PR #219670)

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 29 04:13:40 PDT 2026


https://github.com/lhames created https://github.com/llvm/llvm-project/pull/219670

It only reported the strerror text without context, so failure would surface as a bare "Invalid argument" with nothing to say what failed.

>From c53ac364aac1510efe03c55d2266ea58724721d1 Mon Sep 17 00:00:00 2001
From: Lang Hames <lhames at gmail.com>
Date: Sat, 29 Aug 2026 20:48:21 +1000
Subject: [PATCH] [orc-rt] Add context to detectPageSize's sysconf error.

It only reported the strerror text without context, so failure would
surface as a bare "Invalid argument" with nothing to say what failed.
---
 orc-rt/lib/bedrock/ExecutorProcessInfo.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/orc-rt/lib/bedrock/ExecutorProcessInfo.cpp b/orc-rt/lib/bedrock/ExecutorProcessInfo.cpp
index dd59e2fd8795e..6b8c1a99f4163 100644
--- a/orc-rt/lib/bedrock/ExecutorProcessInfo.cpp
+++ b/orc-rt/lib/bedrock/ExecutorProcessInfo.cpp
@@ -75,7 +75,10 @@ std::string ExecutorProcessInfo::makeTargetTriple(
 Expected<size_t> ExecutorProcessInfo::detectPageSize() noexcept {
   long PageSize = sysconf(_SC_PAGESIZE);
   if (PageSize == -1)
-    return make_error<StringError>(sys::strError(errno));
+    return make_error<StringError>((StringOutputStream()
+                                    << "sysconf did not return a page size: "
+                                    << sys::strError(errno))
+                                       .str());
   if (PageSize <= 0 || !has_single_bit(static_cast<size_t>(PageSize)))
     return make_error<StringError>((StringOutputStream()
                                     << "reported page size " << PageSize



More information about the llvm-commits mailing list