This is the mail archive of the binutils@sources.redhat.com 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: PR 463: Relocation overflow message should be more informational


On Wed, Oct 20, 2004 at 04:43:02PM -0700, H. J. Lu wrote:
> @@ -1408,7 +1409,43 @@ reloc_overflow (struct bfd_link_info *in
>        return TRUE;
>      }
>  
> -  einfo (_(" relocation truncated to fit: %s %T"), reloc_name, name);
> +  if (entry)
> +    {
> +      while (entry->type == bfd_link_hash_indirect
> +	     || entry->type == bfd_link_hash_warning)
> +	entry = entry->u.i.link;
> +      switch (entry->type)
> +	{
> +	case bfd_link_hash_undefined:
> +	case bfd_link_hash_undefweak:
> +	  einfo (_(" relocation truncated to fit: %s against undefined symbol `%T'"),
> +		 reloc_name, entry->root.string);
> +	  break;
> +	case bfd_link_hash_defined:
> +	case bfd_link_hash_defweak:
> +	  einfo (_(" relocation truncated to fit: %s against symbol `%T' defined in %A section in %B"),
> +		 reloc_name, entry->root.string,
> +		 entry->u.def.section, entry->u.def.section->owner);
> +	  break;

You obviously didn't test this..  %A and %B are a little tricky.

> +	case bfd_link_hash_common:
> +	  einfo (_(" relocation truncated to fit: %s against common symbol `%T' in %A section in %B"),
> +		 reloc_name, entry->root.string,
> +		 entry->u.c.p->section, entry->u.c.p->section->owner);
> +	  break;

There is no need to handle bfd_link_hash_common.  At the time this
function might be called, all common syms will have been converted to
bfd_link_hash_defined.

> +	default:
> +	  einfo (_(" relocation truncated to fit: %s against unknown symbol `%T'"),
> +		 reloc_name, entry->root.string);
> +	  break;

This should just be an abort.

> +	}
> +    }
> +  else
> +    {
> +      if (name && *name != '\0')
> +	einfo (_(" relocation truncated to fit: %s against `%T'"),
> +	       reloc_name, name);
> +      else
> +	einfo (_(" relocation truncated to fit: %s"), reloc_name);

I'd leave this to be handled by %T.  A null name will print as
"no symbol", which I think is better than omitting the name.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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