On 12/16/19 6:20 PM, Jason Merrill wrote:
On 11/29/19 6:23 PM, Strager Neds wrote:
How can we solve this problem? Some ideas (none of which I like):
* Disallow this code, possibly with an improved diagnostic.
* Silently make the section SECTION_LINKONCE if there is a conflict.
* Silently make the section not-SECTION_LINKONCE if there is a conflict.
* Silently make the section not-SECTION_LINKONCE unconditionally (even
if there is no conflict).
* Make two sections with the same name, one with SECTION_LINKONCE and
one with not-SECTION_LINKONCE. This is what Clang does. Clang seems to
Do What I Mean for ELF; the .o file has one COMDAT section and another
non-COMDAT section.
* Extend attribute((section())) to allow specifying different section
names for different section flags.
Thanks in advance for your feedback!
s<public_symbol>::var should probably go into its own COMDAT section named
something like .gnu.linkonce.testsection.<mangled name>. Currently
resolve_unique_section does nothing if DECL_SECTION_NAME is set.
coincidentally I fell over this (again) recently. I agree, [[gnu::section
("prefix")]] on a template should use that as a prefix to the comdat section for
the instantiations -- overriding the default of .rodata or .data for variable
instantiations for example.
nathan
--
Nathan Sidwell