https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122516
--- Comment #9 from H.J. Lu <hjl.tools at gmail dot com> --- commit r11-6140-g6175383249143309fdc780a02bea484f4450def7 Author: H.J. Lu <[email protected]> Date: Thu Dec 3 11:01:06 2020 -0800 Switch to a new section if the SECTION_RETAIN bit doesn't match When definitions marked with used attribute and unmarked definitions are placed in the section with the same name, switch to a new section if the SECTION_RETAIN bit doesn't match. gcc/ PR target/98146 * output.h (switch_to_section): Add a tree argument, default to nullptr. * varasm.c (get_section): If the SECTION_RETAIN bit doesn't match, return and switch to a new section later. (assemble_start_function): Pass decl to switch_to_section. (assemble_variable): Likewise. (switch_to_section): If the SECTION_RETAIN bit doesn't match, switch to a new section. doesn't work with asm ("\t.section\t.fini"); __do_global_dtors_aux (); asm ("\t.section\t.text");
