[PATCH] gas: Add pushuniquesection and --unique-pushsection

Jan Beulich jbeulich@suse.com
Fri May 16 07:19:43 GMT 2025
On 16.05.2025 09:00, H.J. Lu wrote:
> On Fri, May 16, 2025 at 2:49 PM Jan Beulich <jbeulich@suse.com> wrote:
>>
>> On 16.05.2025 08:15, H.J. Lu wrote:
>>> Linker kernel uses .pushsection directive extensively.  But when
>>> -ffunction-sections is used to build kernel, for
>>>
>>> __attribute__((always_inline))
>>> static void inline
>>> test_section(void)
>>> {
>>>   asm goto("jmp 1f\n"
>>>    "\t.pushsection .alt_section, \"ax\"\n"
>>
>> If you pass --sectname-subst to the assembler and use
>>
>>     "\t.pushsection .alt_section%S, \"ax\"\n"
> 
> This isn't very programmer friendly.  One needs to change
> the source and add a new assembler option.

The source needs changing with your proposal, too. And the assembler
option change isn't a difficult one. Plus one can use this with a
range of already released versions, whereas your handling of a sub-case
thereof would be available only with future releases. I think the
benefit of adding special-case handling for something where a more
generic solution already exists needs to be a bit wider than just the
avoiding of the need to add a command line option (typically somewhere
in a central place in a make system).

Jan


More information about the Binutils mailing list