mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-30 17:31:13 +08:00
* ldlang.c (wild_sort): Formatting.
(strip_excluded_output_sections): Strip zero size sections here. * emultempl/elf32.em (gld*_strip_empty_sections): Delete. (gld*_finish): Don't call the above. * emultempl/hppaelf.em (hppaelf_finish): Likewise. * emultempl/ppc64elf.em (ppc_finish): Likewise.
This commit is contained in:
@ -1,3 +1,12 @@
|
|||||||
|
2005-07-08 Alan Modra <amodra@bigpond.net.au>
|
||||||
|
|
||||||
|
* ldlang.c (wild_sort): Formatting.
|
||||||
|
(strip_excluded_output_sections): Strip zero size sections here.
|
||||||
|
* emultempl/elf32.em (gld*_strip_empty_sections): Delete.
|
||||||
|
(gld*_finish): Don't call the above.
|
||||||
|
* emultempl/hppaelf.em (hppaelf_finish): Likewise.
|
||||||
|
* emultempl/ppc64elf.em (ppc_finish): Likewise.
|
||||||
|
|
||||||
2005-07-05 Paul Brook <paul@codesourcery.com>
|
2005-07-05 Paul Brook <paul@codesourcery.com>
|
||||||
|
|
||||||
* Makefile.am (ALL_EMULATIONS): Add eelf32ppcvxworks.o.
|
* Makefile.am (ALL_EMULATIONS): Add eelf32ppcvxworks.o.
|
||||||
|
@ -61,7 +61,6 @@ static void gld${EMULATION_NAME}_before_allocation (void);
|
|||||||
static bfd_boolean gld${EMULATION_NAME}_place_orphan
|
static bfd_boolean gld${EMULATION_NAME}_place_orphan
|
||||||
(lang_input_statement_type *file, asection *s);
|
(lang_input_statement_type *file, asection *s);
|
||||||
static void gld${EMULATION_NAME}_layout_sections_again (void);
|
static void gld${EMULATION_NAME}_layout_sections_again (void);
|
||||||
static void gld${EMULATION_NAME}_strip_empty_sections (void);
|
|
||||||
static void gld${EMULATION_NAME}_provide_init_fini_syms (void);
|
static void gld${EMULATION_NAME}_provide_init_fini_syms (void);
|
||||||
static void gld${EMULATION_NAME}_finish (void) ATTRIBUTE_UNUSED;
|
static void gld${EMULATION_NAME}_finish (void) ATTRIBUTE_UNUSED;
|
||||||
|
|
||||||
@ -1506,41 +1505,12 @@ gld${EMULATION_NAME}_layout_sections_again (void)
|
|||||||
lang_do_assignments ();
|
lang_do_assignments ();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gld${EMULATION_NAME}_strip_empty_sections (void)
|
|
||||||
{
|
|
||||||
if (!link_info.relocatable)
|
|
||||||
{
|
|
||||||
lang_output_section_statement_type *os;
|
|
||||||
|
|
||||||
for (os = &lang_output_section_statement.head->output_section_statement;
|
|
||||||
os != NULL;
|
|
||||||
os = os->next)
|
|
||||||
{
|
|
||||||
asection *s;
|
|
||||||
|
|
||||||
if (os == abs_output_section || os->constraint == -1)
|
|
||||||
continue;
|
|
||||||
s = os->bfd_section;
|
|
||||||
if (s != NULL
|
|
||||||
&& s->size == 0
|
|
||||||
&& (s->flags & SEC_KEEP) == 0
|
|
||||||
&& !bfd_section_removed_from_list (output_bfd, s))
|
|
||||||
{
|
|
||||||
bfd_section_list_remove (output_bfd, s);
|
|
||||||
output_bfd->section_count--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gld${EMULATION_NAME}_finish (void)
|
gld${EMULATION_NAME}_finish (void)
|
||||||
{
|
{
|
||||||
if (bfd_elf_discard_info (output_bfd, &link_info))
|
if (bfd_elf_discard_info (output_bfd, &link_info))
|
||||||
gld${EMULATION_NAME}_layout_sections_again ();
|
gld${EMULATION_NAME}_layout_sections_again ();
|
||||||
|
|
||||||
gld${EMULATION_NAME}_strip_empty_sections ();
|
|
||||||
gld${EMULATION_NAME}_provide_init_fini_syms ();
|
gld${EMULATION_NAME}_provide_init_fini_syms ();
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
@ -305,7 +305,6 @@ hppaelf_finish (void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gld${EMULATION_NAME}_strip_empty_sections ();
|
|
||||||
gld${EMULATION_NAME}_provide_init_fini_syms ();
|
gld${EMULATION_NAME}_provide_init_fini_syms ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -379,7 +379,6 @@ ppc_finish (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ppc64_elf_restore_symbols (&link_info);
|
ppc64_elf_restore_symbols (&link_info);
|
||||||
gld${EMULATION_NAME}_strip_empty_sections ();
|
|
||||||
gld${EMULATION_NAME}_provide_init_fini_syms ();
|
gld${EMULATION_NAME}_provide_init_fini_syms ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
46
ld/ldlang.c
46
ld/ldlang.c
@ -1960,11 +1960,8 @@ wild_sort (lang_wild_statement_type *wild,
|
|||||||
looking at the sections for this file. */
|
looking at the sections for this file. */
|
||||||
|
|
||||||
if (sec != NULL && sec->spec.sorted != none)
|
if (sec != NULL && sec->spec.sorted != none)
|
||||||
{
|
if (compare_section (sec->spec.sorted, section, ls->section) < 0)
|
||||||
if (compare_section (sec->spec.sorted, section,
|
break;
|
||||||
ls->section) < 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return l;
|
return l;
|
||||||
@ -3086,39 +3083,40 @@ strip_excluded_output_sections (void)
|
|||||||
if (output_section == NULL)
|
if (output_section == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
exclude = TRUE;
|
exclude = (output_section->rawsize == 0
|
||||||
if (output_section->map_head.s != NULL)
|
&& (output_section->flags & SEC_KEEP) == 0
|
||||||
|
&& !bfd_section_removed_from_list (output_bfd,
|
||||||
|
output_section));
|
||||||
|
|
||||||
|
/* Some sections have not yet been sized, notably .gnu.version,
|
||||||
|
.dynsym, .dynstr and .hash. These all have SEC_LINKER_CREATED
|
||||||
|
input sections, so don't drop output sections that have such
|
||||||
|
input sections unless they are also marked SEC_EXCLUDE. */
|
||||||
|
if (exclude && output_section->map_head.s != NULL)
|
||||||
{
|
{
|
||||||
asection *s;
|
asection *s;
|
||||||
|
|
||||||
for (s = output_section->map_head.s; s != NULL;
|
for (s = output_section->map_head.s; s != NULL; s = s->map_head.s)
|
||||||
s = s->map_head.s)
|
if ((s->flags & SEC_LINKER_CREATED) != 0
|
||||||
if ((s->flags & SEC_EXCLUDE) == 0)
|
&& (s->flags & SEC_EXCLUDE) == 0)
|
||||||
{
|
{
|
||||||
exclude = FALSE;
|
exclude = FALSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
output_section->map_head.link_order = NULL;
|
|
||||||
output_section->map_tail.link_order = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exclude
|
/* TODO: Don't just junk map_head.s, turn them into link_orders. */
|
||||||
&& (output_section->flags & SEC_KEEP) == 0
|
output_section->map_head.link_order = NULL;
|
||||||
&& output_section->rawsize == 0
|
output_section->map_tail.link_order = NULL;
|
||||||
&& !bfd_is_abs_section (output_section))
|
|
||||||
|
if (exclude)
|
||||||
{
|
{
|
||||||
/* We don't set bfd_section to NULL since bfd_section of the
|
/* We don't set bfd_section to NULL since bfd_section of the
|
||||||
removed output section statement may still be used. */
|
removed output section statement may still be used. */
|
||||||
os->ignored = TRUE;
|
os->ignored = TRUE;
|
||||||
output_section->flags |= SEC_EXCLUDE;
|
output_section->flags |= SEC_EXCLUDE;
|
||||||
|
bfd_section_list_remove (output_bfd, output_section);
|
||||||
if (!bfd_section_removed_from_list (output_bfd,
|
output_bfd->section_count--;
|
||||||
output_section))
|
|
||||||
{
|
|
||||||
bfd_section_list_remove (output_bfd, output_section);
|
|
||||||
output_bfd->section_count--;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user