This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Use normal section names for comdat group?

H. J. Lu wrote:
Gcc 4,0 generates
.section .gnu.linkonce.t._ZN3FooC1Ev,"axG",@progbits,_ZN3FooC1Ev,comdat
for comdat group. Can gcc use
.section .text._ZN3FooC1Ev,"axG",@progbits,_ZN3FooC1Ev,comdat
instead? At least, there will be less characters for linker to process.

I know of no reason why we must continue using .gnu.linkonce for targets that have proper comdat support.

However, I don't think this will be an easy transition, because there are too many places that make assumptions about the fact that .gnu.linkonce has a special meaning. That might be an argument against even trying.

For instance, in varasm.c, in default_function_rodata_section, we have
/* For we want to use */
if (DECL_ONE_ONLY (decl) && strncmp (name, ".gnu.linkonce.t.", 16) == 0)
and this code fails if you remove the .gnu.linkonce from the section name. We'd need code to check for and handle a comdat section here.

dwarf2out.c assumes that comdat sections for debugging start with .gnu.linkonce.

There are likely many other places that need fixing also.

There is also the possible issue that using conflicts with the naming scheme used by the -ffunction-sections -fdata-sections options. What happens if we have two sections both named, one of which is a comdat section, and one of which came from -ffunction-sections? We might still need to use a distinct prefix to make this work, though it doesn't have to be as long as .gnu.linkonce. And if we do add another prefix, some of the special code for .gnu.linkonce will have to be duplicated, in which case it might have been simpler to just stick with .gnu.linkonce in the first place.
Jim Wilson, GNU Tools Support,

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]