The avr backend supports variable attributes like io(addr) https://gcc.gnu.org/onlinedocs/gcc/AVR-Variable-Attributes.html#index-io-variable-attribute_002c-AVR that require to assembly respective VAR_DECLs in a custom way that is not supported by varasm.cc::assemble_variable(). How can this be implemented in GCC? A clear and clean solution would be a new target hook to inhibit assemble_variable's output (so the backend can do its business), but such a hook has been rejected by the maintainers for aesthetic reasons without proposing a (working) solution. What does not work: 1) Let TARGET_ASM_SELECT_SECTION return a custom noswitch section and then use its callback to print asm. Reason: varasm.cc doesn't call the hook in that situation since it has its own understanding how bss and common are handled. 2) Let TARGET_ENCODE_SECTION_INFO set TREE_ASM_WRITTEN and store the decl for late asm out. Reason: Is a hack and runs into ICE due to many gcc_assert (!TREE_ASM_WRITTEN (decl)). 3) Define ASM_DECLARE_OBJECT_NAME to something like: do { if (condition) return; } while (0) Reason: assemble_variable_contents() is not called here, so the hook^H^H^Hack macro isn't invoked. 4) Current solution: set_decl_tls_model and asm out in the section callback of tls_comm_section. Reason: Is a hack and runs into gcc_checking_assert (targetm.have_tls || !DECL_THREAD_LOCAL_P (decl)); So would someone please point out how to implement this feature in such a way that it would pass global review, and that works with -f[no-]common and -f[no-]data-sections. Variables that are eligible for the attribute are in static storage and without DECL_INITIAL. FYI, here is a test case: $ avr-gcc -Os -S io.c #define IO10 __attribute((io(__AVR_SFR_OFFSET__ + 10))) IO10 volatile char sfr1; IO10 static volatile char sfr2; int main (void) { sfr1 = 0; sfr2 = 0; return 0; } Thanks Johann