This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Restore .gnu.linkonce.r. g++-3.4 linking


On Sun, Oct 26, 2008 at 05:59:21PM +0100, Jan Kratochvil wrote:
> --- bfd/elflink.c	20 Oct 2008 10:57:33 -0000	1.315
> +++ bfd/elflink.c	26 Oct 2008 16:38:02 -0000
> @@ -9273,7 +9273,23 @@ elf_link_input_bfd (struct elf_final_lin
>  		  if ((sec = *ps) != NULL && elf_discarded_section (sec))
>  		    {
>  		      BFD_ASSERT (r_symndx != 0);
> -		      if (action_discarded & COMPLAIN)
> +
> +		      /* Do not complain on unresolved relocations in
> +			 `.gnu.linkonce.r.F' referencing its discarded
> +			 `.gnu.linkonce.t.F' counterpart - g++-3.4 specific as
> +			 g++-4.x is using COMDAT groups (without the
> +			 `.gnu.linkonce' prefix) instead.  `.gnu.linkonce.r.*'
> +			 were the `.rodata' part of its matching
> +			 `.gnu.linkonce.t.*'.  If `.gnu.linkonce.r.F' is not
> +			 discarded with its `.gnu.linkonce.t.F' being discarded
> +			 means we chose one-only `.gnu.linkonce.t.F' section
> +			 from an other file not needing any `.gnu.linkonce.r.F'
> +			 and thus `.gnu.linkonce.r.F' could be in fact also
> +			 discarded.  */
> +		      if ((action_discarded & COMPLAIN)
> +		          && !(CONST_STRNEQ (o->name, ".gnu.linkonce.r.")
> +			       && CONST_STRNEQ (sec->name, ".gnu.linkonce.t.")
> +			       && strcmp (o->name + 16, sec->name + 16) == 0))
>  			(*finfo->info->callbacks->einfo)
>  			  (_("%X`%s' referenced in section `%A' of %B: "
>  			     "defined in discarded section `%A' of %B\n"),

This patch is better, but it still seems like a hack to me.  How do
you feel about implementing your "could in fact also be discarded"
comment?  It should be fairly easy.  _bfd_elf_section_already_linked
already_linked_list has already selected all .gnu.linkonce.*.F
sections, so if you see any .gnu.linkonce.* section on the list,
belonging to a different bfd, then you could discard.

-- 
Alan Modra
Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]