(_place_orphan): Use an already existing section name if that section does not

have any flags set.
This commit is contained in:
Nick Clifton
2004-07-23 16:32:53 +00:00
parent 60ee6567b0
commit 9f61903d73
3 changed files with 14 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2004-07-23 Nick Clifton <nickc@redhat.com>
* emultempl/elf32.em (_place_orphan): Use an already existing
section name if that section does not have any flags set.
2004-07-21 H.J. Lu <hongjiu.lu@intel.com> 2004-07-21 H.J. Lu <hongjiu.lu@intel.com>
* ldlang.c (already_linked_hash_entry): Removed. * ldlang.c (already_linked_hash_entry): Removed.

View File

@ -1175,8 +1175,10 @@ gld${EMULATION_NAME}_place_orphan (lang_input_statement_type *file, asection *s)
lang_statement_union_type **os_tail; lang_statement_union_type **os_tail;
etree_type *load_base; etree_type *load_base;
int isdyn = 0; int isdyn = 0;
asection *sec;
secname = bfd_get_section_name (s->owner, s); secname = bfd_get_section_name (s->owner, s);
if (! link_info.relocatable if (! link_info.relocatable
&& link_info.combreloc && link_info.combreloc
&& (s->flags & SEC_ALLOC) && (s->flags & SEC_ALLOC)
@ -1260,8 +1262,12 @@ gld${EMULATION_NAME}_place_orphan (lang_input_statement_type *file, asection *s)
/* Choose a unique name for the section. This will be needed if the /* Choose a unique name for the section. This will be needed if the
same section name appears in the input file with different same section name appears in the input file with different
loadable or allocatable characteristics. */ loadable or allocatable characteristics. But if the section
if (bfd_get_section_by_name (output_bfd, secname) != NULL) already exists but does not have any flags set, then it has been
been created by the linker, probably as a result of a --section-start
command line switch. */
if ((sec = bfd_get_section_by_name (output_bfd, secname)) != NULL
&& bfd_get_section_flags (output_bfd, sec) != 0)
{ {
secname = bfd_get_unique_section_name (output_bfd, secname, &count); secname = bfd_get_unique_section_name (output_bfd, secname, &count);
if (secname == NULL) if (secname == NULL)

View File

@ -612,6 +612,7 @@ lang_output_section_find_1 (const char *const name, int constraint)
for (u = lang_output_section_statement.head; u != NULL; u = lookup->next) for (u = lang_output_section_statement.head; u != NULL; u = lookup->next)
{ {
lookup = &u->output_section_statement; lookup = &u->output_section_statement;
if (strcmp (name, lookup->name) == 0 if (strcmp (name, lookup->name) == 0
&& lookup->constraint != -1 && lookup->constraint != -1
&& (constraint == 0 || constraint == lookup->constraint)) && (constraint == 0 || constraint == lookup->constraint))