https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88061
Bug ID: 88061 Summary: section attributes of variable templates are ignored Product: gcc Version: 7.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: henrik-public at gmx dot net Target Milestone: --- When providing a variable template with a section attribute its instantiations do not appear in the specified section: ========================================================== template<unsigned x> [[gnu::section(".my_data")]] const unsigned g_my_data {x}; template const unsigned g_my_data<0xf0f0f0f0>; ========================================================== $ g++-7 -c main.cpp -o main.o -std=c++14 $ objdump main.o --full-content main.o: Format elf64-x86-64 Section .group: 0000 01000000 05000000 ........ Section .rodata._Z9g_my_dataILj4042322160EE: 0000 f0f0f0f0 .... Section .comment: 0000 00474343 3a202855 62756e74 7520372e .GCC: (Ubuntu 7. 0010 332e302d 32337562 756e7475 327e3136 3.0-23ubuntu2~16 0020 2e30342e 796f726b 30292037 2e332e30 .04.york0) 7.3.0 0030 00 .