mirror of
https://github.com/openai/codex.git
synced 2026-05-04 05:11:37 +03:00
codex: drop dead Bazel v8 workarounds (#14225)
This commit is contained in:
@@ -12,8 +12,5 @@ rust_library(
|
||||
"@crates//:serde",
|
||||
"@crates//:serde_json",
|
||||
],
|
||||
rustc_env = {
|
||||
"BAZEL_PACKAGE": "codex-rs/code-mode",
|
||||
},
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user