mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-29 04:53:56 +08:00
* elflink.c (elf_mark_used_section): Delete.
(bfd_elf_gc_sections): Call bfd_generic_gc_sections. * reloc.c (bfd_mark_used_section): New function. (bfd_generic_gc_sections): Call bfd_mark_used_section.
This commit is contained in:
parent
8f736feabd
commit
0e58fcf315
@ -1,3 +1,10 @@
|
|||||||
|
2005-06-09 Alan Modra <amodra@bigpond.net.au>
|
||||||
|
|
||||||
|
* elflink.c (elf_mark_used_section): Delete.
|
||||||
|
(bfd_elf_gc_sections): Call bfd_generic_gc_sections.
|
||||||
|
* reloc.c (bfd_mark_used_section): New function.
|
||||||
|
(bfd_generic_gc_sections): Call bfd_mark_used_section.
|
||||||
|
|
||||||
2005-06-08 Alan Modra <amodra@bigpond.net.au>
|
2005-06-08 Alan Modra <amodra@bigpond.net.au>
|
||||||
|
|
||||||
* opncls.c (bfd_fopen): Don't set bfd_error unconditionally.
|
* opncls.c (bfd_fopen): Don't set bfd_error unconditionally.
|
||||||
|
@ -9067,27 +9067,6 @@ elf_gc_mark_dynamic_ref_symbol (struct elf_link_hash_entry *h,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mark sections containing global symbols. This is called through
|
|
||||||
elf_link_hash_traverse. */
|
|
||||||
|
|
||||||
static bfd_boolean
|
|
||||||
elf_mark_used_section (struct elf_link_hash_entry *h,
|
|
||||||
void *data ATTRIBUTE_UNUSED)
|
|
||||||
{
|
|
||||||
if (h->root.type == bfd_link_hash_warning)
|
|
||||||
h = (struct elf_link_hash_entry *) h->root.u.i.link;
|
|
||||||
|
|
||||||
if (h->root.type == bfd_link_hash_defined
|
|
||||||
|| h->root.type == bfd_link_hash_defweak)
|
|
||||||
{
|
|
||||||
asection *s = h->root.u.def.section;
|
|
||||||
if (s != NULL && s->output_section != NULL)
|
|
||||||
s->output_section->flags |= SEC_KEEP;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Do mark and sweep of unused sections. */
|
/* Do mark and sweep of unused sections. */
|
||||||
|
|
||||||
bfd_boolean
|
bfd_boolean
|
||||||
@ -9100,15 +9079,7 @@ bfd_elf_gc_sections (bfd *abfd, struct bfd_link_info *info)
|
|||||||
struct elf_link_hash_entry *h, Elf_Internal_Sym *);
|
struct elf_link_hash_entry *h, Elf_Internal_Sym *);
|
||||||
|
|
||||||
if (!info->gc_sections)
|
if (!info->gc_sections)
|
||||||
{
|
return bfd_generic_gc_sections (abfd, info);
|
||||||
/* If we are called when info->gc_sections is 0, we will mark
|
|
||||||
all sections containing global symbols for non-relocatable
|
|
||||||
link. */
|
|
||||||
if (!info->relocatable)
|
|
||||||
elf_link_hash_traverse (elf_hash_table (info),
|
|
||||||
elf_mark_used_section, NULL);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!get_elf_backend_data (abfd)->can_gc_sections
|
if (!get_elf_backend_data (abfd)->can_gc_sections
|
||||||
|| info->relocatable
|
|| info->relocatable
|
||||||
|
30
bfd/reloc.c
30
bfd/reloc.c
@ -4516,6 +4516,27 @@ bfd_generic_relax_section (bfd *abfd ATTRIBUTE_UNUSED,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Mark sections containing global symbols. This is called through
|
||||||
|
bfd_link_hash_traverse. */
|
||||||
|
|
||||||
|
static bfd_boolean
|
||||||
|
bfd_mark_used_section (struct bfd_link_hash_entry *h,
|
||||||
|
void *data ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
if (h->type == bfd_link_hash_warning)
|
||||||
|
h = h->u.i.link;
|
||||||
|
|
||||||
|
if (h->type == bfd_link_hash_defined
|
||||||
|
|| h->type == bfd_link_hash_defweak)
|
||||||
|
{
|
||||||
|
asection *s = h->u.def.section;
|
||||||
|
if (s != NULL && s->output_section != NULL)
|
||||||
|
s->output_section->flags |= SEC_KEEP;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
INTERNAL_FUNCTION
|
INTERNAL_FUNCTION
|
||||||
bfd_generic_gc_sections
|
bfd_generic_gc_sections
|
||||||
@ -4526,13 +4547,18 @@ SYNOPSIS
|
|||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
Provides default handling for relaxing for back ends which
|
Provides default handling for relaxing for back ends which
|
||||||
don't do section gc -- i.e., does nothing.
|
don't do section gc -- i.e., does nothing besides the special
|
||||||
|
case for marking sections having global symbols.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bfd_boolean
|
bfd_boolean
|
||||||
bfd_generic_gc_sections (bfd *abfd ATTRIBUTE_UNUSED,
|
bfd_generic_gc_sections (bfd *abfd ATTRIBUTE_UNUSED,
|
||||||
struct bfd_link_info *link_info ATTRIBUTE_UNUSED)
|
struct bfd_link_info *info)
|
||||||
{
|
{
|
||||||
|
/* If called when info->gc_sections is 0, then mark all sections
|
||||||
|
containing global symbols with SEC_KEEP. */
|
||||||
|
if (!info->gc_sections && !info->relocatable)
|
||||||
|
bfd_link_hash_traverse (info->hash, bfd_mark_used_section, NULL);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user