Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion compiler/rustc_target/src/spec/base/openbsd.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use crate::spec::{FramePointer, Os, RelroLevel, TargetOptions, TlsModel, cvs};
use crate::spec::{Env, FramePointer, Os, RelroLevel, TargetOptions, TlsModel, cvs};

pub(crate) fn opts() -> TargetOptions {
TargetOptions {
os: Os::OpenBsd,
env: Env::OpenBsdCurrent,
dynamic_linking: true,
families: cvs!["unix"],
has_rpath: true,
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_target/src/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2045,6 +2045,7 @@ crate::target_spec_enum! {
Nto71 = "nto71",
Nto71IoSock = "nto71_iosock",
Ohos = "ohos",
OpenBsdCurrent = "openbsd8.0",
Relibc = "relibc",
Sgx = "sgx",
Sim = "sim",
Expand Down
17 changes: 16 additions & 1 deletion src/doc/rustc/src/platform-support/openbsd.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,22 @@ The target names follow this format: `$ARCH-unknown-openbsd`, where `$ARCH` spec

Note that all OS versions are *major* even if using X.Y notation (`6.8` and `6.9` are different major versions) and could be binary incompatibles (with breaking changes).

<!--
Whenever a new OpenBSD version releases, the following is in order:

- Update `` by updating the `Env` variant used for OpenBSD versions
- This may potentially need adding a new variant instead of updating
the current one if OpenBSD deprecates support for some target
architecture but we want to continue supporting it.

- Update `src/librustdoc/clean.rs` with a formatted string containing
the new version.
-->

> [!IMPORTANT]

@tgross35 tgross35 Sep 7, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though the contents of this block are more relevant for rustc developers (and should move to a comment as noted), please do add user-facing documentation about what version is supported (-current) and how target_env works

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

> Note these targets encode the latest OpenBSD version that supported
> them. In most cases, this means the version to be released once
> OpenBSD `-current` is made into a new `-release` release.

## Target Maintainers

Expand All @@ -30,7 +46,6 @@ Further contacts:

Fallback to ports@openbsd.org, OpenBSD third parties public mailing-list (with openbsd developers readers)


## Requirements

These targets are natively compiled and could be cross-compiled.
Expand Down
1 change: 1 addition & 0 deletions src/librustdoc/clean/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,7 @@ fn human_readable_target_env(env: Symbol) -> Option<&'static str> {
Nto71 => "QNX SDP 7.1",
Nto71IoSock => "QNX SDP 7.1 with io-sock",
Ohos => "OpenHarmony",
OpenBsdCurrent => "OpenBSD -current (8.0)",
P1 => "WASIp1",
P2 => "WASIp2",
P3 => "WASIp3",
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/check-cfg/well-known-values.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
LL | target_env = "_UNEXPECTED_VALUE",
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: expected values for `target_env` are: ``, `gnu`, `macabi`, `mlibc`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `nto71_iosock`, `ohos`, `p1`, `p2`, `p3`, `relibc`, `sgx`, `sim`, `uclibc`, and `v5`
= note: expected values for `target_env` are: ``, `gnu`, `macabi`, `mlibc`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `nto71_iosock`, `ohos`, `openbsd7.9`, `p1`, `p2`, `p3`, `relibc`, `sgx`, `sim`, `uclibc`, and `v5`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration

warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
Expand Down
Loading