[llvm] [MC,CodeGen] Update .prefalign for symbol-based preferred alignment (PR #184032)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 10 09:56:33 PDT 2026


MaskRay wrote:

> Are the .prefalign changed aligned with GNU as? Is there a precedence for `, nop`? Unless there's agreement already, I'm not in favor of the syntax and would prefer consistency with existing align directives: if no byte is specified, nops for code sections and zero for everything else, fill optional, and no nop keyword.

`.prefalign` is an extension not in GNU as. I've filed feature requests for binutils 
https://sourceware.org/bugzilla/show_bug.cgi?id=33943 and gcc https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124314
(I would have filed feature requested had I realized the landed prefalign IR/asm directive support is limited to `-ffunction-sections`, working for the author's setup but is unusual as an ELF asm directive).

Explicit `nop` or `<fill_byte>` is IMO clearer then the optional operands and implicit nop (dependent on the current section) in the existing alignment directives. This allows straightforward `trap` extension if we want to support `trap` for function start alignments.

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


More information about the llvm-commits mailing list