1999-09-12 Donn Terry <donn@interix.com>

* ldlang.c (section_already_linked): Use comdat information if it
	is available.
This commit is contained in:
Ian Lance Taylor 1999-09-12 16:10:00 +00:00
parent 777690b647
commit bb8fe706a0
2 changed files with 24 additions and 7 deletions

View File

@ -23,6 +23,9 @@
1999-09-12 Donn Terry <donn@interix.com>
* ldlang.c (section_already_linked): Use comdat information if it
is available.
* emultempl/pe.em (PE_DEF_SECTION_ALIGNMENT): If
OVERRIDE_SECTION_ALIGNMENT is defined, change to that.
(gld_${EMULATION_NAME}_before_parse): Use EXECUTABLE_NAME if it is

View File

@ -862,9 +862,11 @@ exp_init_os (exp)
/* Sections marked with the SEC_LINK_ONCE flag should only be linked
once into the output. This routine checks each sections, and
arranges to discard it if a section of the same name has already
been linked. This code assumes that all relevant sections have the
SEC_LINK_ONCE flag set; that is, it does not depend solely upon the
section name. This is called via bfd_map_over_sections. */
been linked. If the section has COMDAT information, then it uses
that to decide whether the section should be included. This code
assumes that all relevant sections have the SEC_LINK_ONCE flag set;
that is, it does not depend solely upon the section name. This is
called via bfd_map_over_sections. */
/*ARGSUSED*/
static void
@ -919,7 +921,10 @@ section_already_linked (abfd, sec, data)
for (l = sec_link_once_list; l != NULL; l = l->next)
{
if (strcmp (name, bfd_get_section_name (l->sec->owner, l->sec)) == 0)
if (strcmp (name, bfd_get_section_name (l->sec->owner, l->sec)) == 0
&& (sec->comdat == NULL
|| l->sec->comdat == NULL
|| strcmp (sec->comdat->name, l->sec->comdat->name) == 0))
{
/* The section has already been linked. See if we should
issue a warning. */
@ -932,8 +937,12 @@ section_already_linked (abfd, sec, data)
break;
case SEC_LINK_DUPLICATES_ONE_ONLY:
einfo (_("%P: %B: warning: ignoring duplicate section `%s'\n"),
abfd, name);
if (sec->comdat == NULL)
einfo (_("%P: %B: warning: ignoring duplicate section `%s'\n"),
abfd, name);
else
einfo (_("%P: %B: warning: ignoring duplicate `%s' section symbol `%s'\n"),
abfd, name, sec->comdat->name);
break;
case SEC_LINK_DUPLICATES_SAME_CONTENTS:
@ -952,8 +961,13 @@ section_already_linked (abfd, sec, data)
}
/* Set the output_section field so that wild_doit does not
create a lang_input_section structure for this section. */
create a lang_input_section structure for this section.
Since there might be a symbol in the section being
discarded, we must retain a pointer to the section which
we are really going to use. */
sec->output_section = bfd_abs_section_ptr;
if (sec->comdat != NULL)
sec->comdat->sec = l->sec;
return;
}