[llvm-branch-commits] MC: Add directive for specifying a section's preferred alignment. (PR #150151)

Peter Collingbourne via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Jan 13 18:23:53 PST 2026


================
@@ -28,6 +28,21 @@ hexadecimal format instead of decimal if desired.
   .section .data
   .float 0x1c2.2ap3
 
+``.prefalign`` directive
+------------------------
+
+The ``.prefalign`` directive sets the preferred alignment for a section,
+and enables the section's final alignment to be set in a way that is
+dependent on the section size (currently only supported with ELF).
+
+If the section size is less than the section's minimum alignment as
+determined using ``.align`` family directives, the section's alignment
+will be equal to its minimum alignment. Otherwise, if the section size is
----------------
pcc wrote:

Higher alignments can also consume space in the binary for no clear benefit, especially in binaries containing large numbers of small functions. The goal of the preferred alignment scheme is to reduce this, as well as enabling section placement based optimizations such as CFI jump table inlining.

https://github.com/llvm/llvm-project/pull/150151


More information about the llvm-branch-commits mailing list