Skip to content

Commit

Permalink
Add documentation for indirect branch tracking flags (#796)
Browse files Browse the repository at this point in the history
These flags were added in crystal-lang/crystal#15122

They are put in a new section *Codegen Features*. The existing *Compiler Features* section is renamed to *Language Features*.
  • Loading branch information
straight-shoota authored Nov 13, 2024
1 parent 8384739 commit 815d88c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/man/required_libraries.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion docs/syntax_and_semantics/autocasting.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
13 changes: 11 additions & 2 deletions docs/syntax_and_semantics/compile_time_flags.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
|-----------|-------------|
Expand All @@ -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.
Expand Down

0 comments on commit 815d88c

Please sign in to comment.