codex: drop dead Bazel v8 workarounds (#14225)

This commit is contained in:
pakrym-oai
2026-03-11 11:54:46 -07:00
parent 0fd60a9b6b
commit ce7c72db25
6 changed files with 5 additions and 102 deletions

View File

@@ -12,8 +12,5 @@ rust_library(
"@crates//:serde",
"@crates//:serde_json",
],
rustc_env = {
"BAZEL_PACKAGE": "codex-rs/code-mode",
},
visibility = ["//visibility:public"],
)

View File

@@ -8,19 +8,14 @@ pub use api::ExecutionResult;
pub use api::ToolCallHandler;
pub use api::ToolKind;
const BAZEL_BUILD: bool = option_env!("BAZEL_PACKAGE").is_some();
const BAZEL_UNSUPPORTED_REASON: &str = "code_mode is unavailable in Bazel builds";
pub const fn is_supported() -> bool {
!BAZEL_BUILD
false
}
pub fn unsupported_reason() -> Option<&'static str> {
if BAZEL_BUILD {
Some(BAZEL_UNSUPPORTED_REASON)
} else {
None
}
Some(BAZEL_UNSUPPORTED_REASON)
}
pub fn execute(

View File

@@ -1,25 +0,0 @@
// 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);
}