binutils Newspaper
NOVEMBER 30, 2026
gas — Proposed

gas: factor bundle-lock state into struct bundle_region

Refactors GAS's bundle lock mechanism by encapsulating state into a `struct bundle_region` for better management.

This patch is the first part of a series introducing a flexible mode for the .bundle_lock directive in GAS. It refactors the existing global variables that managed the state of the strict bundle lock (fragment, fragment chain, depth) into a new struct bundle_region. This change is non-functional on its own but prepares the ground for supporting multiple types of bundle regions, such as the upcoming flex mode.

In the Thread 1 participant
  1. Sarvesh Chandra proposer

    Submits a patch to refactor GAS's bundle lock state into a dedicated structure.

    “Introduce a reusable struct bundle_region holding the frag, frchain, depth and alignment exponent of a bundle-locked region, replacing the separate bundle_lock_frag/bundle_lock_frchain/bundle_lock_depth globals. start_bundle and finish_bundle now take the alignment exponent as a parameter, and a region is opened and closed through new bundle_region_open and bundle_region_close helpers. This is a…”

In Details

This is a preparatory, non-functional change for GAS's assembly directive processing. It consolidates the per-region state for the .bundle_lock directive (specifically, the start fragment, fragment chain, and depth counter) into a struct bundle_region. This abstraction is designed to enable the future support of concurrent or alternative locking mechanisms, such as the proposed .bundle_lock flex mode, without modifying the core directive handling logic extensively.

For Context
GAS
GNU Assembler. The assembler used in the GNU toolchain, responsible for converting assembly language code into machine code.
struct
A composite data type in C programming language that groups together variables of different data types under a single name.
frag
Abbreviation for 'fragment'. In GAS, a fragment represents a piece of output, such as code or data, that the assembler is constructing. These are chained together to form sections.
frchain
Fragment chain. A linked list of fragments that together constitute a section in the output object file.
.bundle_lock
An assembler directive used to align subsequent code to specific bundle boundaries, often for performance-sensitive code on architectures with instruction bundles.
Filed Under: binutilsgasrefactoringcode structure