2006-10-30  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/3111
	* elf-bfd.h (elf_obj_tdata): Add symbuf.
	(_bfd_elf_section_already_linked): Add struct bfd_link_info *.
	(_bfd_elf_check_kept_section): Likewise.
	(bfd_elf_match_symbols_in_sections): Likewise.

	* elf.c (assign_section_numbers): Updated to add
	struct bfd_link_info *.
	(bfd_elf_match_symbols_in_sections): Updated. Cache symbol
	buffer if info->reduce_memory_overheads is false.

	* elflink.c (match_group_member): Updated to add
	struct bfd_link_info *.
	(_bfd_elf_check_kept_section): Likewise.
	(elf_link_input_bfd): Likewise.
	(_bfd_elf_section_already_linked): Likewise.
	(bfd_elf_final_link): Free symbol buffer if
	info->reduce_memory_overheads is false.

	* libbfd-in.h (_bfd_nolink_section_already_linked): Add
	struct bfd_link_info *.
	(_bfd_generic_section_already_linked): Likewise.
	* libbfd.h: Regenerated.

	* linker.c (bfd_section_already_linked): Add
	struct bfd_link_info *.
	(_bfd_generic_section_already_linked): Likewise.
	* targets.c (bfd_target): Add struct bfd_link_info * to
	_section_already_linked.
	* bfd-in2.h: Regenerated.

include/

2006-10-30  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/3111
	* bfdlink.h (bfd_link_info): Add reduce_memory_overheads.

ld/

2006-10-30  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/3111
	* ld.h (args_type): Remove reduce_memory_overheads.

	* ldlang.c (lang_map): Updated.
	(section_already_linked): Likewise.
	(print_input_section): Likewise.
	* ldmain.c (main): Likewise.
	* lexsup.c (parse_args): Likewise.
This commit is contained in:
H.J. Lu
2006-10-30 23:25:51 +00:00
parent 5147198ffd
commit c0f0068602
16 changed files with 148 additions and 54 deletions

View File

@ -7267,14 +7267,15 @@ _bfd_elf_default_action_discarded (asection *sec)
/* Find a match between a section and a member of a section group. */
static asection *
match_group_member (asection *sec, asection *group)
match_group_member (asection *sec, asection *group,
struct bfd_link_info *info)
{
asection *first = elf_next_in_group (group);
asection *s = first;
while (s != NULL)
{
if (bfd_elf_match_symbols_in_sections (s, sec))
if (bfd_elf_match_symbols_in_sections (s, sec, info))
return s;
s = elf_next_in_group (s);
@ -7290,7 +7291,7 @@ match_group_member (asection *sec, asection *group)
NULL. */
asection *
_bfd_elf_check_kept_section (asection *sec)
_bfd_elf_check_kept_section (asection *sec, struct bfd_link_info *info)
{
asection *kept;
@ -7298,7 +7299,7 @@ _bfd_elf_check_kept_section (asection *sec)
if (kept != NULL)
{
if (elf_sec_group (sec) != NULL)
kept = match_group_member (sec, kept);
kept = match_group_member (sec, kept, info);
if (kept != NULL && sec->size != kept->size)
kept = NULL;
}
@ -7651,7 +7652,8 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
{
asection *kept;
kept = _bfd_elf_check_kept_section (sec);
kept = _bfd_elf_check_kept_section (sec,
finfo->info);
if (kept != NULL)
{
*ps = kept;
@ -8800,6 +8802,17 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
}
}
/* Free symbol buffer if needed. */
if (!info->reduce_memory_overheads)
{
for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
if (elf_tdata (sub)->symbuf)
{
free (elf_tdata (sub)->symbuf);
elf_tdata (sub)->symbuf = NULL;
}
}
/* Output any global symbols that got converted to local in a
version script or due to symbol visibility. We do this in a
separate step since ELF requires all local symbols to appear
@ -10296,7 +10309,8 @@ bfd_elf_discard_info (bfd *output_bfd, struct bfd_link_info *info)
}
void
_bfd_elf_section_already_linked (bfd *abfd, struct bfd_section * sec)
_bfd_elf_section_already_linked (bfd *abfd, struct bfd_section *sec,
struct bfd_link_info *info)
{
flagword flags;
const char *name, *p;
@ -10462,7 +10476,8 @@ _bfd_elf_section_already_linked (bfd *abfd, struct bfd_section * sec)
if ((l->sec->flags & SEC_GROUP) == 0
&& bfd_coff_get_comdat_section (l->sec->owner, l->sec) == NULL
&& bfd_elf_match_symbols_in_sections (l->sec,
elf_next_in_group (sec)))
elf_next_in_group (sec),
info))
{
elf_next_in_group (sec)->output_section = bfd_abs_section_ptr;
elf_next_in_group (sec)->kept_section = l->sec;
@ -10483,7 +10498,7 @@ _bfd_elf_section_already_linked (bfd *abfd, struct bfd_section * sec)
if (first != NULL
&& elf_next_in_group (first) == first
&& bfd_elf_match_symbols_in_sections (first, sec))
&& bfd_elf_match_symbols_in_sections (first, sec, info))
{
sec->output_section = bfd_abs_section_ptr;
sec->kept_section = l->sec;