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

Jan Beulich <[email protected]> Fri, 31 Jul 2026 13:49:22 +0200
Newsgroups gmane.comp.gnu.binutils
Message-ID <[email protected]>
On 31.07.2026 13:22, Johannes Khoshnazar-Thoma wrote:
> Am 31.07.26 um 11:58 schrieb Jan Beulich:
>> On 24.07.2026 14:28, Johannes Khoshnazar-Thoma wrote:
>>> @@ -1898,6 +1932,8 @@ static const pseudo_typeS coff_pseudo_table[] =
>>>     {"ident", obj_coff_ident, 0},
>>>     {"line", obj_coff_line, 0},
>>>     {"ln", obj_coff_ln, 0},
>>> +  {"pushsection", obj_coff_section, 1},
>>> +  {"popsection", obj_coff_popsection, 0},
>>>     {"scl", obj_coff_scl, 0},
>>>     {"sect", obj_coff_section, 0},
>>>     {"sect.s", obj_coff_section, 0},
>>
>> While now you insert at the right spot, what you insert is still the wrong
>> way round. Beyond this things look okay now as far as these two directives
>> go, but (to re-state the obvious) support for .previous is still missing.
> 
> Thank you for looking at my patch. I will address your concerns,
> but I have a question regarding .previous support: in the obj_elf.c
> code there is a obj_elf_section_change_hook() function which is
> also called at many places in the processor-specific backends
> (and also from read.c). Implementing .previous would require
> adding a obj_coff_section_change_hook() to be called when
> anyone changes the section in other files, am I right? Or is
> it not necessary in the coff case to have such a hook?

That's going to be necessary, yes.

> How would I identify backends that have coff support?

Look for uses of fmt=coff in gas/configure.tgt.

> And how would I be able to test all those backends?

By building cross tools (passing --target=... to configure) and then running
"make check" on them just like you do for natively built tools.

Jan