RFC: COMDAT group names become anonymouse local symbols

Alan Modra amodra@gmail.com
Fri Oct 22 04:33:00 GMT 2010


On Thu, Oct 21, 2010 at 08:23:44PM -0700, Mark Mitchell wrote:
> !   /* 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.  */

Keep this comment, please.

> !       sec_name = ".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);
>   	}
>         s = subseg_force_new (sec_name, 0);
>         if (s == NULL
>   	  || !bfd_set_section_flags (stdoutput, s, flags)
>   	  || !bfd_set_section_alignment (stdoutput, s, 2))

Create symbol after this point, so that now_seg and frag_now are in
the group section.  It doesn't really matter which section you use for
the symbol, but the way you have it you'll get some random section.
In fact, you may as well move the sym check and create to..

> !       elf_group_id (s) = sy->bsym;

..just before here.  Which reminds me, use symbol_get_bfdsym here
since we are before set_symtab.

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list