[libc-commits] [libc] [llvm] Reapply "[libc] Port process utilities to hermetic mode and enable some tests" (PR #211484)

Pavel Labath via libc-commits libc-commits at lists.llvm.org
Thu Jul 23 22:59:31 PDT 2026


================
@@ -132,15 +132,9 @@ void *operator new(size_t size) { return malloc(size); }
 
 void *operator new[](size_t size) { return malloc(size); }
 
-void operator delete(void *) {
-  // The libc runtime should not use the global delete operator. Hence,
-  // we just trap here to catch any such accidental usages.
-  __builtin_trap();
-}
+void operator delete(void *ptr) { free(ptr); }
----------------
labath wrote:

That works, though not because of the `=0` thing -- but because the compiler will nearly always call the sized version. It's not that easy to get it to call the non-sized version, but if we did, this would fail because this is an existing prototype that we have to implement. That's why I'd like to keep the non-sized version, even though it's not used right now.

I'll remove the argument name though...

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


More information about the libc-commits mailing list