From 815d88c014d166a633b24942023e0f2438387285 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20M=C3=BCller?= Date: Wed, 13 Nov 2024 17:51:58 +0100 Subject: [PATCH] Add documentation for indirect branch tracking flags (#796) These flags were added in https://github.com/crystal-lang/crystal/pull/15122 They are put in a new section *Codegen Features*. The existing *Compiler Features* section is renamed to *Language Features*. --- docs/man/required_libraries.md | 2 +- docs/syntax_and_semantics/autocasting.md | 2 +- docs/syntax_and_semantics/compile_time_flags.md | 13 +++++++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/docs/man/required_libraries.md b/docs/man/required_libraries.md index 132705e0f..889236b2f 100644 --- a/docs/man/required_libraries.md +++ b/docs/man/required_libraries.md @@ -68,7 +68,7 @@ Using a standalone library over the system library implementation can be enforce ### TLS -TLS protocol implementation and general-purpose cryptographic routines for the [`OpenSSL`](https://crystal-lang.org/api/OpenSSL.html) API. May be disabled with the `-Dwithout_openssl` [compile-time flag](../syntax_and_semantics/compile_time_flags.md#compiler-features). +TLS protocol implementation and general-purpose cryptographic routines for the [`OpenSSL`](https://crystal-lang.org/api/OpenSSL.html) API. May be disabled with the `-Dwithout_openssl` [compile-time flag](../syntax_and_semantics/compile_time_flags.md#stdlib-features). Both `OpenSSL` and `LibreSSL` are supported and the bindings automatically detect which library and API version is available on the host system. diff --git a/docs/syntax_and_semantics/autocasting.md b/docs/syntax_and_semantics/autocasting.md index 2c4e697a9..1231bbfdd 100644 --- a/docs/syntax_and_semantics/autocasting.md +++ b/docs/syntax_and_semantics/autocasting.md @@ -27,7 +27,7 @@ bar64(bar 1) # OK, a Float32 can be autocasted to a Float64 Number literals are always casted when the actual value of the literal fits the target type, despite of its type. -Expressions are casted (like in the last example above), unless the flag `no_number_autocast` is passed to the compiler (see [Compiler features](compile_time_flags.md#compiler-features)). +Expressions are casted (like in the last example above), unless the flag `no_number_autocast` is passed to the compiler (see [Compiler features](compile_time_flags.md#language-features)). If there is ambiguity, for instance, because there is more than one option, the compiler throws an error: diff --git a/docs/syntax_and_semantics/compile_time_flags.md b/docs/syntax_and_semantics/compile_time_flags.md index e40501898..305f94ed4 100644 --- a/docs/syntax_and_semantics/compile_time_flags.md +++ b/docs/syntax_and_semantics/compile_time_flags.md @@ -145,9 +145,9 @@ Crystal program. | `without_openssl` | Build without OpenSSL support | `without_zlib` | Build without Zlib support -### Compiler features +### Language features -These flags enable or disable compiler features when building a Crystal program. +These flags enable or disable language features when building a Crystal program. | Flag name | Description | |-----------|-------------| @@ -156,6 +156,15 @@ These flags enable or disable compiler features when building a Crystal program. | `preview_overload_order` | Enable more robust ordering between def overloads. Introduced in 1.6 ([#10711](https://github.com/crystal-lang/crystal/issues/10711)). | `strict_multi_assign` | Enable strict semantics for [one-to-many assignment](assignment.md#one-to-many-assignment). Introduced in 1.3.0 ([#11145](https://github.com/crystal-lang/crystal/pull/11145), [#11545](https://github.com/crystal-lang/crystal/pull/11545)) +### Codegen features + +These flags enable or disable codegen features when building a Crystal program. + +| Flag name | Description | +|-----------|-------------| +| `cf-protection=branch`, `cf-protection=return`, `cf-protection=full` | Indirect branch tracking for x86 and x86_64. Implicitly set on OpenBSD. Introduced in 1.15.0 ([#15122](https://github.com/crystal-lang/crystal/pull/15122)) +| `branch-protection=bti` | Indirect branch tracking for aarch64. Implicitly set on OpenBSD. Introduced in 1.15.0 ([#15122](https://github.com/crystal-lang/crystal/pull/15122)) + ### Compiler build features These flags enable or disable features when building the Crystal compiler.