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

Jan Beulich jbeulich@suse.com
Fri May 16 06:49:39 GMT 2025
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"

here, you'll get what you want. Without any need for an absurdly long
directive (and else I would at least ask to shorten to to e.g.
.pushuniqsect). And usable with .section as well.

Jan


More information about the Binutils mailing list