binutils Newspaper
OCTOBER 6, 2026
gas — Proposed

gas: support for .previous, .pushsection and .popsection pseudo ops for coff

Adds .previous, .pushsection, and .popsection pseudo-ops to gas for COFF targets, enabling Linux kernel compilation for Windows drivers.

This patch introduces support for .previous, .pushsection, and .popsection pseudo-operations in the GNU Assembler (gas) for COFF targets. These directives provide section stacking capabilities, mirroring their ELF counterparts. The implementation is a foundational step towards compiling the Linux kernel as a Windows or ReactOS driver, which requires these section management features.

In Details

This patch adds support for section management directives .pushsection, .popsection, and .previous to the gas assembler when targeting COFF object file formats. These directives are crucial for code that needs to dynamically switch between different sections during assembly, a common requirement for complex code generation scenarios like compiling the Linux kernel for Windows/ReactOS drivers. The implementation mirrors the existing functionality for ELF targets.

For Context
gas
GNU Assembler, the assembler used in the GNU toolchain.
COFF
Common Object File Format. A file format for executables, object code, and libraries, primarily used on Windows systems.
pseudo-ops
Assembler directives that do not generate machine code but control the assembly process, such as defining sections or symbols.
.previous
A gas pseudo-op that restores the previously active section.
.pushsection
A gas pseudo-op that saves the current section and then activates a new section.
.popsection
A gas pseudo-op that restores the section that was most recently saved by .pushsection.
ELF
Executable and Linkable Format. A common file format for object code, executables, and shared libraries on Unix-like systems.
Filed Under: binutilsgasCOFFassembler directives