FRIDAY, SEPTEMBER 11, 2026
gas/coff
gas/coff: Support .previous and .{push,pop}section pseudo ops
Adds support for section management directives to the COFF object file format assembler.
The GNU Assembler (gas) now supports .previous, .pushsection, and .popsection pseudo-operations for COFF targets. This enables finer control over section placement and manipulation, crucial for tasks like compiling the Linux kernel for Windows-based systems (ReactOS).
In Details
This commit extends gas's COFF backend to support .previous, .pushsection, and .popsection. These directives, previously available for ELF, allow for manipulation of the current section, including saving and restoring previous states. This is a necessary step for cross-compiling projects like the Linux kernel for non-ELF targets such as COFF.
For Context
- gas
- The GNU Assembler, part of the binutils package. It translates assembly language into machine code.
- COFF
- Common Object File Format. An older object file format primarily used on Windows systems.
- ELF
- Executable and Linkable Format. A common object file format used on most Unix-like systems.
- pseudo-operation
- An assembler directive that does not generate machine code but controls the assembly process, such as defining sections or symbols.
- .previous
- An assembler pseudo-op that makes the section previously current the current section again.
- .pushsection
- An assembler pseudo-op that saves the current section and makes a new section current.
- .popsection
- An assembler pseudo-op that restores the most recently saved section as the current section.
- section
- A part of an object file that contains related data, such as code (.text), initialized data (.data), or uninitialized data (.bss).