[Bug c++/94342] GCC ignores attribute((section(...))) for static variables inside templates

2020-03-27 Thread bikineev at google dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94342 --- Comment #10 from Anton --- I think there are two ways to handle the problem for targets that don't support COMDAT: 1) issue a diagnostic that the section attribute will be ignored (because it'll go to .gnu.linkone.*); 2) fallback to weak symb

[Bug c++/94342] GCC ignores attribute((section(...))) for static variables inside templates

2020-03-27 Thread bikineev at google dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94342 --- Comment #8 from Anton --- Yeah, the generated sections are different yet have the same name. The user would rely on the static linker to merge the sections into a single one.

[Bug c++/94342] GCC ignores attribute((section(...))) for static variables inside templates

2020-03-26 Thread bikineev at google dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94342 --- Comment #6 from Anton --- I also don't understand why all the parts of a template instantiation need to be kept in the same COMDAT group. Neither clang nor gcc does it: template voi

[Bug c++/94342] GCC ignores attribute((section(...))) for static variables inside templates

2020-03-26 Thread bikineev at google dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94342 --- Comment #5 from Anton --- Looking at the COMDAT groups for the example with 2 instantiations (Index and Index), I think this is what is actually expected: section for Index must not be grouped with section for Index. In general, different ins

[Bug c++/94342] New: GCC ignores attribute((section(...))) for static variables inside templates

2020-03-26 Thread bikineev at google dot com
: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: bikineev at google dot com Target Milestone: --- GCC ignores the section attribute for static variables declared inside templates: template