binutils Newspaper
NOVEMBER 30, 2026
gas — Proposed

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

Developer inquires about the status of a patch adding section management pseudo-ops to COFF targets in gas.

Johannes Khoshnazar-Thoma is following up on a previously submitted patch (v5) that adds support for .previous, .pushsection, and .popsection pseudo-operations to the GNU Assembler (gas) for COFF targets. He notes that this patch is a prerequisite for compiling the Linux kernel as a Windows/ReactOS driver and asks for an update on its merging status, inquiring if any further action is needed.

In the Thread 2 participants
  1. Johannes Khoshnazar-Thoma proposer

    Inquired about the merging status of a patch that adds section management pseudo-ops for COFF targets.

    “Any plans to get that merged? Do you need anything else?”
  2. Johannes Khoshnazar-Thoma proposer

    Originally submitted the patch, explaining its purpose and context.

    “This patch adds support for the .previous, .pushsection and .popsection pseudo-ops for COFF targets. The semantics are the same as their ELF counterparts. This patch is one building block for compiling the Linux kernel as a Windows/ReactOS driver.”

Technical Tradeoffs

  • Ensuring the new pseudo-ops behave identically to their ELF counterparts in the COFF context.
  • Testing thoroughly across various COFF targets and scenarios to catch edge cases.
  • The complexity introduced by more advanced section management might make assembly code harder to write or debug for those unfamiliar with it.

In Details

This discussion is a follow-up on a patch series (v5) that aims to enhance the GNU Assembler's (gas) support for the COFF object file format. Specifically, it introduces pseudo-operations like .previous, .pushsection, and .popsection, which provide more granular control over section management, mirroring ELF's capabilities. The primary motivation cited is enabling the compilation of the Linux kernel for Windows/ReactOS driver development, which requires robust COFF support.

For Context
gas
The GNU Assembler, part of the GNU Binutils package, responsible for translating assembly language into machine code.
.previous
A pseudo-operation that instructs the assembler to return to the section that was current before the most recent .section or .pushsection directive.
.pushsection
A pseudo-operation that saves the current section and starts a new one, similar to push on a stack.
.popsection
A pseudo-operation that restores the section that was previously saved by .pushsection, similar to pop from a stack.
COFF
Common Object File Format, an older object file format used on Windows and some other systems. It is the precursor to PE.
ELF
Executable and Linkable Format, the standard object file format used on most Unix-like systems, including Linux.
pseudo-ops
Pseudo-operations, also known as assembler directives, are instructions to the assembler that do not generate machine code themselves but control the assembly process (e.g., defining sections, symbols, or macros).
Filed Under: binutilsgascoffpseudo-opssection management