Re: [PATCH] gas: support for .pushsection and .popsection pseudo ops for coff

Johannes Khoshnazar-Thoma <[email protected]> Fri, 24 Jul 2026 14:35:02 +0200
Newsgroups gmane.comp.gnu.binutils
Message-ID <[email protected]>
Am 24.07.26 um 09:09 schrieb Jan Beulich:
> On 18.07.2026 18:22, Johannes Khoshnazar-Thoma wrote:
>> Current Linux kernels make heavy use of the .pushsection and
>> .popsection pseudo ops. Normally, the Linux kernel is built
>> as an ELF object, where the assembler supports those pseudo
>> ops. When compiling the Linux kernel as a Windows/ReactOS
>> driver however, it must be compiled as a COFF object, since
>> the Windows/ReactOS kernel does not know how to load ELF
>> binaries.
>>
>> In order to be able to compile the Linux kernel as a COFF
>> object (and further on as a PE32 native executable) the
>> implementation of those pseudo ops has been copiied from
>> the obj-elf.c support code to the obj-coff.c support code.
>> It has been verified that the Linux kernel works without
>> assembler errors when using an assembler with this patch.
> 
> First - don't you also need to support .previous then?
> 
Good point. Currently, the Windows architecture re-uses some
of the (i386) x86 headers. .previous is not used in those
headers. It may become relevant, if we add arm/arm64 as a
SUBARCH to the windows ARCH. If we need it, I would send
an extra patch.

Best regards, and thanks for looking into this,

- Johannes