https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81926
--- Comment #15 from Richard Biener <rguenth at gcc dot gnu.org> --- Note that dwarf2out.c causes the section to be emitted via static void dwarf2out_assembly_start (void) { #ifndef DWARF2_LINENO_DEBUGGING_INFO ASM_GENERATE_INTERNAL_LABEL (text_section_label, TEXT_SECTION_LABEL, 0); ASM_GENERATE_INTERNAL_LABEL (text_end_label, TEXT_END_LABEL, 0); ASM_GENERATE_INTERNAL_LABEL (cold_text_section_label, COLD_TEXT_SECTION_LABEL, 0); ASM_GENERATE_INTERNAL_LABEL (cold_end_label, COLD_END_LABEL, 0); switch_to_section (text_section); ASM_OUTPUT_LABEL (asm_out_file, text_section_label); #endif ... part of the code refering to the label is guarded by a text_section_used flag btw., not sure if that works reliably enough but I guess it is only properly initialized after the above. Thus the middle-end would need to support sth like 'give me a label at the start of section FOO'. The easiest workaround is indeed to always emit .text (which indeed gas does). And I'd rather do that where the assemby_start debug hook is called instead of in target specific hooks.