You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/doc/rustc/src/codegen-options/index.md
+22Lines changed: 22 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -346,6 +346,28 @@ opt-level=0`](#opt-level)). That is:
346
346
347
347
See also [linker-plugin-lto](#linker-plugin-lto) for cross-language LTO.
348
348
349
+
## min-function-alignment
350
+
351
+
The `-Cmin-function-alignment=<align>` flag specifies the minimum alignment of functions for which code is generated.
352
+
The `align` value must be a power of 2, other values are rejected.
353
+
354
+
Note that `-Zbuild-std` (or similar) is required to apply this minimum alignment to standard library functions.
355
+
By default, these functions come precompiled and their alignments won't respect the `min-function-alignment` flag.
356
+
357
+
This flag is equivalent to:
358
+
359
+
-`-fmin-function-alignment` for [GCC](https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#index-fmin-function-alignment_003dn)
360
+
-`-falign-functions` for [Clang](https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang1-falign-functions)
361
+
362
+
The specified alignment is a minimum. A higher alignment can be specified for specific functions by annotating the function with a `#[align(<align>)]` attribute.
363
+
The attribute's value is ignored when it is lower than the value passed to `min-function-alignment`.
364
+
365
+
There are two additional edge cases for this flag:
366
+
367
+
- targets have a minimum alignment for functions (e.g. on x86_64 the lowest that LLVM generates is 16 bytes).
368
+
A `min-function-alignment` value lower than the target's minimum has no effect.
369
+
- the maximum alignment supported by rust (and LLVM) is `2^29`. Trying to set a higher value results in an error.
370
+
349
371
## metadata
350
372
351
373
This option allows you to control the metadata used for symbol mangling. This
0 commit comments