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
+22
Original file line number
Diff line number
Diff line change
@@ -331,6 +331,28 @@ opt-level=0`](#opt-level)). That is:
331
331
332
332
See also [linker-plugin-lto](#linker-plugin-lto) for cross-language LTO.
333
333
334
+
## min-function-alignment
335
+
336
+
The `-Cmin-function-alignment=<align>` flag specifies the minimum alignment of functions for which code is generated.
337
+
The `align` value must be a power of 2, other values are rejected.
338
+
339
+
Note that `-Zbuild-std` (or similar) is required to apply this minimum alignment to standard library functions.
340
+
By default, these functions come precompiled and their alignments won't respect the `min-function-alignment` flag.
341
+
342
+
This flag is equivalent to:
343
+
344
+
-`-fmin-function-alignment` for [GCC](https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#index-fmin-function-alignment_003dn)
345
+
-`-falign-functions` for [Clang](https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang1-falign-functions)
346
+
347
+
The specified alignment is a minimum. A higher alignment can be specified for specific functions by annotating the function with a `#[repr(align(<align>))]` attribute.
348
+
The attribute's value is ignored when it is lower than the value passed to `min-function-alignment`.
349
+
350
+
There are two additional edge cases for this flag:
351
+
352
+
- targets have a minimum alignment for functions (e.g. on x86_64 the lowest that LLVM generates is 16 bytes).
353
+
A `min-function-alignment` value lower than the target's minimum has no effect.
354
+
- the maximum alignment supported by rust (and LLVM) is `2^29`. Trying to set a higher value results in an error.
355
+
334
356
## metadata
335
357
336
358
This option allows you to control the metadata used for symbol mangling. This
0 commit comments