[libc-commits] [libc] [libc] Add pthread_getstack_np extension (PR #217049)

Pavel Labath via libc-commits libc-commits at lists.llvm.org
Mon Aug 31 07:39:50 PDT 2026


================
@@ -130,10 +132,20 @@ static TLSDescriptor tls;
     case AT_HWCAP2:
       hwcap2 = aux_entry.val;
       break;
+    case AT_EXECFN:
+      execfn = reinterpret_cast<const char *>(aux_entry.val);
+      break;
     default:
       break; // TODO: Read other useful entries from the aux vector.
     }
   }
+  // AT_EXECFN is typically the last thing on the stack. Round it up to the
+  // next page boundary.
+  uintptr_t stack_addr =
----------------
labath wrote:

I am aware of that, although I only realized this pretty late in the process, when I didn't have time to figure out a better API. It kinda makes sense if you squint really hard and consider that PTHREAD_STACK_DYNAMIC_NP is actually zero (then the stack+size pair describes the zero-length region at the top of the stack), but yes, I'm not particularly happy with this part of the design. I'll keep thinking about an alternative...

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


More information about the libc-commits mailing list