codex: fix Linux CI for code_mode

This commit is contained in:
pakrym-oai
2026-03-10 10:24:23 -07:00
parent 29d9cb04b1
commit da38916c20
4 changed files with 37 additions and 101 deletions
@@ -0,0 +1,25 @@
// Bazel's Linux linker setup does not currently resolve V8's
// `__libc_stack_end` reference from the system runtime. Provide a weak
// definition and initialize it from the current thread's stack bounds so the
// prebuilt archive can link and main-thread stack probing still has a sensible
// fallback.
#include <pthread.h>
#include <stddef.h>
#include <stdint.h>
extern "C" __attribute__((weak)) void* __libc_stack_end = nullptr;
__attribute__((constructor)) static void init_libc_stack_end() {
pthread_attr_t attr;
if (pthread_getattr_np(pthread_self(), &attr) != 0) {
return;
}
void* base = nullptr;
size_t size = 0;
if (pthread_attr_getstack(&attr, &base, &size) == 0 && base != nullptr) {
__libc_stack_end = static_cast<uint8_t*>(base) + size;
}
pthread_attr_destroy(&attr);
}