Re: Proposal: inline GNU .S assembler block in C — __asm_section__ (proposal & PoC offer)
David Brown
david.brown@hesbynett.no
Mon Jan 19 13:18:18 GMT 2026
On 19/01/2026 13:47, Доля Денис via Gcc wrote:
> Dear GCC developers, I propose a small C-language extension that allows
> embedding full GNU-style .S assembler code (including directives such as
> .type, .size, .global, local labels and section directives) directly inside
> a C source file as a dedicated block (for example
> __asm_section__(".text.critical"){ ... };); this would improve code
> locality, reduce the need for separate .S files and related build-system
> friction, and let developers keep full assembler syntax next to the
> corresponding C functions — important considerations include preserving the
> assembler text through the compilation pipeline, handling differences
> between assembler/toolchain versions, symbol visibility and correct section
> placement, and adding tests to ensure correct emission of .type/.size and
> ABI compatibility; please advise whether it is preferable to open a
> Bugzilla entry first or to start a design discussion on the developer
> mailing list. Best regards, Denis
>
See <https://gcc.gnu.org/gcc-15/changes.html#c-family>
You can now put asm blocks outside of functions, which I think will do
all that you are asking for here.
More information about the Gcc
mailing list