Download raw body.
[IMPROVEMENT] Integrate the app server daemon into devel/codex.
[IMPROVEMENT] Integrate the app server daemon into devel/codex.
[IMPROVEMENT] Integrate the app server daemon into devel/codex.
Kirill A. Korinsky wrote:
> On Tue, 13 Oct 2026 20:42:00 +0200,
> David Uhden Collado <daviduhden@gmail.com> wrote:
>>
>> Please find attached a patch proposing proper integration of the Codex
>> app-server daemon with the OpenBSD package system.
>>
>> The port already includes the daemon functionality, but upstream
>> normally expects a complete standalone installation and may try to
>> install another Codex executable under ~/.codex/packages. This is
>> unsuitable for a package managed by pkg_add.
>>
>> The proposed changes address this without disabling the daemon or
>> rewriting its lifecycle management.
>>
>
> Sorry, you tried to ship way more than only this changes.
>
> You had touched many patches and reformat port's Makefile.
>
>> [2 codex-0.162.1p0.diff <text/x-patch; UTF-8 (base64)>]
>> ? devel/codex/files
>> ? devel/codex/patches/patch-codex-rs_app-server-daemon_src_backend_pid_rs
>> ? devel/codex/patches/patch-codex-rs_app-server-daemon_src_lib_rs
>> ? devel/codex/patches/patch-codex-rs_app-server-daemon_src_managed_install_rs
>> ? devel/codex/patches/patch-codex-rs_app-server-daemon_src_prepare_install_rs
>> ? devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_clang_clang_gni
>> ? devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_detect_host_arch_py
>> ? devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libunwind_src_src_AddressSpace_hpp
>> ? devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libunwind_src_src_EHHeaderParser_hpp
>> ? devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libunwind_src_src_UnwindCursor_hpp
>> ? devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_gni_v8_gni
>> ? devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_wasm_stacks_cc
>> ? devel/codex/patches/patch-codex-rs_tui_src_app_daemon_menu_rs
>
> I thunk you also forgot quite a few patches.
>
> Can you resend your diff to minimal version which adds support of that codex daemon?
>
Hello Kirill,
You're right. The previous diff included more than the daemon
integration, and I should have made that clearer. Sorry for the confusion.
I've attached a revised diff against the current CVS tree, including the
previously missing patch files.
The daemon integration itself is relatively small. It reuses the
existing Codex executable as the app-server daemon, installs it with the
required package manifest under libexec/codex, and makes the daemon
resolver use that executable instead of downloading or copying another
one into ~/.codex/packages.
The existing upstream process management, Unix sockets, IPC, and
start/stop/restart functionality remain unchanged. Only internal
installation and self-update mechanisms are disabled, since pkg_add owns
the executable.
I also included some V8 portability improvements. These are independent
of the daemon integration, but I think they are worth considering
because Codex builds its own V8 150.4.0 and uses it for code-mode
functionality.
Several changes are adapted from the OpenBSD www/chromium port patches:
- Prevent Linux-specific Clang module configuration from being enabled
on BSD.
- Correct OpenBSD arm64 host architecture detection.
- Improve libunwind handling of DW_EH_PE_omit and reuse cached unwind
sections.
- Enable OpenBSD support in the WASM interpreter platform checks.
- Use MAP_STACK for the usable WASM stack region while preserving its
guard pages.
These changes address OpenBSD-specific portability and runtime behavior
rather than daemon management. Keeping the relevant V8 fixes consistent
with Chromium should also make future updates easier to maintain.
Thanks,
David.
Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/codex/Makefile,v
diff -u -p -u -p -r1.59 Makefile
--- Makefile 10 Oct 2026 12:50:48 -0000 1.59
+++ Makefile 13 Oct 2026 19:45:58 -0000
@@ -21,14 +21,14 @@ PKGNAME = codex-${V}
# only build the Rust workspace (the repo also contains JS tooling).
WRKSRC = ${WRKDIST}/codex-rs
-DIST_TUPLE += github nornagon crossterm ed1cdab335221515706178d68495bba2aed1924f ./crossterm
-DIST_TUPLE += github openai-oss-forks tokio-tungstenite 0e5b2d73aa18dd9f0a50ee9ff199d5aef7594186 ./tokio-tungstenite
-DIST_TUPLE += github openai-oss-forks tungstenite-rs 4fffad30fe373adbdcffab9545e9e9bf4f2fc19f ./tungstenite
-DIST_TUPLE += github helix-editor nucleo 4253de9faabb4e5c6d81d946a5e35a90f87347ee ./nucleo
-DIST_TUPLE += github modelcontextprotocol rust-sdk 3e636cab26c013eca5131103c03d20237f12c4df ./rmcp
-DIST_TUPLE += github dzbarsky rules_rust b56cbaa8465e74127f1ea216f813cd377295ad81 ./runfiles
-DIST_TUPLE += github microsoft mxc 6cd3d58f05d3447e67109cfb75e042803b843ca4 ./mxc
-DIST_TUPLE += github hyperium h3 e07e69412876f7e26f026bd75a48b2704d8c8283 ./h3
+DIST_TUPLE += github openai-oss-forks crossterm ed1cdab335221515706178d68495bba2aed1924f ./crossterm
+DIST_TUPLE += github openai-oss-forks tokio-tungstenite 0e5b2d73aa18dd9f0a50ee9ff199d5aef7594186 ./tokio-tungstenite
+DIST_TUPLE += github openai-oss-forks tungstenite-rs 4fffad30fe373adbdcffab9545e9e9bf4f2fc19f ./tungstenite
+DIST_TUPLE += github helix-editor nucleo 4253de9faabb4e5c6d81d946a5e35a90f87347ee ./nucleo
+DIST_TUPLE += github dzbarsky rules_rust b56cbaa8465e74127f1ea216f813cd377295ad81 ./runfiles
+DIST_TUPLE += github microsoft mxc 6cd3d58f05d3447e67109cfb75e042803b843ca4 ./mxc
+DIST_TUPLE += github hyperium h3 e07e69412876f7e26f026bd75a48b2704d8c8283 ./h3
+DIST_TUPLE += github modelcontextprotocol rust-sdk 3e636cab26c013eca5131103c03d20237f12c4df ./rust-sdk
MAINTAINER = Kirill A. Korinsky <kirill@korins.ky>
@@ -39,8 +39,8 @@ HOMEPAGE = https://github.com/openai/co
# Apache 2.0
PERMIT_PACKAGE = Yes
-WANTLIB += ${MODCARGO_WANTLIB} bz2 crypto dbus-1 execinfo lzma
-WANTLIB += m onig ssl util
+WANTLIB += ${MODCARGO_WANTLIB} bz2 crypto dbus-1 execinfo lzma
+WANTLIB += m onig ssl util
BUILD_DEPENDS = devel/cmake/core \
devel/git \
@@ -57,7 +57,7 @@ RUN_DEPENDS = lang/python/3 \
MODULES = devel/cargo
-CONFIGURE_STYLE = cargo
+CONFIGURE_STYLE = cargo
COMPILER = base-clang
@@ -88,13 +88,20 @@ MODCARGO_ENV += V8_FROM_SOURCE=1 \
# Makes the build look more alive while compiling v8
MODCARGO_BUILD_ARGS += -vv
-MODCARGO_INSTALL_TARGET_PATHS = cli code-mode-host
+MODCARGO_INSTALL_TARGET_PATHS = cli code-mode-host
MODCARGO_BUILD_ARGS += -p codex-cli \
-p codex-code-mode-host \
--bin codex \
--bin codex-code-mode-host
+# The CLI and daemon share one executable and the same package metadata.
+# Only pkg_add installs or replaces it; Codex owns the per-user process.
+MODCARGO_ENV += CODEX_SYSTEM_DAEMON_PATH=${LOCALBASE}/libexec/codex/bin/codex
+
+CODEX_TARGET = ${MACHINE_ARCH:S/amd64/x86_64/}-unknown-openbsd
+SUBST_VARS += V CODEX_TARGET
+
MAKE_ENV = ${MODCARGO_ENV}
# test suite expects network access and a configured OpenAI account
@@ -108,15 +115,25 @@ V8_DISTDIR = ${MODCARGO_VENDOR_DIR}/v8-
post-patch:
mkdir ${V8_DISTDIR}/third_party/icu/common
cp ${MODCARGO_VENDOR_DIR}/deno_core_icudata-${DENO_CORE_ICUDATA_V}/src/icudtl.dat \
- ${V8_DISTDIR}/third_party/icu/common/
+ ${V8_DISTDIR}/third_party/icu/common/
post-build:
+ ${SUBST_CMD} -m 644 -c ${FILESDIR}/codex-package.json \
+ ${WRKBUILD}/codex-package.json
.for s in bash fish zsh
cd ${WRKBUILD}/target/release && \
./codex completion $s > codex.$s
.endfor
post-install:
+ ${INSTALL_DATA_DIR} ${PREFIX}/libexec/codex/bin
+ mv ${PREFIX}/bin/codex ${PREFIX}/libexec/codex/bin/
+ mv ${PREFIX}/bin/codex-code-mode-host ${PREFIX}/libexec/codex/bin/
+ ln -s ../libexec/codex/bin/codex ${PREFIX}/bin/codex
+ ln -s ../libexec/codex/bin/codex-code-mode-host \
+ ${PREFIX}/bin/codex-code-mode-host
+ ${INSTALL_DATA} ${WRKBUILD}/codex-package.json \
+ ${PREFIX}/libexec/codex/
mv ${PREFIX}/bin/logs_client ${PREFIX}/bin/codex-logs-client
${INSTALL_DATA_DIR} ${PREFIX}/share/bash-completion/completions \
${PREFIX}/share/fish/vendor_completions.d \
Index: distinfo
===================================================================
RCS file: /cvs/ports/devel/codex/distinfo,v
diff -u -p -u -p -r1.57 distinfo
--- distinfo 10 Oct 2026 12:50:48 -0000 1.57
+++ distinfo 13 Oct 2026 19:45:59 -0000
@@ -1298,7 +1298,7 @@ SHA256 (helix-editor-nucleo-4253de9faabb
SHA256 (hyperium-h3-e07e69412876f7e26f026bd75a48b2704d8c8283.tar.gz) = O52KnRCEH+J/uGyXoGvs4UEfywrPrcDKhXtjZdTl0po=
SHA256 (microsoft-mxc-6cd3d58f05d3447e67109cfb75e042803b843ca4.tar.gz) = fNUbeETOP2JEnGCm1gKZaZL2RKsB1JbhfqWz/SoY/Dg=
SHA256 (modelcontextprotocol-rust-sdk-3e636cab26c013eca5131103c03d20237f12c4df.tar.gz) = AZnma+bWj4BmTiC+okKDkO8krgNNZ4tYjCATFE+wF4w=
-SHA256 (nornagon-crossterm-ed1cdab335221515706178d68495bba2aed1924f.tar.gz) = NTDNN30IByL2McZWbl7bSESri+j0sYXWvkoru6VZFTE=
+SHA256 (openai-oss-forks-crossterm-ed1cdab335221515706178d68495bba2aed1924f.tar.gz) = NTDNN30IByL2McZWbl7bSESri+j0sYXWvkoru6VZFTE=
SHA256 (openai-oss-forks-tokio-tungstenite-0e5b2d73aa18dd9f0a50ee9ff199d5aef7594186.tar.gz) = odi/7fQepZ1e03XrwoDa1wmdDDOY6RQGxR1IUnAZaj0=
SHA256 (openai-oss-forks-tungstenite-rs-4fffad30fe373adbdcffab9545e9e9bf4f2fc19f.tar.gz) = 2FOTRn3VhDaIBZuyBKYbdFDc4RZqLIqrPIdHiVX/zkg=
SIZE (cargo/Inflector-0.11.4.tar.gz) = 17438
@@ -2601,6 +2601,6 @@ SIZE (helix-editor-nucleo-4253de9faabb4e
SIZE (hyperium-h3-e07e69412876f7e26f026bd75a48b2704d8c8283.tar.gz) = 244832
SIZE (microsoft-mxc-6cd3d58f05d3447e67109cfb75e042803b843ca4.tar.gz) = 5985947
SIZE (modelcontextprotocol-rust-sdk-3e636cab26c013eca5131103c03d20237f12c4df.tar.gz) = 711661
-SIZE (nornagon-crossterm-ed1cdab335221515706178d68495bba2aed1924f.tar.gz) = 162382
+SIZE (openai-oss-forks-crossterm-ed1cdab335221515706178d68495bba2aed1924f.tar.gz) = 162382
SIZE (openai-oss-forks-tokio-tungstenite-0e5b2d73aa18dd9f0a50ee9ff199d5aef7594186.tar.gz) = 33055
SIZE (openai-oss-forks-tungstenite-rs-4fffad30fe373adbdcffab9545e9e9bf4f2fc19f.tar.gz) = 293806
Index: files/codex-package.json
===================================================================
RCS file: files/codex-package.json
diff -N files/codex-package.json
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ files/codex-package.json 13 Oct 2026 19:45:59 -0000
@@ -0,0 +1,7 @@
+{
+ "layoutVersion": 1,
+ "version": "${V}",
+ "target": "${CODEX_TARGET}",
+ "variant": "codex",
+ "entrypoint": "bin/codex"
+}
Index: patches/patch-codex-rs_Cargo_toml
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_Cargo_toml,v
diff -u -p -u -p -r1.44 patch-codex-rs_Cargo_toml
--- patches/patch-codex-rs_Cargo_toml 9 Oct 2026 14:39:58 -0000 1.44
+++ patches/patch-codex-rs_Cargo_toml 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,6 @@
+Resolve pinned Git dependencies from DIST_TUPLE sources, rather than fetching
+Git repositories during the Cargo build.
+
Index: codex-rs/Cargo.toml
--- codex-rs/Cargo.toml.orig
+++ codex-rs/Cargo.toml
@@ -32,7 +35,7 @@ Index: codex-rs/Cargo.toml
# rmcp-v3.3.0 includes enterprise authorization helpers (rust-sdk#1234).
-rmcp = { git = "https://github.com/modelcontextprotocol/rust-sdk", rev = "3e636cab26c013eca5131103c03d20237f12c4df", version = "=3.3.0", default-features = false }
-runfiles = { git = "https://github.com/dzbarsky/rules_rust", rev = "b56cbaa8465e74127f1ea216f813cd377295ad81" }
-+rmcp = { path = "../rmcp/crates/rmcp", version = "=3.3.0", default-features = false }
++rmcp = { path = "../rust-sdk/crates/rmcp", version = "=3.3.0", default-features = false }
+runfiles = { path = "../runfiles/rust/runfiles" }
rustix = { version = "1.1.4", features = ["net"] }
rustls = { version = "0.23.45", default-features = false, features = [
Index: patches/patch-codex-rs_app-server-daemon_src_backend_pid_rs
===================================================================
RCS file: patches/patch-codex-rs_app-server-daemon_src_backend_pid_rs
diff -N patches/patch-codex-rs_app-server-daemon_src_backend_pid_rs
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-codex-rs_app-server-daemon_src_backend_pid_rs 13 Oct 2026 19:45:59 -0000
@@ -0,0 +1,21 @@
+OpenBSD uses the generic ps-based process identity. Keep its lstart string
+independent of the invoking client's locale and timezone so start/stop from
+different terminals can verify the same daemon. Other platforms are unchanged.
+
+Index: codex-rs/app-server-daemon/src/backend/pid.rs
+--- codex-rs/app-server-daemon/src/backend/pid.rs.orig
++++ codex-rs/app-server-daemon/src/backend/pid.rs
+@@ -746,8 +746,11 @@ async fn read_process_start_time(pid: u32) -> Result<S
+
+ #[cfg(unix)]
+ async fn read_process_details(pid: u32) -> Result<(String, String)> {
+- let output = Command::new("ps")
+- .args(["-p", &pid.to_string(), "-o", "stat=", "-o", "lstart="])
++ let mut command = Command::new("ps");
++ command.args(["-p", &pid.to_string(), "-o", "stat=", "-o", "lstart="]);
++ #[cfg(target_os = "openbsd")]
++ command.env("LC_ALL", "C").env("TZ", "UTC");
++ let output = command
+ .output()
+ .await
+ .context("failed to invoke ps for pid-managed app server")?;
Index: patches/patch-codex-rs_app-server-daemon_src_lib_rs
===================================================================
RCS file: patches/patch-codex-rs_app-server-daemon_src_lib_rs
diff -N patches/patch-codex-rs_app-server-daemon_src_lib_rs
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-codex-rs_app-server-daemon_src_lib_rs 13 Oct 2026 19:45:59 -0000
@@ -0,0 +1,91 @@
+Use a distributor-owned executable with the normal daemon lifecycle and IPC.
+Reject binary self-updates and incompatible running daemons; installation
+and replacement belong to pkg_add.
+
+Index: codex-rs/app-server-daemon/src/lib.rs
+--- codex-rs/app-server-daemon/src/lib.rs.orig
++++ codex-rs/app-server-daemon/src/lib.rs
+@@ -225,6 +225,12 @@ enum RestartDecision {
+ Restart,
+ }
+
++/// A distributor-owned daemon is installed and updated outside Codex.
++/// Process lifecycle and IPC still use the normal managed-daemon backend.
++pub fn system_daemon_path() -> Option<&'static Path> {
++ managed_install::system_codex_bin()
++}
++
+ pub async fn run(command: LifecycleCommand) -> Result<LifecycleOutput> {
+ ensure_supported_platform()?;
+ #[cfg(windows)]
+@@ -282,6 +288,10 @@ pub async fn run_pid_update_loop(
+ restore_release: Option<String>,
+ ) -> Result<()> {
+ ensure_supported_platform()?;
++ anyhow::ensure!(
++ managed_install::system_codex_bin().is_none(),
++ "the daemon is managed by the system package manager; use pkg_add -u"
++ );
+ #[cfg(windows)]
+ backend::windows::ensure_not_elevated()?;
+ update_loop::run(http_client_factory, restore_release).await
+@@ -291,6 +301,20 @@ pub async fn update(
+ http_client_factory: codex_http_client::HttpClientFactory,
+ ) -> Result<UpdateOutput> {
+ ensure_supported_platform()?;
++ if let Some(path) = managed_install::system_codex_bin() {
++ let daemon = Daemon::from_environment()?;
++ return Ok(UpdateOutput {
++ status: UpdateStatus::Unsupported,
++ managed_codex_path: path.to_path_buf(),
++ installed_version: daemon.managed_codex_version_best_effort().await,
++ running_version: client::probe(&daemon.socket_path)
++ .await
++ .ok()
++ .map(|info| info.app_server_version),
++ message: "The daemon is managed by the system package manager; use pkg_add -u."
++ .to_string(),
++ });
++ }
+ #[cfg(windows)]
+ backend::windows::ensure_not_elevated()?;
+ update_loop::request_manual_update(&Daemon::from_environment()?, http_client_factory).await
+@@ -448,6 +472,15 @@ impl Daemon {
+ self.wait_until_ready().await?,
+ )
+ };
++ if managed_install::system_codex_bin().is_some() {
++ anyhow::ensure!(
++ info.app_server_version == env!("CARGO_PKG_VERSION"),
++ "system-managed daemon is running version {} but this CLI requires {}; \
++ run `codex app-server daemon restart` after pkg_add -u",
++ info.app_server_version,
++ env!("CARGO_PKG_VERSION")
++ );
++ }
+ if backend.is_some()
+ && let Err(err) = managed.ensure_managed_updater(&settings).await
+ {
+@@ -892,6 +925,10 @@ impl Daemon {
+
+ async fn ensure_managed_updater(&self, settings: &DaemonSettings) -> Result<bool> {
+ let updater = backend::pid_update_loop_backend(self.backend_paths(settings));
++ if managed_install::system_codex_bin().is_some() {
++ updater.stop().await?;
++ return Ok(false);
++ }
+ if !settings.auto_update_enabled {
+ updater.stop().await?;
+ return Ok(false);
+@@ -981,6 +1018,11 @@ impl Daemon {
+ }
+
+ let managed_codex_path = self.managed_codex_bin.display();
++ if managed_install::system_codex_bin().is_some() {
++ return Err(anyhow!(
++ "system daemon executable not found at {managed_codex_path}; reinstall the codex package with pkg_add"
++ ));
++ }
+ Err(anyhow!(
+ "daemon executable not found at {managed_codex_path}; repair the existing installation, or run `codex app-server daemon start` to install a missing daemon"
+ ))
Index: patches/patch-codex-rs_app-server-daemon_src_managed_install_rs
===================================================================
RCS file: patches/patch-codex-rs_app-server-daemon_src_managed_install_rs
diff -N patches/patch-codex-rs_app-server-daemon_src_managed_install_rs
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-codex-rs_app-server-daemon_src_managed_install_rs 13 Oct 2026 19:45:59 -0000
@@ -0,0 +1,42 @@
+Allow the port to select its already installed codex as the app-server
+executable. System ownership is a build-time setting and takes precedence
+over user-managed packages; it never opts into the internal release updater.
+
+Index: codex-rs/app-server-daemon/src/managed_install.rs
+--- codex-rs/app-server-daemon/src/managed_install.rs.orig
++++ codex-rs/app-server-daemon/src/managed_install.rs
+@@ -14,6 +14,14 @@ use tokio::fs;
+ use tokio::process::Command;
+ use tokio::time::timeout;
+
++/// A distributor-owned executable has no managed package or internal updater.
++/// This is a build-time choice, so the runtime environment cannot redirect it.
++pub(crate) fn system_codex_bin() -> Option<&'static Path> {
++ option_env!("CODEX_SYSTEM_DAEMON_PATH")
++ .filter(|path| !path.is_empty())
++ .map(Path::new)
++}
++
+ /// New daemons own their packages, regardless of how the calling CLI was installed.
+ /// Preserve legacy launch state, including logs left after a daemon is stopped;
+ /// settings, installer selections, and lock files alone do not prove a prior launch.
+@@ -57,6 +65,9 @@ pub(crate) fn package_root(codex_home: &Path) -> PathB
+
+ /// Resolve both packaged and legacy binaries without requiring a valid install.
+ pub(crate) fn managed_codex_bin(codex_home: &Path) -> PathBuf {
++ if let Some(path) = system_codex_bin() {
++ return path.to_path_buf();
++ }
+ let root = package_root(codex_home);
+ let current = root.join("current");
+ let packaged = current.join("bin").join(managed_codex_file_name());
+@@ -72,6 +83,9 @@ pub(crate) fn managed_codex_bin(codex_home: &Path) ->
+
+ /// Only latest-channel stable releases may run the public latest-version updater.
+ pub(crate) fn is_stable_standalone_release(codex_home: &Path, codex_bin: &Path) -> bool {
++ if system_codex_bin().is_some() {
++ return false;
++ }
+ let standalone = package_root(codex_home);
+ let Ok(releases) = std::fs::canonicalize(standalone.join("releases")) else {
+ return false;
Index: patches/patch-codex-rs_app-server-daemon_src_prepare_install_rs
===================================================================
RCS file: patches/patch-codex-rs_app-server-daemon_src_prepare_install_rs
diff -N patches/patch-codex-rs_app-server-daemon_src_prepare_install_rs
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-codex-rs_app-server-daemon_src_prepare_install_rs 13 Oct 2026 19:45:59 -0000
@@ -0,0 +1,56 @@
+Validate the system package manifest and executable version without copying
+a CLI package into CODEX_HOME. Reject explicit --from-cli replacement of
+an executable owned by the system package manager.
+
+Index: codex-rs/app-server-daemon/src/prepare_install.rs
+--- codex-rs/app-server-daemon/src/prepare_install.rs.orig
++++ codex-rs/app-server-daemon/src/prepare_install.rs
+@@ -26,6 +26,37 @@ pub struct InstallRequest {
+
+ /// Prepare a missing package while the caller holds the daemon operation lock.
+ pub(super) async fn prepare(daemon: &Daemon, settings: &DaemonSettings) -> Result<()> {
++ if let Some(path) = managed_install::system_codex_bin() {
++ daemon.ensure_managed_codex_bin()?;
++ let context = InstallContext::from_exe(
++ cfg!(target_os = "macos"),
++ Some(path),
++ /*method_override*/ None,
++ );
++ let manifest = context.package_manifest().with_context(|| {
++ format!(
++ "system Codex package metadata missing or invalid for {}; reinstall the codex package with pkg_add",
++ path.display()
++ )
++ })?;
++ let expected = env!("CARGO_PKG_VERSION");
++ anyhow::ensure!(
++ manifest.version.to_string() == expected,
++ "system Codex package version {} differs from CLI version {expected}; update the codex package with pkg_add -u",
++ manifest.version
++ );
++ let version = tokio::time::timeout(
++ std::time::Duration::from_secs(5),
++ managed_install::managed_codex_version(path),
++ )
++ .await
++ .context("timed out checking the system Codex executable version")??;
++ anyhow::ensure!(
++ version == expected,
++ "system Codex executable version {version} differs from CLI version {expected}; update the codex package with pkg_add -u"
++ );
++ return Ok(());
++ }
+ let source = InstallContext::current().package_layout.as_ref();
+ // Keep package replacement state out of the CLI dispatcher's async stack frame.
+ Box::pin(prepare_from_package(
+@@ -46,6 +77,10 @@ pub async fn update_from_cli(
+ confirm: impl FnOnce(&InstallRequest) -> Result<bool>,
+ ) -> Result<Option<crate::UpdateOutput>> {
+ crate::ensure_supported_platform()?;
++ anyhow::ensure!(
++ managed_install::system_codex_bin().is_none(),
++ "the daemon is managed by the system package manager; use pkg_add -u"
++ );
+ #[cfg(windows)]
+ crate::backend::windows::ensure_not_elevated()?;
+ let daemon = Daemon::from_environment()?;
Index: patches/patch-codex-rs_apply-patch_src_lib_rs
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_apply-patch_src_lib_rs,v
diff -u -p -u -p -r1.2 patch-codex-rs_apply-patch_src_lib_rs
--- patches/patch-codex-rs_apply-patch_src_lib_rs 9 Oct 2026 14:39:58 -0000 1.2
+++ patches/patch-codex-rs_apply-patch_src_lib_rs 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,6 @@
+Preserve the anyhow error chain when reporting patch verification failures;
+the outer error alone hides the filesystem failure useful for diagnosis.
+
Index: codex-rs/apply-patch/src/lib.rs
--- codex-rs/apply-patch/src/lib.rs.orig
+++ codex-rs/apply-patch/src/lib.rs
Index: patches/patch-codex-rs_chatgpt_src_lib_rs
===================================================================
RCS file: patches/patch-codex-rs_chatgpt_src_lib_rs
diff -N patches/patch-codex-rs_chatgpt_src_lib_rs
--- patches/patch-codex-rs_chatgpt_src_lib_rs 8 Oct 2026 10:03:39 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,10 +0,0 @@
-Index: codex-rs/chatgpt/src/lib.rs
---- codex-rs/chatgpt/src/lib.rs.orig
-+++ codex-rs/chatgpt/src/lib.rs
-@@ -1,5 +1,6 @@
- #![recursion_limit = "256"]
-
-+#![recursion_limit = "256"]
- pub mod apply_command;
- mod chatgpt_client;
- pub mod connectors;
Index: patches/patch-codex-rs_cli_src_main_rs
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_cli_src_main_rs,v
diff -u -p -u -p -r1.4 patch-codex-rs_cli_src_main_rs
--- patches/patch-codex-rs_cli_src_main_rs 5 Sep 2026 13:04:45 -0000 1.4
+++ patches/patch-codex-rs_cli_src_main_rs 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,5 @@
+Raise the macro expansion recursion limit for the CLI to 256.
+
Index: codex-rs/cli/src/main.rs
--- codex-rs/cli/src/main.rs.orig
+++ codex-rs/cli/src/main.rs
Index: patches/patch-codex-rs_code-mode-protocol_build_rs
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_code-mode-protocol_build_rs,v
diff -u -p -u -p -r1.1 patch-codex-rs_code-mode-protocol_build_rs
--- patches/patch-codex-rs_code-mode-protocol_build_rs 21 Aug 2026 13:33:37 -0000 1.1
+++ patches/patch-codex-rs_code-mode-protocol_build_rs 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,6 @@
+Use protoc from the protobuf build dependency instead of the vendored
+protoc binary, which has no OpenBSD release.
+
Index: codex-rs/code-mode-protocol/build.rs
--- codex-rs/code-mode-protocol/build.rs.orig
+++ codex-rs/code-mode-protocol/build.rs
Index: patches/patch-codex-rs_core_src_config_mod_rs
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_core_src_config_mod_rs,v
diff -u -p -u -p -r1.45 patch-codex-rs_core_src_config_mod_rs
--- patches/patch-codex-rs_core_src_config_mod_rs 9 Oct 2026 14:39:58 -0000 1.45
+++ patches/patch-codex-rs_core_src_config_mod_rs 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,6 @@
+Default to package-manager updates rather than checking upstream releases
+at startup. An explicit user setting still overrides this default.
+
Index: codex-rs/core/src/config/mod.rs
--- codex-rs/core/src/config/mod.rs.orig
+++ codex-rs/core/src/config/mod.rs
Index: patches/patch-codex-rs_core_src_tools_handlers_apply_patch_rs
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_core_src_tools_handlers_apply_patch_rs,v
diff -u -p -u -p -r1.7 patch-codex-rs_core_src_tools_handlers_apply_patch_rs
--- patches/patch-codex-rs_core_src_tools_handlers_apply_patch_rs 9 Oct 2026 14:39:58 -0000 1.7
+++ patches/patch-codex-rs_core_src_tools_handlers_apply_patch_rs 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,7 @@
+For local OpenBSD execution with full disk read access, verify patch files
+without the unsupported filesystem sandbox. Preserve verification contexts
+for remote environments and restricted read policies.
+
Index: codex-rs/core/src/tools/handlers/apply_patch.rs
--- codex-rs/core/src/tools/handlers/apply_patch.rs.orig
+++ codex-rs/core/src/tools/handlers/apply_patch.rs
@@ -33,12 +37,11 @@ Index: codex-rs/core/src/tools/handlers/
/// Handles freeform `apply_patch` requests and routes verified patches to the
/// selected environment filesystem.
#[derive(Default)]
-@@ -338,11 +356,13 @@ impl ApplyPatchHandler {
+@@ -338,11 +356,12 @@ impl ApplyPatchHandler {
)?;
let fs = turn_environment.environment.get_filesystem();
let sandbox = turn_environment.sandbox_context(/*additional_permissions*/ None);
-+ let verification_sandbox =
-+ apply_patch_verification_sandbox(turn_environment, &sandbox);
++ let verification_sandbox = apply_patch_verification_sandbox(turn_environment, &sandbox);
match codex_apply_patch::verify_apply_patch_args(
args,
turn_environment.cwd(),
@@ -48,13 +51,20 @@ Index: codex-rs/core/src/tools/handlers/
)
.await
{
-@@ -446,7 +466,8 @@ pub(crate) async fn intercept_apply_patch(
+@@ -446,8 +465,14 @@ pub(crate) async fn intercept_apply_patch(
tool_name: &str,
) -> Result<Option<FunctionToolOutput>, FunctionCallError> {
let sandbox = turn_environment.sandbox_context(/*additional_permissions*/ None);
- match codex_apply_patch::maybe_parse_apply_patch_verified(command, cwd, fs, Some(&sandbox))
+- .await
+ let verification_sandbox = apply_patch_verification_sandbox(&turn_environment, &sandbox);
-+ match codex_apply_patch::maybe_parse_apply_patch_verified(command, cwd, fs, verification_sandbox)
- .await
++ match codex_apply_patch::maybe_parse_apply_patch_verified(
++ command,
++ cwd,
++ fs,
++ verification_sandbox,
++ )
++ .await
{
codex_apply_patch::MaybeApplyPatchVerified::Body(changes) => {
+ let tool_ctx = ToolCtx {
Index: patches/patch-codex-rs_features_src_lib_rs
===================================================================
RCS file: patches/patch-codex-rs_features_src_lib_rs
diff -N patches/patch-codex-rs_features_src_lib_rs
--- patches/patch-codex-rs_features_src_lib_rs 9 Oct 2026 14:39:58 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,15 +0,0 @@
-Disable daemon auto start by default
-https://github.com/openai/codex/issues/48050
-
-Index: codex-rs/features/src/lib.rs
---- codex-rs/features/src/lib.rs.orig
-+++ codex-rs/features/src/lib.rs
-@@ -992,7 +992,7 @@ pub const FEATURES: &[FeatureSpec] = &[
- id: Feature::DaemonAutoStart,
- key: "daemon_auto_start",
- stage: Stage::Stable,
-- default_enabled: true,
-+ default_enabled: false,
- },
- FeatureSpec {
- id: Feature::TranscriptV2,
Index: patches/patch-codex-rs_modcargo-crates_aws-lc-sys-0_45_0_aws-lc_crypto_fipsmodule_sha_asm_keccak1600-armv8_pl
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_aws-lc-sys-0_45_0_aws-lc_crypto_fipsmodule_sha_asm_keccak1600-armv8_pl,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_aws-lc-sys-0_45_0_aws-lc_crypto_fipsmodule_sha_asm_keccak1600-armv8_pl
--- patches/patch-codex-rs_modcargo-crates_aws-lc-sys-0_45_0_aws-lc_crypto_fipsmodule_sha_asm_keccak1600-armv8_pl 22 Sep 2026 22:08:21 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_aws-lc-sys-0_45_0_aws-lc_crypto_fipsmodule_sha_asm_keccak1600-armv8_pl 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,6 @@
+Generate ARM64 Keccak constants in read-only data rather than execute-only
+text; use page-relative addressing to reach the separate section.
+
Index: codex-rs/modcargo-crates/aws-lc-sys-0.45.0/aws-lc/crypto/fipsmodule/sha/asm/keccak1600-armv8.pl
--- codex-rs/modcargo-crates/aws-lc-sys-0.45.0/aws-lc/crypto/fipsmodule/sha/asm/keccak1600-armv8.pl.orig
+++ codex-rs/modcargo-crates/aws-lc-sys-0.45.0/aws-lc/crypto/fipsmodule/sha/asm/keccak1600-armv8.pl
Index: patches/patch-codex-rs_modcargo-crates_aws-lc-sys-0_45_0_aws-lc_generated-src_linux-aarch64_crypto_fipsmodule_keccak1600-armv8_S
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_aws-lc-sys-0_45_0_aws-lc_generated-src_linux-aarch64_crypto_fipsmodule_keccak1600-armv8_S,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_aws-lc-sys-0_45_0_aws-lc_generated-src_linux-aarch64_crypto_fipsmodule_keccak1600-armv8_S
--- patches/patch-codex-rs_modcargo-crates_aws-lc-sys-0_45_0_aws-lc_generated-src_linux-aarch64_crypto_fipsmodule_keccak1600-armv8_S 22 Sep 2026 22:08:21 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_aws-lc-sys-0_45_0_aws-lc_generated-src_linux-aarch64_crypto_fipsmodule_keccak1600-armv8_S 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,6 @@
+Keep the shipped ARM64 Keccak assembly in sync with the generator patch:
+constants must remain readable under OpenBSD execute-only mappings.
+
Index: codex-rs/modcargo-crates/aws-lc-sys-0.45.0/aws-lc/generated-src/linux-aarch64/crypto/fipsmodule/keccak1600-armv8.S
--- codex-rs/modcargo-crates/aws-lc-sys-0.45.0/aws-lc/generated-src/linux-aarch64/crypto/fipsmodule/keccak1600-armv8.S.orig
+++ codex-rs/modcargo-crates/aws-lc-sys-0.45.0/aws-lc/generated-src/linux-aarch64/crypto/fipsmodule/keccak1600-armv8.S
Index: patches/patch-codex-rs_modcargo-crates_kqueue-1_1_1_src_lib_rs
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_kqueue-1_1_1_src_lib_rs,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_kqueue-1_1_1_src_lib_rs
--- patches/patch-codex-rs_modcargo-crates_kqueue-1_1_1_src_lib_rs 21 Aug 2026 13:33:37 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_kqueue-1_1_1_src_lib_rs 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,7 @@
+Do not use descriptor zero as an absent-watch sentinel. Keep the watched
+set consistent and skip queued events for already removed descriptors
+against the original deadline rather than extending the timeout.
+
Index: codex-rs/modcargo-crates/kqueue-1.1.1/src/lib.rs
--- codex-rs/modcargo-crates/kqueue-1.1.1/src/lib.rs.orig
+++ codex-rs/modcargo-crates/kqueue-1.1.1/src/lib.rs
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_BUILDCONFIG_gn
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_BUILDCONFIG_gn,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_BUILDCONFIG_gn
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_BUILDCONFIG_gn 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_BUILDCONFIG_gn 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,6 @@
+Select the OpenBSD host toolchain and expose BSD platform flags. Reuse
+the Linux GN scaffolding where subsequent patches exclude Linux-only APIs.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/build/config/BUILDCONFIG.gn
--- codex-rs/modcargo-crates/v8-150.4.0/build/config/BUILDCONFIG.gn.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/build/config/BUILDCONFIG.gn
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_BUILD_gn
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_BUILD_gn,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_BUILD_gn
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_BUILD_gn 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_BUILD_gn 13 Oct 2026 19:45:59 -0000
@@ -1,22 +1,17 @@
+Use the current Chromium BSD default-libraries branch without altering Linux.
+The former iterator-debugging hunk is redundant with is_linux on OpenBSD.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/build/config/BUILD.gn
--- codex-rs/modcargo-crates/v8-150.4.0/build/config/BUILD.gn.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/build/config/BUILD.gn
-@@ -119,7 +119,7 @@ config("debug") {
- # builds, and we have to tell it to turn it off.
- defines += [ "_HAS_ITERATOR_DEBUGGING=0" ]
- }
-- } else if ((is_linux || is_chromeos) && current_cpu == "x64" &&
-+ } else if ((is_linux || is_bsd || is_chromeos) && current_cpu == "x64" &&
- enable_iterator_debugging) {
- # Enable libstdc++ debugging facilities to help catch problems early, see
- # http://crbug.com/65151 .
-@@ -211,9 +211,7 @@ config("default_libs") {
+@@ -209,6 +209,10 @@ config("default_libs") {
+ # Targets should choose to explicitly link frameworks they require. Since
+ # linking can have run-time side effects, nothing should be listed here.
libs = []
++ } else if (is_bsd) {
++ libs = [
++ "pthread",
++ ]
} else if (is_linux || is_chromeos) {
libs = [
-- "dl",
- "pthread",
-- "rt",
- ]
- }
- }
+ "dl",
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_c++_c++_gni
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_c++_c++_gni,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_c++_c++_gni
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_c++_c++_gni 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_c++_c++_gni 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,5 @@
+Disable Clang modules on BSD for the port-provided compiler toolchain.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/build/config/c++/c++.gni
--- codex-rs/modcargo-crates/v8-150.4.0/build/config/c++/c++.gni.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/build/config/c++/c++.gni
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_c++_modules_gni
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_c++_modules_gni,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_c++_modules_gni
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_c++_modules_gni 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_c++_modules_gni 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,5 @@
+Do not generate C++ module maps on BSD with the system toolchain.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/build/config/c++/modules.gni
--- codex-rs/modcargo-crates/v8-150.4.0/build/config/c++/modules.gni.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/build/config/c++/modules.gni
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_clang_BUILD_gn
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_clang_BUILD_gn,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_clang_BUILD_gn
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_clang_BUILD_gn 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_clang_BUILD_gn 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,5 @@
+Use system compiler builtins on BSD; retain upstream linkage elsewhere.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/build/config/clang/BUILD.gn
--- codex-rs/modcargo-crates/v8-150.4.0/build/config/clang/BUILD.gn.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/build/config/clang/BUILD.gn
@@ -15,12 +17,3 @@ Index: codex-rs/modcargo-crates/v8-150.4
libname = "osx"
} else if (is_ios) {
if (target_platform == "iphoneos") {
-@@ -268,7 +273,7 @@ clang_lib("compiler_builtins") {
- assert(false, "unsupported target_platform=$target_platform")
- }
- } else if (current_cpu != "ppc64" && current_cpu != "s390x") {
-- libname = "builtins"
-+ #libname = "builtins"
- }
- }
-
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_clang_clang_gni
===================================================================
RCS file: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_clang_clang_gni
diff -N patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_clang_clang_gni
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_clang_clang_gni 13 Oct 2026 19:45:59 -0000
@@ -0,0 +1,13 @@
+Exclude BSD from Linux Clang module support, as in Chromium ports.
+
+Index: codex-rs/modcargo-crates/v8-150.4.0/build/config/clang/clang.gni
+--- codex-rs/modcargo-crates/v8-150.4.0/build/config/clang/clang.gni.orig
++++ codex-rs/modcargo-crates/v8-150.4.0/build/config/clang/clang.gni
+@@ -40,6 +40,7 @@ android_supported_cpus = [
+ "x86",
+ ]
+ clang_modules_platform_supported =
++ !is_bsd &&
+ # s390x should work, but IBM doesn't want it enabled for that cpu arch.
+ (is_linux && current_cpu != "s390x") ||
+ (is_android &&
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_compiler_BUILD_gn
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_compiler_BUILD_gn,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_compiler_BUILD_gn
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_compiler_BUILD_gn 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_compiler_BUILD_gn 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,6 @@
+Adapt Chromium compiler/linker settings to the OpenBSD system toolchain,
+omitting unsupported flags and enabling the wxneeded JIT executable flag.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/build/config/compiler/BUILD.gn
--- codex-rs/modcargo-crates/v8-150.4.0/build/config/compiler/BUILD.gn.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/build/config/compiler/BUILD.gn
@@ -10,6 +13,15 @@ Index: codex-rs/modcargo-crates/v8-150.4
# This switch is used to enable -Wexit-time-destructors by default. This
# warning serves as a flip switch to allow a gradual migration of targets
+@@ -296,7 +296,7 @@ assert(is_bot ||
+ #
+ # Since this is referenced both when passing the file and when deciding which
+ # warnings to enable, store it in a separate variable here.
+-use_clang_warning_suppression_file =
++use_clang_warning_suppression_file = !is_bsd &&
+ is_clang && clang_warning_suppression_file != ""
+
+ # default_include_dirs ---------------------------------------------------------
@@ -314,13 +314,16 @@ config("default_include_dirs") {
# Compiler instrumentation can introduce dependencies in DSOs to symbols in
# the executable they are loaded into, so they are unresolved at link-time.
@@ -105,10 +117,13 @@ Index: codex-rs/modcargo-crates/v8-150.4
}
config("rustc_revision") {
-@@ -1933,10 +1942,15 @@ config("default_warnings") {
- # TODO(crbug.com/432275627): Fix and re-enable.
- "-Wno-uninitialized-const-pointer",
-
+@@ -1930,13 +1939,17 @@ config("default_warnings") {
+ # TODO(crbug.com/376641662): Fix and re-enable.
+ "-Wno-nontrivial-memcall",
+
+- # TODO(crbug.com/432275627): Fix and re-enable.
+- "-Wno-uninitialized-const-pointer",
+-
- # TODO(crbug.com/495753203): Fix and re-enable.
- "-Wno-unused-but-set-global",
]
@@ -117,13 +132,15 @@ Index: codex-rs/modcargo-crates/v8-150.4
+ cflags += [
+ # TODO(crbug.com/495753203): Fix and re-enable.
+ "-Wno-unused-but-set-global",
++ # TODO(crbug.com/432275627): Fix and re-enable.
++ "-Wno-uninitialized-const-pointer",
+ ]
+ }
+
cflags_cc += [
# TODO(crbug.com/328490295): Fix and re-enable for C flags.
"-Wenum-compare-conditional",
-@@ -2304,8 +2318,8 @@ config("export_dynamic") {
+@@ -2304,8 +2317,8 @@ config("export_dynamic") {
# 2. Remove the thin_archive config, so that the .a file actually contains all
# .o files, instead of just references to .o files in the build directoy
config("thin_archive") {
@@ -134,7 +151,7 @@ Index: codex-rs/modcargo-crates/v8-150.4
# The macOS and iOS linker ld64.ldd doesn't support thin archive without
# symbol table, gcc on linux also throws the error `archive has no index`.
# AIX does support -s option, not -S option.
-@@ -2748,7 +2762,7 @@ config("afdo_optimize_size") {
+@@ -2748,7 +2761,7 @@ config("afdo_optimize_size") {
# There are some targeted places that AFDO regresses, so we provide a separate
# config to allow AFDO to be disabled per-target.
config("afdo") {
@@ -143,7 +160,7 @@ Index: codex-rs/modcargo-crates/v8-150.4
cflags = []
if (clang_emit_debug_info_for_profiling) {
# Add the following flags to generate debug info for profiling.
-@@ -2775,7 +2789,7 @@ config("afdo") {
+@@ -2775,7 +2788,7 @@ config("afdo") {
cflags += [ "-Wno-backend-plugin" ]
inputs = [ _clang_sample_profile ]
}
@@ -152,7 +169,7 @@ Index: codex-rs/modcargo-crates/v8-150.4
cflags = [ "-fauto-profile=${auto_profile_path}" ]
inputs = [ auto_profile_path ]
}
-@@ -2827,10 +2841,6 @@ config("split_dwarf") {
+@@ -2827,10 +2840,6 @@ config("split_dwarf") {
# thinlto requires -gsplit-dwarf in ldflags.
if (use_thin_lto && !is_apple) {
ldflags = split_dwarf_flags
@@ -163,7 +180,7 @@ Index: codex-rs/modcargo-crates/v8-150.4
}
}
-@@ -2909,7 +2919,7 @@ config("symbols") {
+@@ -2909,7 +2918,7 @@ config("symbols") {
}
if (current_os != "zos") {
@@ -172,7 +189,7 @@ Index: codex-rs/modcargo-crates/v8-150.4
}
if (is_clang && !is_tsan && !is_asan && !use_dwarf5) {
-@@ -2932,7 +2942,7 @@ config("symbols") {
+@@ -2932,7 +2941,7 @@ config("symbols") {
# Disable debugger index for Android, which uses lldb. lldb can create (and
# cache) its own index in about 20 seconds, so there's no need to pay the
# price of an index on every link.
@@ -181,7 +198,7 @@ Index: codex-rs/modcargo-crates/v8-150.4
(use_lld || use_mold) && !is_wasm && !is_android
if (_add_symbol_index) {
if (use_dwarf5) {
-@@ -2972,7 +2982,7 @@ config("symbols") {
+@@ -2972,7 +2981,7 @@ config("symbols") {
cflags += [ "-gomit-unreferenced-methods" ]
}
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_compiler_cpu_abi_gn
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_compiler_cpu_abi_gn,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_compiler_cpu_abi_gn
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_compiler_cpu_abi_gn 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_compiler_cpu_abi_gn 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,6 @@
+Avoid Chromium-specific ABI and architecture compiler switches on BSD
+when using the port-selected system toolchain.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/build/config/compiler_cpu_abi.gn
--- codex-rs/modcargo-crates/v8-150.4.0/build/config/compiler_cpu_abi.gn.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/build/config/compiler_cpu_abi.gn
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_linux_BUILD_gn
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_linux_BUILD_gn,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_linux_BUILD_gn
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_linux_BUILD_gn 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_linux_BUILD_gn 13 Oct 2026 19:45:59 -0000
@@ -1,14 +1,14 @@
+Exclude BSD from libatomic linkage; preserve the upstream Linux condition.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/build/config/linux/BUILD.gn
--- codex-rs/modcargo-crates/v8-150.4.0/build/config/linux/BUILD.gn.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/build/config/linux/BUILD.gn
-@@ -40,10 +40,6 @@ config("runtime_library") {
- defines = [ "OS_CHROMEOS" ]
+@@ -41,7 +41,7 @@ config("runtime_library") {
}
-- if ((!is_chromeos || default_toolchain != "//build/toolchain/cros:target") &&
+ if ((!is_chromeos || default_toolchain != "//build/toolchain/cros:target") &&
- (!use_custom_libcxx || current_cpu == "mipsel")) {
-- libs = [ "atomic" ]
-- }
++ (!use_custom_libcxx || current_cpu == "mipsel") && !is_bsd) {
+ libs = [ "atomic" ]
+ }
}
-
- config("libcap") {
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_linux_pkg-config_py
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_linux_pkg-config_py,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_linux_pkg-config_py
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_linux_pkg-config_py 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_config_linux_pkg-config_py 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,6 @@
+Allow the pkg-config helper to operate on OpenBSD and FreeBSD as well
+as Linux.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/build/config/linux/pkg-config.py
--- codex-rs/modcargo-crates/v8-150.4.0/build/config/linux/pkg-config.py.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/build/config/linux/pkg-config.py
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_detect_host_arch_py
===================================================================
RCS file: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_detect_host_arch_py
diff -N patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_detect_host_arch_py
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_detect_host_arch_py 13 Oct 2026 19:45:59 -0000
@@ -0,0 +1,15 @@
+Recognize OpenBSD arm64 before the generic arm prefix.
+The Chromium patch places this branch after arm and cannot match arm64 there.
+
+Index: codex-rs/modcargo-crates/v8-150.4.0/build/detect_host_arch.py
+--- codex-rs/modcargo-crates/v8-150.4.0/build/detect_host_arch.py.orig
++++ codex-rs/modcargo-crates/v8-150.4.0/build/detect_host_arch.py
+@@ -20,6 +20,8 @@ def HostArch():
+ host_arch = 'ia32'
+ elif host_arch in ['x86_64', 'amd64']:
+ host_arch = 'x64'
++ elif host_arch.startswith('arm64'):
++ host_arch = 'arm64'
+ elif host_arch.startswith('arm'):
+ host_arch = 'arm'
+ elif host_arch.startswith('aarch64'):
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_toolchain_gcc_solink_wrapper_py
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_toolchain_gcc_solink_wrapper_py,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_build_toolchain_gcc_solink_wrapper_py
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_toolchain_gcc_solink_wrapper_py 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_toolchain_gcc_solink_wrapper_py 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,5 @@
+Use nm options accepted by the OpenBSD toolchain; omit GNU --format=posix.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/build/toolchain/gcc_solink_wrapper.py
--- codex-rs/modcargo-crates/v8-150.4.0/build/toolchain/gcc_solink_wrapper.py.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/build/toolchain/gcc_solink_wrapper.py
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_toolchain_gcc_toolchain_gni
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_toolchain_gcc_toolchain_gni,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_build_toolchain_gcc_toolchain_gni
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_toolchain_gcc_toolchain_gni 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_toolchain_gcc_toolchain_gni 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,6 @@
+Use system compiler/binutils names and expose extra flags passed by the
+port, rather than requiring the Chromium LLVM directory layout.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/build/toolchain/gcc_toolchain.gni
--- codex-rs/modcargo-crates/v8-150.4.0/build/toolchain/gcc_toolchain.gni.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/build/toolchain/gcc_toolchain.gni
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_toolchain_openbsd_BUILD_gn
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_toolchain_openbsd_BUILD_gn,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_build_toolchain_openbsd_BUILD_gn
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_toolchain_openbsd_BUILD_gn 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_toolchain_openbsd_BUILD_gn 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,6 @@
+Provide GN toolchain definitions for OpenBSD, including the amd64 and
+arm64 targets supported by this port.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/build/toolchain/openbsd/BUILD.gn
--- codex-rs/modcargo-crates/v8-150.4.0/build/toolchain/openbsd/BUILD.gn.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/build/toolchain/openbsd/BUILD.gn
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_toolchain_toolchain_gni
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_toolchain_toolchain_gni,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_build_toolchain_toolchain_gni
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_toolchain_toolchain_gni 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_build_toolchain_toolchain_gni 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,5 @@
+Include OpenBSD in the POSIX toolchain branch.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/build/toolchain/toolchain.gni
--- codex-rs/modcargo-crates/v8-150.4.0/build/toolchain/toolchain.gni.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/build/toolchain/toolchain.gni
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_abseil-cpp_absl_base_config_h
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_abseil-cpp_absl_base_config_h,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_abseil-cpp_absl_base_config_h
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_abseil-cpp_absl_base_config_h 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_abseil-cpp_absl_base_config_h 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,5 @@
+Recognize BSD in Abseil platform feature selection.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/abseil-cpp/absl/base/config.h
--- codex-rs/modcargo-crates/v8-150.4.0/third_party/abseil-cpp/absl/base/config.h.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/third_party/abseil-cpp/absl/base/config.h
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_abseil-cpp_absl_base_internal_sysinfo_cc
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_abseil-cpp_absl_base_internal_sysinfo_cc,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_abseil-cpp_absl_base_internal_sysinfo_cc
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_abseil-cpp_absl_base_internal_sysinfo_cc 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_abseil-cpp_absl_base_internal_sysinfo_cc 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,6 @@
+Use BSD sysctl paths and exclude the incompatible thread-ID branches
+from Abseil system information code.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/abseil-cpp/absl/base/internal/sysinfo.cc
--- codex-rs/modcargo-crates/v8-150.4.0/third_party/abseil-cpp/absl/base/internal/sysinfo.cc.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/third_party/abseil-cpp/absl/base/internal/sysinfo.cc
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libc++_src_include___locale_dir_support_bsd_like_h
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libc++_src_include___locale_dir_support_bsd_like_h,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libc++_src_include___locale_dir_support_bsd_like_h
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libc++_src_include___locale_dir_support_bsd_like_h 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libc++_src_include___locale_dir_support_bsd_like_h 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,6 @@
+Use libc locale functions available on OpenBSD instead of unavailable
+per-locale variants. This inherited fallback uses the process locale.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/libc++/src/include/__locale_dir/support/bsd_like.h
--- codex-rs/modcargo-crates/v8-150.4.0/third_party/libc++/src/include/__locale_dir/support/bsd_like.h.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/third_party/libc++/src/include/__locale_dir/support/bsd_like.h
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libc++_src_src_filesystem_filesystem_clock_cpp
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libc++_src_src_filesystem_filesystem_clock_cpp,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libc++_src_src_filesystem_filesystem_clock_cpp
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libc++_src_src_filesystem_filesystem_clock_cpp 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libc++_src_src_filesystem_filesystem_clock_cpp 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,5 @@
+Select clock_gettime for filesystem timestamps on BSD.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/libc++/src/src/filesystem/filesystem_clock.cpp
--- codex-rs/modcargo-crates/v8-150.4.0/third_party/libc++/src/src/filesystem/filesystem_clock.cpp.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/third_party/libc++/src/src/filesystem/filesystem_clock.cpp
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libunwind_src_src_AddressSpace_hpp
===================================================================
RCS file: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libunwind_src_src_AddressSpace_hpp
diff -N patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libunwind_src_src_AddressSpace_hpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libunwind_src_src_AddressSpace_hpp 13 Oct 2026 19:45:59 -0000
@@ -0,0 +1,90 @@
+Cache unwind sections by PC using the same RB tree as Chromium ports.
+Treat DW_EH_PE_omit before decoding its low four bits.
+Reference: www/chromium/patches/patch-third_party_libunwind_src_src_AddressSpace_hpp.
+
+Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/libunwind/src/src/AddressSpace.hpp
+--- codex-rs/modcargo-crates/v8-150.4.0/third_party/libunwind/src/src/AddressSpace.hpp.orig
++++ codex-rs/modcargo-crates/v8-150.4.0/third_party/libunwind/src/src/AddressSpace.hpp
+@@ -16,6 +16,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
++#include <sys/tree.h>
+
+ #include "libunwind.h"
+ #include "config.h"
+@@ -157,7 +158,63 @@ struct UnwindInfoSections {
+ #endif
+ };
+
++class UnwindInfoSectionsCache {
++public:
+
++ struct CacheItem {
++ CacheItem(UnwindInfoSections &uis, uintptr_t pc)
++ : m_uis(uis), m_pc(pc) {
++ }
++ CacheItem(uintptr_t pc)
++ : m_pc(pc) {
++ }
++
++ UnwindInfoSections m_uis;
++ uintptr_t m_pc;
++
++ RB_ENTRY(CacheItem) entry;
++ };
++
++ typedef uintptr_t CacheItemKey;
++
++ int CacheCmp(struct CacheItem *c1, struct CacheItem *c2) {
++ return (c1->m_pc < c2->m_pc ? -1 : c1->m_pc > c2->m_pc);
++ }
++
++ UnwindInfoSectionsCache() {
++ m_head = RB_INITIALIZER(&head);
++ }
++
++ bool getUnwindInfoSectionsForPC(CacheItemKey key, UnwindInfoSections &uis) {
++ UnwindInfoSections *result = nullptr;
++ if (m_prev_req_item && m_prev_req_item->m_pc == key)
++ result = &m_prev_req_item->m_uis;
++ else {
++ struct CacheItem find(key), *res;
++ res = RB_FIND(CacheTree, &m_head, &find);
++ if (res) {
++ m_prev_req_item = res;
++ result = &res->m_uis;
++ }
++ }
++ if (result) {
++ uis = *result;
++ return true;
++ }
++ return false;
++ }
++
++ void setUnwindInfoSectionsForPC(CacheItemKey key, UnwindInfoSections &uis) {
++ CacheItem *p_item(new CacheItem(uis, key));
++ RB_INSERT(CacheTree, &m_head, p_item);
++ }
++
++private:
++ CacheItem *m_prev_req_item = nullptr;
++ RB_HEAD(CacheTree, CacheItem) m_head;
++ RB_GENERATE(CacheTree, CacheItem, entry, CacheCmp);
++};
++
+ /// LocalAddressSpace is used as a template parameter to UnwindCursor when
+ /// unwinding a thread in the same process. The wrappers compile away,
+ /// making local unwinds fast.
+@@ -283,6 +340,10 @@ LocalAddressSpace::getEncodedP(pint_t &addr, pint_t en
+ pint_t startAddr = addr;
+ const uint8_t *p = (uint8_t *)addr;
+ pint_t result;
++
++ if (encoding == DW_EH_PE_omit) {
++ return (pint_t)NULL;
++ }
+
+ // first get value
+ switch (encoding & 0x0F) {
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libunwind_src_src_EHHeaderParser_hpp
===================================================================
RCS file: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libunwind_src_src_EHHeaderParser_hpp
diff -N patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libunwind_src_src_EHHeaderParser_hpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libunwind_src_src_EHHeaderParser_hpp 13 Oct 2026 19:45:59 -0000
@@ -0,0 +1,27 @@
+Recognize DW_EH_PE_omit before masking the table encoding; otherwise
+0xff becomes 0x0f and takes the unknown-encoding abort path.
+Reference: www/chromium/patches/patch-third_party_libunwind_src_src_EHHeaderParser_hpp.
+
+Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/libunwind/src/src/EHHeaderParser.hpp
+--- codex-rs/modcargo-crates/v8-150.4.0/third_party/libunwind/src/src/EHHeaderParser.hpp.orig
++++ codex-rs/modcargo-crates/v8-150.4.0/third_party/libunwind/src/src/EHHeaderParser.hpp
+@@ -161,6 +161,10 @@ bool EHHeaderParser<A>::findFDE(A &addressSpace,
+
+ template <typename A>
+ size_t EHHeaderParser<A>::getTableEntrySize(uint8_t tableEnc) {
++ if (tableEnc == DW_EH_PE_omit) {
++ return 0;
++ }
++
+ switch (tableEnc & 0x0f) {
+ case DW_EH_PE_sdata2:
+ case DW_EH_PE_udata2:
+@@ -174,8 +178,6 @@ size_t EHHeaderParser<A>::getTableEntrySize(uint8_t ta
+ case DW_EH_PE_sleb128:
+ case DW_EH_PE_uleb128:
+ _LIBUNWIND_ABORT("Can't binary search on variable length encoded data.");
+- case DW_EH_PE_omit:
+- return 0;
+ default:
+ _LIBUNWIND_ABORT("Unknown DWARF encoding for search table.");
+ }
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libunwind_src_src_Registers_hpp
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libunwind_src_src_Registers_hpp,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libunwind_src_src_Registers_hpp
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libunwind_src_src_Registers_hpp 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libunwind_src_src_Registers_hpp 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,5 @@
+Exclude the auxiliary-vector register detection path on BSD.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/libunwind/src/src/Registers.hpp
--- codex-rs/modcargo-crates/v8-150.4.0/third_party/libunwind/src/src/Registers.hpp.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/third_party/libunwind/src/src/Registers.hpp
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libunwind_src_src_UnwindCursor_hpp
===================================================================
RCS file: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libunwind_src_src_UnwindCursor_hpp
diff -N patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libunwind_src_src_UnwindCursor_hpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_libunwind_src_src_UnwindCursor_hpp 13 Oct 2026 19:45:59 -0000
@@ -0,0 +1,32 @@
+Reuse unwind sections by PC through a thread-local cache, matching
+the current Chromium/OpenBSD lookup and cache lifetime.
+Reference: www/chromium/patches/patch-third_party_libunwind_src_src_UnwindCursor_hpp.
+
+Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/libunwind/src/src/UnwindCursor.hpp
+--- codex-rs/modcargo-crates/v8-150.4.0/third_party/libunwind/src/src/UnwindCursor.hpp.orig
++++ codex-rs/modcargo-crates/v8-150.4.0/third_party/libunwind/src/src/UnwindCursor.hpp
+@@ -114,6 +114,8 @@ extern "C" _Unwind_Reason_Code __libunwind_seh_persona
+
+ namespace libunwind {
+
++static thread_local UnwindInfoSectionsCache uwis_cache;
++
+ #if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND)
+ /// Cache of recently found FDEs.
+ template <typename A>
+@@ -2776,7 +2778,14 @@ void UnwindCursor<A, R>::setInfoBasedOnIPRegister(bool
+
+ // Ask address space object to find unwind sections for this pc.
+ UnwindInfoSections sects;
+- if (_addressSpace.template findUnwindSections<R>(pc, sects)) {
++ bool have_sects = false;
++ if (uwis_cache.getUnwindInfoSectionsForPC(pc, sects))
++ have_sects = true;
++ else if (_addressSpace.template findUnwindSections<R>(pc, sects)) {
++ uwis_cache.setUnwindInfoSectionsForPC(pc, sects);
++ have_sects = true;
++ }
++ if (have_sects) {
+ #if defined(_LIBUNWIND_SUPPORT_COMPACT_UNWIND)
+ // If there is a compact unwind encoding table, look there first.
+ if (sects.compact_unwind_section != 0) {
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_partition_alloc_gni
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_partition_alloc_gni,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_partition_alloc_gni
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_partition_alloc_gni 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_partition_alloc_gni 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,5 @@
+Disable memory tagging and the Linux x64 feature branch on BSD.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/partition_alloc.gni
--- codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/partition_alloc.gni.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/partition_alloc.gni
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_BUILD_gn
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_BUILD_gn,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_BUILD_gn
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_BUILD_gn 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_BUILD_gn 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,6 @@
+Do not select Linux-specific allocator sources when reusing Linux GN
+settings for BSD.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/BUILD.gn
--- codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/BUILD.gn.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/BUILD.gn
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_address_space_randomization_h
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_address_space_randomization_h,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_address_space_randomization_h
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_address_space_randomization_h 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_address_space_randomization_h 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,6 @@
+Use the BSD address-space randomization branch instead of the memory
+tool override.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/address_space_randomization.h
--- codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/address_space_randomization.h.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/address_space_randomization.h
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_page_allocator_constants_h
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_page_allocator_constants_h,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_page_allocator_constants_h
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_page_allocator_constants_h 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_page_allocator_constants_h 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,5 @@
+Allow variable allocator page sizes for BSD ARM64 and related targets.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/page_allocator_constants.h
--- codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/page_allocator_constants.h.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/page_allocator_constants.h
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_page_allocator_h
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_page_allocator_h,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_page_allocator_h
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_page_allocator_h 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_page_allocator_h 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,5 @@
+Apply the POSIX allocator API branch to BSD.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/page_allocator.h
--- codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/page_allocator.h.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/page_allocator.h
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_page_allocator_internals_posix_cc
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_page_allocator_internals_posix_cc,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_page_allocator_internals_posix_cc
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_page_allocator_internals_posix_cc 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_page_allocator_internals_posix_cc 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,7 @@
+Avoid Linux-style ifunc support on BSD and report the OpenBSD zero segment.
+Adapt the Chromium ports zero-segment hunk to the native VM_MIN_ADDRESS
+guarantee for the two architectures supported by this port.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/page_allocator_internals_posix.cc
--- codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/page_allocator_internals_posix.cc.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/page_allocator_internals_posix.cc
@@ -10,3 +14,18 @@ Index: codex-rs/modcargo-crates/v8-150.4
struct __ifunc_arg_t;
#include "partition_alloc/aarch64_support.h"
+@@ -226,6 +226,14 @@ size_t GetZeroSegmentSizeFromOS() {
+ return 0x100000000; // 4GB
+ }
+ return static_cast<size_t>(address);
++}
++
++#elif PA_BUILDFLAG(IS_OPENBSD)
++
++size_t GetZeroSegmentSizeFromOS() {
++ // VM_MIN_ADDRESS is PAGE_SIZE on OpenBSD amd64 and arm64. Do not assume
++ // Linux's 64KB mmap_min_addr when describing the unmappable zero segment.
++ return SystemPageSize();
+ }
+
+ #elif PA_BUILDFLAG(IS_LINUX)
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_page_allocator_internals_posix_h
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_page_allocator_internals_posix_h,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_page_allocator_internals_posix_h
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_page_allocator_internals_posix_h 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_page_allocator_internals_posix_h 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,5 @@
+Use BSD page-discard handling and MADV_FREE rather than the Linux path.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/page_allocator_internals_posix.h
--- codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/page_allocator_internals_posix.h.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/page_allocator_internals_posix.h
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_debug_proc_maps_linux_cc
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_debug_proc_maps_linux_cc,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_debug_proc_maps_linux_cc
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_debug_proc_maps_linux_cc 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_debug_proc_maps_linux_cc 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,5 @@
+Exclude Linux /proc mapping support on BSD.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_base/debug/proc_maps_linux.cc
--- codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_base/debug/proc_maps_linux.cc.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_base/debug/proc_maps_linux.cc
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_debug_stack_trace_posix_cc
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_debug_stack_trace_posix_cc,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_debug_stack_trace_posix_cc
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_debug_stack_trace_posix_cc 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_debug_stack_trace_posix_cc 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,6 @@
+Select the BSD-compatible POSIX stack trace path without Linux-only
+/proc and signal-stack assumptions.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_base/debug/stack_trace_posix.cc
--- codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_base/debug/stack_trace_posix.cc.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_base/debug/stack_trace_posix.cc
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_rand_util_posix_cc
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_rand_util_posix_cc,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_rand_util_posix_cc
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_rand_util_posix_cc 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_rand_util_posix_cc 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,5 @@
+Use getentropy for BSD allocator randomness before the existing fallback.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_base/rand_util_posix.cc
--- codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_base/rand_util_posix.cc.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_base/rand_util_posix.cc
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_threading_platform_thread_h
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_threading_platform_thread_h,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_threading_platform_thread_h
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_threading_platform_thread_h 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_threading_platform_thread_h 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,5 @@
+Define the BSD allocator thread ID type.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_base/threading/platform_thread.h
--- codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_base/threading/platform_thread.h.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_base/threading/platform_thread.h
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_threading_platform_thread_internal_posix_h
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_threading_platform_thread_internal_posix_h,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_threading_platform_thread_internal_posix_h
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_threading_platform_thread_internal_posix_h 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_threading_platform_thread_internal_posix_h 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,5 @@
+Include BSD in the POSIX allocator threading declaration branch.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_base/threading/platform_thread_internal_posix.h
--- codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_base/threading/platform_thread_internal_posix.h.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_base/threading/platform_thread_internal_posix.h
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_threading_platform_thread_posix_cc
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_threading_platform_thread_posix_cc,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_threading_platform_thread_posix_cc
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_threading_platform_thread_posix_cc 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_base_threading_platform_thread_posix_cc 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,5 @@
+Include BSD in the POSIX allocator threading implementation branch.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_base/threading/platform_thread_posix.cc
--- codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_base/threading/platform_thread_posix.cc.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_base/threading/platform_thread_posix.cc
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_config_h
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_config_h,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_config_h
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_config_h 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_config_h 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,6 @@
+Enable the BSD allocator platform configuration alongside the existing
+POSIX platforms.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_config.h
--- codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_config.h.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_config.h
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_constants_h
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_constants_h,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_constants_h
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_constants_h 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_constants_h 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,5 @@
+Select allocator alignment and ARM64 constants for BSD.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_constants.h
--- codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_constants.h.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_constants.h
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_forward_h
===================================================================
RCS file: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_forward_h
diff -N patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_forward_h
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_alloc_forward_h 9 Aug 2026 11:29:25 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,17 +0,0 @@
-Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_forward.h
---- codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_forward.h.orig
-+++ codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_alloc_forward.h
-@@ -29,9 +29,13 @@ namespace internal {
- // the second one 16. We could technically return something different for
- // malloc() and operator new(), but this would complicate things, and most of
- // our allocations are presumably coming from operator new() anyway.
-+#if defined(__i386__) && defined(OS_FREEBSD)
-+constexpr size_t kAlignment = 8;
-+#else
- constexpr inline size_t kAlignment =
- std::max(alignof(max_align_t),
- static_cast<size_t>(__STDCPP_DEFAULT_NEW_ALIGNMENT__));
-+#endif
- static_assert(base::bits::HasSingleBit(kAlignment),
- "Alignment must be power of two.");
- static_assert(kAlignment <= 16,
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_root_cc
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_root_cc,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_root_cc
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_root_cc 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_partition_root_cc 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,5 @@
+Include BSD in allocator page accounting and ARM64 handling.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_root.cc
--- codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_root.cc.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/partition_root.cc
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_spinning_mutex_cc
===================================================================
RCS file: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_spinning_mutex_cc
diff -N patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_spinning_mutex_cc
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_spinning_mutex_cc 9 Aug 2026 11:29:25 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,37 +0,0 @@
-Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/spinning_mutex.cc
---- codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/spinning_mutex.cc.orig
-+++ codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/spinning_mutex.cc
-@@ -20,7 +20,16 @@
- #endif
-
- #if PA_CONFIG(HAS_LINUX_KERNEL)
-+#if defined(OS_OPENBSD)
-+#include <sys/time.h>
-+#include <sys/futex.h>
-+#elif defined(OS_FREEBSD)
-+#include <sys/types.h>
-+#include <sys/thr.h>
-+#include <sys/umtx.h>
-+#else
- #include <linux/futex.h>
-+#endif
- #include <sys/syscall.h>
- #include <unistd.h>
-
-@@ -150,8 +159,16 @@ PA_ALWAYS_INLINE long FutexSyscall(volatile void* ftx,
- int saved_errno = errno;
- errno = 0;
-
-+#if defined(OS_FREEBSD)
-+ long retval = _umtx_op(&state_, UMTX_OP_WAIT_UINT_PRIVATE,
-+ kLockedContended, nullptr, nullptr);
-+#elif defined(OS_OPENBSD)
-+ long retval = futex(reinterpret_cast<volatile unsigned int *>(&state_), FUTEX_WAIT | FUTEX_PRIVATE_FLAG,
-+ kLockedContended, nullptr, nullptr);
-+#else
- long retval = syscall(SYS_futex, ftx, op | FUTEX_PRIVATE_FLAG, value, nullptr,
- nullptr, 0);
-+#endif
- if (retval == -1) {
- // These are programming errors, check them.
- [[maybe_unused]] const int futex_errno = errno;
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_stack_stack_cc
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_stack_stack_cc,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_stack_stack_cc
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_stack_stack_cc 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_stack_stack_cc 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,6 @@
+Obtain thread stack bounds with the BSD pthread APIs, including
+pthread_stackseg_np on OpenBSD.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/stack/stack.cc
--- codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/stack/stack.cc.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/stack/stack.cc
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_thread_isolation_pkey_cc
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_thread_isolation_pkey_cc,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_thread_isolation_pkey_cc
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_thread_isolation_pkey_cc 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_third_party_partition_alloc_src_partition_alloc_thread_isolation_pkey_cc 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,5 @@
+Exclude the non-BSD platform guard in allocator protection-key handling.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/thread_isolation/pkey.cc
--- codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/thread_isolation/pkey.cc.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/third_party/partition_alloc/src/partition_alloc/thread_isolation/pkey.cc
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_BUILD_gn
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_BUILD_gn,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_BUILD_gn
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_BUILD_gn 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_BUILD_gn 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,6 @@
+Export OpenBSD/BSD V8 platform defines, select platform-openbsd.cc and
+link libexecinfo instead of Linux platform sources.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/v8/BUILD.gn
--- codex-rs/modcargo-crates/v8-150.4.0/v8/BUILD.gn.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/v8/BUILD.gn
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_build_overrides_partition_alloc_gni
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_build_overrides_partition_alloc_gni,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_build_overrides_partition_alloc_gni
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_build_overrides_partition_alloc_gni 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_build_overrides_partition_alloc_gni 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,5 @@
+Do not enable Chromium PartitionAlloc as the V8 allocator on BSD.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/v8/build_overrides/partition_alloc.gni
--- codex-rs/modcargo-crates/v8-150.4.0/v8/build_overrides/partition_alloc.gni.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/v8/build_overrides/partition_alloc.gni
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_gni_v8_gni
===================================================================
RCS file: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_gni_v8_gni
diff -N patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_gni_v8_gni
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_gni_v8_gni 13 Oct 2026 19:45:59 -0000
@@ -0,0 +1,15 @@
+Include OpenBSD in the supported WASM interpreter platforms.
+Correct the openbds typo in the Chromium ports reference; keep the default off.
+
+Index: codex-rs/modcargo-crates/v8-150.4.0/v8/gni/v8.gni
+--- codex-rs/modcargo-crates/v8-150.4.0/v8/gni/v8.gni.orig
++++ codex-rs/modcargo-crates/v8-150.4.0/v8/gni/v8.gni
+@@ -351,7 +351,7 @@ is_drumbrake_supported =
+ (v8_current_cpu == "x64" || v8_current_cpu == "arm64" ||
+ v8_current_cpu == "riscv64") &&
+ (target_os == "win" || target_os == "linux" || target_os == "mac" ||
+- target_os == "ios")
++ target_os == "ios" || target_os == "openbsd" || target_os == "freebsd")
+
+ # Turbofan is enabled by default, except in lite mode.
+ if (v8_enable_turbofan == "") {
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_include_v8-internal_h
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_include_v8-internal_h,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_include_v8-internal_h
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_include_v8-internal_h 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_include_v8-internal_h 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,5 @@
+Use the alternate memory-handling branch on OpenBSD as on Android.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/v8/include/v8-internal.h
--- codex-rs/modcargo-crates/v8-150.4.0/v8/include/v8-internal.h.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/v8/include/v8-internal.h
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_include_v8config_h
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_include_v8config_h,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_include_v8config_h
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_include_v8config_h 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_include_v8config_h 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,6 @@
+Recognize OpenBSD as a V8 target and exclude incompatible compiler
+feature assumptions.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/v8/include/v8config.h
--- codex-rs/modcargo-crates/v8-150.4.0/v8/include/v8config.h.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/v8/include/v8config.h
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_api_api_cc
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_api_api_cc,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_api_api_cc
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_api_api_cc 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_api_api_cc 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,5 @@
+Include OpenBSD in V8 POSIX API and memory handling branches.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/v8/src/api/api.cc
--- codex-rs/modcargo-crates/v8-150.4.0/v8/src/api/api.cc.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/v8/src/api/api.cc
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_atomicops_h
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_atomicops_h,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_atomicops_h
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_atomicops_h 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_atomicops_h 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,5 @@
+Select the atomic operation declarations appropriate to OpenBSD.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/v8/src/base/atomicops.h
--- codex-rs/modcargo-crates/v8-150.4.0/v8/src/base/atomicops.h.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/v8/src/base/atomicops.h
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_platform_platform-openbsd_cc
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_platform_platform-openbsd_cc,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_platform_platform-openbsd_cc
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_platform_platform-openbsd_cc 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_platform_platform-openbsd_cc 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,5 @@
+Implement the thread stack-start query using OpenBSD pthread_stackseg_np.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/v8/src/base/platform/platform-openbsd.cc
--- codex-rs/modcargo-crates/v8-150.4.0/v8/src/base/platform/platform-openbsd.cc.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/v8/src/base/platform/platform-openbsd.cc
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_platform_platform-posix_cc
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_platform_platform-posix_cc,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_platform_platform-posix_cc
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_platform_platform-posix_cc 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_platform_platform-posix_cc 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,6 @@
+Use BSD mapping semantics, let OpenBSD choose randomized mmap addresses,
+and exclude incompatible POSIX platform branches.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/v8/src/base/platform/platform-posix.cc
--- codex-rs/modcargo-crates/v8-150.4.0/v8/src/base/platform/platform-posix.cc.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/v8/src/base/platform/platform-posix.cc
@@ -10,29 +13,23 @@ Index: codex-rs/modcargo-crates/v8-150.4
#define MAP_ANONYMOUS MAP_ANON
#endif
-@@ -210,6 +210,7 @@ void* Allocate(void* hint, size_t size, OS::MemoryPerm
- int GetProtectionFromMemoryPermission(OS::MemoryPermission access) {
- switch (access) {
- case OS::MemoryPermission::kNoAccess:
-+ return PROT_NONE;
- case OS::MemoryPermission::kNoAccessWillJitLater:
- return PROT_NONE;
- case OS::MemoryPermission::kRead:
-@@ -359,6 +360,13 @@ void OS::SetRandomMmapSeed(int64_t seed) {
+@@ -359,8 +359,15 @@ void OS::SetRandomMmapSeed(int64_t seed) {
}
}
+#if V8_OS_OPENBSD
+// Allow OpenBSD's mmap to select a random address on OpenBSD
-+ // static
-+ void* OS::GetRandomMmapAddr() {
+ // static
+ void* OS::GetRandomMmapAddr() {
+ return nullptr;
+}
+#else
- // static
- void* OS::GetRandomMmapAddr() {
++// static
++void* OS::GetRandomMmapAddr() {
uintptr_t raw_addr;
-@@ -457,6 +465,7 @@ void* OS::GetRandomMmapAddr() {
+ {
+ MutexGuard guard(rng_mutex.Pointer());
+@@ -457,6 +464,7 @@ void* OS::GetRandomMmapAddr() {
#endif
return reinterpret_cast<void*>(raw_addr);
}
@@ -40,7 +37,7 @@ Index: codex-rs/modcargo-crates/v8-150.4
// TODO(bbudge) Move Cygwin and Fuchsia stuff into platform-specific files.
#if !V8_OS_CYGWIN && !V8_OS_FUCHSIA
-@@ -772,7 +781,7 @@ void OS::DestroySharedMemoryHandle(SharedMemoryHandle
+@@ -772,7 +780,7 @@ void OS::DestroySharedMemoryHandle(SharedMemoryHandle
#if !V8_OS_ZOS
// static
bool OS::HasLazyCommits() {
@@ -49,7 +46,7 @@ Index: codex-rs/modcargo-crates/v8-150.4
return true;
#else
// TODO(bbudge) Return true for all POSIX platforms.
-@@ -1423,7 +1432,7 @@ void Thread::SetThreadLocal(LocalStorageKey key, void*
+@@ -1423,7 +1431,7 @@ void Thread::SetThreadLocal(LocalStorageKey key, void*
// keep this version in POSIX as most Linux-compatible derivatives will
// support it. MacOS and FreeBSD are different here.
#if !defined(V8_OS_FREEBSD) && !defined(V8_OS_DARWIN) && !defined(_AIX) && \
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_strings_h
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_strings_h,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_strings_h
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_strings_h 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_strings_h 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,5 @@
+Include cstdarg explicitly for variable argument declarations.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/v8/src/base/strings.h
--- codex-rs/modcargo-crates/v8-150.4.0/v8/src/base/strings.h.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/v8/src/base/strings.h
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_sys-info_cc
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_sys-info_cc,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_sys-info_cc
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_sys-info_cc 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_base_sys-info_cc 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,5 @@
+Count online CPUs on OpenBSD using HW_NCPUONLINE.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/v8/src/base/sys-info.cc
--- codex-rs/modcargo-crates/v8-150.4.0/v8/src/base/sys-info.cc.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/v8/src/base/sys-info.cc
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_diagnostics_perf-jit_cc
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_diagnostics_perf-jit_cc,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_diagnostics_perf-jit_cc
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_diagnostics_perf-jit_cc 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_diagnostics_perf-jit_cc 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,6 @@
+Keep PerfJitLogger definitions available on BSD to match V8 callers.
+This inherited patch broadens the upstream Linux/Darwin compile guard.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/v8/src/diagnostics/perf-jit.cc
--- codex-rs/modcargo-crates/v8-150.4.0/v8/src/diagnostics/perf-jit.cc.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/v8/src/diagnostics/perf-jit.cc
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_diagnostics_perf-jit_h
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_diagnostics_perf-jit_h,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_diagnostics_perf-jit_h
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_diagnostics_perf-jit_h 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_diagnostics_perf-jit_h 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,5 @@
+Keep PerfJitLogger declarations in sync with the BSD implementation patch.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/v8/src/diagnostics/perf-jit.h
--- codex-rs/modcargo-crates/v8-150.4.0/v8/src/diagnostics/perf-jit.h.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/v8/src/diagnostics/perf-jit.h
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_execution_isolate_cc
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_execution_isolate_cc,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_execution_isolate_cc
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_execution_isolate_cc 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_execution_isolate_cc 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,5 @@
+Mark embedded V8 code executable with mprotect on OpenBSD outside IA32.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/v8/src/execution/isolate.cc
--- codex-rs/modcargo-crates/v8-150.4.0/v8/src/execution/isolate.cc.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/v8/src/execution/isolate.cc
@@ -12,14 +14,16 @@ Index: codex-rs/modcargo-crates/v8-150.4
extern "C" const uint8_t v8_Default_embedded_blob_code_[];
extern "C" uint32_t v8_Default_embedded_blob_code_size_;
extern "C" const uint8_t v8_Default_embedded_blob_data_[];
-@@ -5714,6 +5718,11 @@ void Isolate::InitializeDefaultEmbeddedBlob() {
+@@ -5714,6 +5718,13 @@ void Isolate::InitializeDefaultEmbeddedBlob() {
uint32_t code_size = DefaultEmbeddedBlobCodeSize();
const uint8_t* data = DefaultEmbeddedBlobData();
uint32_t data_size = DefaultEmbeddedBlobDataSize();
+
+#if defined(V8_OS_OPENBSD) && !defined(V8_TARGET_ARCH_IA32)
-+ mprotect(reinterpret_cast<void *>(const_cast<uint8_t *>(code)),
-+ code_size, PROT_READ | PROT_EXEC);
++ if (code_size > 0) {
++ mprotect(reinterpret_cast<void *>(const_cast<uint8_t *>(code)),
++ code_size, PROT_READ | PROT_EXEC);
++ }
+#endif
if (StickyEmbeddedBlobCode() != nullptr) {
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_flags_flags_cc
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_flags_flags_cc,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_flags_flags_cc
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_flags_flags_cc 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_flags_flags_cc 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,5 @@
+Make initialized V8 flags immutable with OpenBSD mimmutable.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/v8/src/flags/flags.cc
--- codex-rs/modcargo-crates/v8-150.4.0/v8/src/flags/flags.cc.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/v8/src/flags/flags.cc
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_objects_simd_cc
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_objects_simd_cc,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_objects_simd_cc
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_objects_simd_cc 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_objects_simd_cc 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,5 @@
+Exclude the incompatible NEON64 SIMD path on OpenBSD.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/v8/src/objects/simd.cc
--- codex-rs/modcargo-crates/v8-150.4.0/v8/src/objects/simd.cc.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/v8/src/objects/simd.cc
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_sandbox_sandbox_cc
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_sandbox_sandbox_cc,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_sandbox_sandbox_cc
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_sandbox_sandbox_cc 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_sandbox_sandbox_cc 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,5 @@
+Apply the alternate sandbox reservation branch on OpenBSD.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/v8/src/sandbox/sandbox.cc
--- codex-rs/modcargo-crates/v8-150.4.0/v8/src/sandbox/sandbox.cc.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/v8/src/sandbox/sandbox.cc
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_snapshot_embedded_platform-embedded-file-writer-base_cc
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_snapshot_embedded_platform-embedded-file-writer-base_cc,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_snapshot_embedded_platform-embedded-file-writer-base_cc
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_snapshot_embedded_platform-embedded-file-writer-base_cc 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_snapshot_embedded_platform-embedded-file-writer-base_cc 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,5 @@
+Recognize openbsd as an embedded snapshot target OS.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/v8/src/snapshot/embedded/platform-embedded-file-writer-base.cc
--- codex-rs/modcargo-crates/v8-150.4.0/v8/src/snapshot/embedded/platform-embedded-file-writer-base.cc.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/v8/src/snapshot/embedded/platform-embedded-file-writer-base.cc
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_snapshot_embedded_platform-embedded-file-writer-base_h
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_snapshot_embedded_platform-embedded-file-writer-base_h,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_snapshot_embedded_platform-embedded-file-writer-base_h
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_snapshot_embedded_platform-embedded-file-writer-base_h 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_snapshot_embedded_platform-embedded-file-writer-base_h 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,5 @@
+Represent OpenBSD in the embedded snapshot target OS enumeration.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/v8/src/snapshot/embedded/platform-embedded-file-writer-base.h
--- codex-rs/modcargo-crates/v8-150.4.0/v8/src/snapshot/embedded/platform-embedded-file-writer-base.h.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/v8/src/snapshot/embedded/platform-embedded-file-writer-base.h
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_snapshot_embedded_platform-embedded-file-writer-generic_cc
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_snapshot_embedded_platform-embedded-file-writer-generic_cc,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_snapshot_embedded_platform-embedded-file-writer-generic_cc
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_snapshot_embedded_platform-embedded-file-writer-generic_cc 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_snapshot_embedded_platform-embedded-file-writer-generic_cc 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,6 @@
+Emit page-aligned OpenBSD embedded code and the .openbsd.mutable section
+to support the required memory protections.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/v8/src/snapshot/embedded/platform-embedded-file-writer-generic.cc
--- codex-rs/modcargo-crates/v8-150.4.0/v8/src/snapshot/embedded/platform-embedded-file-writer-generic.cc.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/v8/src/snapshot/embedded/platform-embedded-file-writer-generic.cc
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_trap-handler_handler-inside-posix_cc
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_trap-handler_handler-inside-posix_cc,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_trap-handler_handler-inside-posix_cc
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_trap-handler_handler-inside-posix_cc 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_trap-handler_handler-inside-posix_cc 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,5 @@
+Use OpenBSD signal-context registers and avoid absent siginfo codes.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/v8/src/trap-handler/handler-inside-posix.cc
--- codex-rs/modcargo-crates/v8-150.4.0/v8/src/trap-handler/handler-inside-posix.cc.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/v8/src/trap-handler/handler-inside-posix.cc
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_trap-handler_handler-inside-posix_h
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_trap-handler_handler-inside-posix_h,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_trap-handler_handler-inside-posix_h
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_trap-handler_handler-inside-posix_h 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_trap-handler_handler-inside-posix_h 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,5 @@
+Include OpenBSD in the POSIX trap-handler declarations.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/v8/src/trap-handler/handler-inside-posix.h
--- codex-rs/modcargo-crates/v8-150.4.0/v8/src/trap-handler/handler-inside-posix.h.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/v8/src/trap-handler/handler-inside-posix.h
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_trap-handler_trap-handler_h
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_trap-handler_trap-handler_h,v
diff -u -p -u -p -r1.1 patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_trap-handler_trap-handler_h
--- patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_trap-handler_trap-handler_h 9 Aug 2026 11:29:25 -0000 1.1
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_trap-handler_trap-handler_h 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,5 @@
+Allow V8 trap handling on OpenBSD.
+
Index: codex-rs/modcargo-crates/v8-150.4.0/v8/src/trap-handler/trap-handler.h
--- codex-rs/modcargo-crates/v8-150.4.0/v8/src/trap-handler/trap-handler.h.orig
+++ codex-rs/modcargo-crates/v8-150.4.0/v8/src/trap-handler/trap-handler.h
Index: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_wasm_stacks_cc
===================================================================
RCS file: patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_wasm_stacks_cc
diff -N patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_wasm_stacks_cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-codex-rs_modcargo-crates_v8-150_4_0_v8_src_wasm_stacks_cc 13 Oct 2026 19:45:59 -0000
@@ -0,0 +1,31 @@
+Mark only the usable WASM stack segment with MAP_STACK on OpenBSD.
+Preserve both no-access guard pages and the existing allocation lifetime.
+
+Index: codex-rs/modcargo-crates/v8-150.4.0/v8/src/wasm/stacks.cc
+--- codex-rs/modcargo-crates/v8-150.4.0/v8/src/wasm/stacks.cc.orig
++++ codex-rs/modcargo-crates/v8-150.4.0/v8/src/wasm/stacks.cc
+@@ -4,6 +4,10 @@
+
+ #include "src/wasm/stacks.h"
+
++#if V8_OS_OPENBSD
++#include <sys/mman.h>
++#endif
++
+ #include "src/base/platform/platform.h"
+ #include "src/execution/frames.h"
+ #include "src/execution/simulator.h"
+@@ -86,6 +90,13 @@ StackMemory::StackSegment::StackSegment(size_t pages)
+ "StackMemory::StackSegment::StackSegment");
+ }
+ limit_ += page_size;
++#if V8_OS_OPENBSD
++ if (mmap(limit_, size_, PROT_READ | PROT_WRITE,
++ MAP_FIXED | MAP_STACK | MAP_ANON | MAP_PRIVATE, -1, 0) == MAP_FAILED) {
++ V8::FatalProcessOutOfMemory(nullptr,
++ "StackMemory::StackSegment::StackSegment");
++ }
++#endif
+ #ifdef V8_ENABLE_SANDBOX_HARDWARE_SUPPORT
+ // The actual stack memory must be accessible to sandboxed code, so we need
+ // to register it as sandbox extension memory here.
Index: patches/patch-codex-rs_tcp-tunnel_Cargo_toml
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-codex-rs_tcp-tunnel_Cargo_toml,v
diff -u -p -u -p -r1.1 patch-codex-rs_tcp-tunnel_Cargo_toml
--- patches/patch-codex-rs_tcp-tunnel_Cargo_toml 22 Sep 2026 22:08:21 -0000 1.1
+++ patches/patch-codex-rs_tcp-tunnel_Cargo_toml 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,6 @@
+Use the pinned h3 DIST_TUPLE source for both crates instead of a build-time
+Git fetch.
+
Index: codex-rs/tcp-tunnel/Cargo.toml
--- codex-rs/tcp-tunnel/Cargo.toml.orig
+++ codex-rs/tcp-tunnel/Cargo.toml
Index: patches/patch-codex-rs_tui_src_app_daemon_menu_rs
===================================================================
RCS file: patches/patch-codex-rs_tui_src_app_daemon_menu_rs
diff -N patches/patch-codex-rs_tui_src_app_daemon_menu_rs
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-codex-rs_tui_src_app_daemon_menu_rs 13 Oct 2026 19:45:59 -0000
@@ -0,0 +1,28 @@
+Keep the daemon enabled while directing package updates to pkg_add.
+Do not offer self-installation actions for a distributor-owned executable.
+
+Index: codex-rs/tui/src/app/daemon_menu.rs
+--- codex-rs/tui/src/app/daemon_menu.rs.orig
++++ codex-rs/tui/src/app/daemon_menu.rs
+@@ -39,6 +39,10 @@ impl App {
+ Some(
+ "Manage this server on its host. Local daemon updates are unavailable for remote connections.",
+ )
++ } else if codex_app_server_daemon::system_daemon_path().is_some() {
++ Some(
++ "The daemon is installed by the system package manager. Use pkg_add -u, then codex app-server daemon restart.",
++ )
+ } else if self.daemon_cli_executable.is_none() {
+ Some("Run the Codex CLI to manage the daemon from this menu.")
+ } else {
+@@ -89,7 +93,9 @@ impl App {
+ let Some(executable) = &self.daemon_cli_executable else {
+ return;
+ };
+- if matches!(self.app_server_target, AppServerTarget::Remote { .. }) {
++ if matches!(self.app_server_target, AppServerTarget::Remote { .. })
++ || codex_app_server_daemon::system_daemon_path().is_some()
++ {
+ return;
+ }
+ let mut explanation = match source {
Index: patches/patch-tokio-tungstenite_Cargo_toml
===================================================================
RCS file: /cvs/ports/devel/codex/patches/patch-tokio-tungstenite_Cargo_toml,v
diff -u -p -u -p -r1.3 patch-tokio-tungstenite_Cargo_toml
--- patches/patch-tokio-tungstenite_Cargo_toml 23 Jun 2026 13:47:22 -0000 1.3
+++ patches/patch-tokio-tungstenite_Cargo_toml 13 Oct 2026 19:45:59 -0000
@@ -1,3 +1,6 @@
+Resolve tungstenite from the pinned DIST_TUPLE source rather than fetching
+the fork during the build.
+
Index: tokio-tungstenite/Cargo.toml
--- tokio-tungstenite/Cargo.toml.orig
+++ tokio-tungstenite/Cargo.toml
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/devel/codex/pkg/PLIST,v
diff -u -p -u -p -r1.8 PLIST
--- pkg/PLIST 9 Aug 2026 11:29:25 -0000 1.8
+++ pkg/PLIST 13 Oct 2026 19:45:59 -0000
@@ -1,6 +1,11 @@
-@bin bin/codex
-@bin bin/codex-code-mode-host
+bin/codex
+bin/codex-code-mode-host
@bin bin/codex-logs-client
+libexec/codex/
+libexec/codex/bin/
+@bin libexec/codex/bin/codex
+@bin libexec/codex/bin/codex-code-mode-host
+libexec/codex/codex-package.json
share/bash-completion/completions/codex
share/doc/codex/
share/doc/codex/CLA.md
Index: pkg/README
===================================================================
RCS file: /cvs/ports/devel/codex/pkg/README,v
diff -u -p -u -p -r1.2 README
--- pkg/README 24 Aug 2026 16:39:57 -0000 1.2
+++ pkg/README 13 Oct 2026 19:45:59 -0000
@@ -20,3 +20,42 @@ datasize limit in used login class..
Also, ${PKGSTEM} may use a lot of open files, you may need to raise both
the system-wide maxfiles and used login class limits.
+
+The local app-server daemon is enabled for eligible interactive sessions by
+upstream's daemon_auto_start feature (enabled by default). It uses the same
+executable as the CLI, installed at:
+
+ ${LOCALBASE}/libexec/codex/bin/codex
+
+${LOCALBASE}/bin/codex is a link to that executable. The code-mode host is
+installed beside it, and ${LOCALBASE}/libexec/codex/codex-package.json records
+the package's version and native OpenBSD target. Codex checks the manifest and
+executable versions before a new daemon start; no npm or Node.js is needed.
+
+The daemon runs as the invoking user. Codex starts it on demand, detaches it
+from the terminal, and leaves it running for other clients. Lifecycle commands:
+
+ codex app-server daemon start
+ codex app-server daemon version
+ codex app-server daemon restart
+ codex app-server daemon stop
+
+PID records, logs, settings, and recovery data remain under CODEX_HOME
+(default ~/.codex). The advertised socket is under app-server-control there;
+on Unix it points to a protected socket under /tmp/codex-daemon-<uid>.
+The daemon inherits the environment of the terminal that starts it, shared
+by later clients. There is no system rc.d service and no restart after reboot.
+
+The package manager owns the executable, host, and manifest. Use pkg_add -u
+to update them, then `codex app-server daemon restart`. A running process keeps
+its old image; an incompatible daemon version is reported with restart
+instructions rather than being silently reused or internally replaced.
+Restart also picks up port revisions with an unchanged upstream version.
+
+Codex's daemon updater and --from-cli package replacement are disabled, not
+the daemon. The /daemon update menu directs updates to pkg_add. No daemon
+executable or package manifest is copied to ~/.codex/packages. Other optional
+user-installed components and existing packages are left alone.
+
+When migrating from an internally managed daemon, stop it with the old CLI
+before replacing the package. No user-managed package files are deleted.
[IMPROVEMENT] Integrate the app server daemon into devel/codex.
[IMPROVEMENT] Integrate the app server daemon into devel/codex.
[IMPROVEMENT] Integrate the app server daemon into devel/codex.