GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
avr

AVR: Supports [[len=<words>]] notes in inline asm to specify its size.

GCC now supports `[[len=<words>]]` notes in AVR inline assembly to specify the size of the assembly code.

This commit adds support for [[len=<words>]] notes in AVR inline assembly constructs. This feature allows developers to specify the size of inline assembly code, which is essential for correct jump offset calculations and better code generation, especially when jumps cross assembly blocks. It is implemented in ADJUST_INSN_LENGTH.

In Details

This patch introduces support for [[len=<words>]] notes in AVR inline assembly, processed within ADJUST_INSN_LENGTH. The supported <words> include decimal integers, asm operand references (%[0-9]+, %[<name>]), and AVR-specific keywords (lds, sts, %~, %~call, %~jmp). Incorrect or unrecognized notes will cause the default instruction length to be used.

For Context

Inline assembly allows developers to embed assembly code directly within C/C++ code. The compiler needs to know the size of the assembly code to correctly calculate jump offsets and generate efficient code. This commit introduces a mechanism for specifying the size of inline assembly blocks in AVR programs, allowing the compiler to generate more accurate and optimized code.

Filed Under: avrinline assemblyoptimizationcode generation