2010-10-23 Mark Mitchell <mark@codesourcery.com>

* config/obj-elf.c (elf_adjust_symtab): New.  Move group section
	processing here from elf_frob_file.  Ensure that group signature
	symbols have the name of the group.
	(elf_frob_file): Move group section processing to
	elf_adjust_symtab.
	* config/obj-elf.h (elf_adjust_symtab): Declare.
	(obj_adjust_symtab): Define.
	* config/tc-arm.c (arm_adjust_symtab): Call elf_adjust_symtab.

2010-10-23  Mark Mitchell  <mark@codesourcery.com>

	* gas/elf/elf.exp: Add group0c test.
	* gas/elf/group0c.d: New.
	* gas/elf/group0a.d: Expect ".group" for the name of group
	sections.
	* gas/elf/group0b.d: Likewise.
	* gas/elf/group1a.d: Likewise.
	* gas/elf/group1b.d: Likewise.
	* gas/elf/groupautoa.d: Likewise.
	* gas/elf/groupautob.d: Likewise.
	* gas/elf/section4.d: Likewise.
	* gas/ia64/group-1.d: Likewise.  Adjust hard-coded constants.

2010-10-22  Mark Mitchell  <mark@codesourcery.com>

	* binutils-all/group-5.d: Expect ".group" for the name of group
	sections.
	* binutils-all/strip-2.d: Likewise.

2010-10-23  Mark Mitchell  <mark@codesourcery.com>

	* ld-elf/group10.d: Expect ".group" for the name of group
	sections.
	* ld-elf/group2.d: Likewise.
	* ld-elf/group7.d: Likewise.
This commit is contained in:
Mark Mitchell
2010-10-23 18:05:10 +00:00
parent 0c480dea72
commit 709001e957
22 changed files with 103 additions and 45 deletions

View File

@@ -2081,32 +2081,29 @@ static void free_section_idx (const char *key ATTRIBUTE_UNUSED, void *val)
}
void
elf_frob_file (void)
elf_adjust_symtab (void)
{
struct group_list list;
unsigned int i;
bfd_map_over_sections (stdoutput, adjust_stab_sections, NULL);
/* Go find section groups. */
list.num_group = 0;
list.head = NULL;
list.elt_count = NULL;
list.indexes = hash_new ();
list.indexes = hash_new ();
bfd_map_over_sections (stdoutput, build_group_lists, &list);
/* Make the SHT_GROUP sections that describe each section group. We
can't set up the section contents here yet, because elf section
indices have yet to be calculated. elf.c:set_group_contents does
the rest of the work. */
for (i = 0; i < list.num_group; i++)
for (i = 0; i < list.num_group; i++)
{
const char *group_name = elf_group_name (list.head[i]);
const char *sec_name;
asection *s;
flagword flags;
struct symbol *sy;
int has_sym;
bfd_size_type size;
flags = SEC_READONLY | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_GROUP;
@@ -2122,17 +2119,7 @@ elf_frob_file (void)
}
}
sec_name = group_name;
sy = symbol_find_exact (group_name);
has_sym = 0;
if (sy != NULL
&& (sy == symbol_lastP
|| (sy->sy_next != NULL
&& sy->sy_next->sy_previous == sy)))
{
has_sym = 1;
sec_name = ".group";
}
sec_name = ".group";
s = subseg_force_new (sec_name, 0);
if (s == NULL
|| !bfd_set_section_flags (stdoutput, s, flags)
@@ -2145,8 +2132,20 @@ elf_frob_file (void)
/* Pass a pointer to the first section in this group. */
elf_next_in_group (s) = list.head[i];
if (has_sym)
elf_group_id (s) = sy->bsym;
/* Make sure that the signature symbol for the group has the
name of the group. */
sy = symbol_find_exact (group_name);
if (!sy
|| (sy != symbol_lastP
&& (sy->sy_next == NULL
|| sy->sy_next->sy_previous != sy)))
{
/* Create the symbol now. */
sy = symbol_new (group_name, now_seg, (valueT) 0, frag_now);
symbol_get_obj (sy)->local = 1;
symbol_table_insert (sy);
}
elf_group_id (s) = symbol_get_bfdsym (sy);
size = 4 * (list.elt_count[i] + 1);
bfd_set_section_size (stdoutput, s, size);
@@ -2155,15 +2154,21 @@ elf_frob_file (void)
frag_wane (frag_now);
}
#ifdef elf_tc_final_processing
elf_tc_final_processing ();
#endif
/* Cleanup hash. */
hash_traverse (list.indexes, free_section_idx);
hash_die (list.indexes);
}
void
elf_frob_file (void)
{
bfd_map_over_sections (stdoutput, adjust_stab_sections, NULL);
#ifdef elf_tc_final_processing
elf_tc_final_processing ();
#endif
}
/* It removes any unneeded versioned symbols from the symbol table. */
void