binutils Newspaper
OCTOBER 6, 2026
gas — Proposed

gas: add flex mode to .bundle_lock

Enables GAS to accept oversized sequences in .bundle_lock directives for flexible alignment.

This patch introduces a ‘flex mode’ to the .bundle_lock directive in GNU Assembler (GAS), allowing sequences larger than the defined bundle size. It preserves existing alignment handling and strict checks for ordinary locks. New test cases are included to cover various scenarios, including straddling, non-straddling, oversized, and nested locks.

In the Thread 1 participant
  1. Sarvesh Chandra <Sarvesh.Chandra@amd.com> proposer

    Proposes to add a flex mode to `.bundle_lock` that allows sequences larger than the bundle size, and includes new test cases for various lock scenarios.

    “Allow .bundle_lock flex to accept sequences larger than the bundle size. Keep the existing alignment handling and strict checks for ordinary locks. Add tests for straddling, non-straddling, oversized, and nested locks.”

In Details

This patch modifies the gas assembler to introduce a 'flex' mode for the .bundle_lock directive. Previously, .bundle_lock enforced strict alignment based on bundle_align_p2, preventing sequences from exceeding a calculated bundle size. The change allows this check to be bypassed when bundle_flex_lock is enabled, accommodating oversized sequences while maintaining existing alignment rules for non-flex locks. New test cases are added to cover these expanded capabilities.

For Context
gas
GNU Assembler, the assembler used in the GNU toolchain, responsible for converting assembly language code into machine code.
.bundle_lock
An assembler directive used to group instructions into bundles, often for performance or alignment purposes on certain architectures.
flex mode
A mode of operation for .bundle_lock that relaxes strict size constraints, allowing for sequences that might otherwise be rejected.
alignment
The practice of arranging data or instructions in memory at specific addresses, often multiples of a certain number, to improve processing efficiency.
Filed Under: gasassemblerx86optimizationdirective