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: ld/2300: ld does not report duplicate symbols defined in script file


On Wed, Feb 08, 2006 at 04:06:29PM -0800, H. J. Lu wrote:
> We don't check if a symbol is already defined when we make assignment.
> This patch handle that. I can't use multiple_definition to check if
> a multiple definition is real or not since it always returns TRUE.
> 
> I am not sure about the bfd_link_hash_defweak check. Can an
> assignment override a weak definition?

I think you should allow a link script assignment to override a weakly
defined symbol, and not warn.

> +static bfd_boolean
> +multiple_definition (struct bfd_link_info *info ATTRIBUTE_UNUSED,
> +		     const char *name,
> +		     bfd *obfd,
> +		     asection *osec,
> +		     bfd_vma oval,
> +		     bfd *nbfd,
> +		     asection *nsec,
> +		     bfd_vma nval)
> +{
> +  /* FIXME: The return value from check_multiple_definition is
> +     ignored.  */
> +  check_multiple_definition (name, obfd, osec, oval, nbfd, nsec, nval);
> +  return TRUE;

This FIXME isn't correct.  multiple_definition returns true when the
link can proceed, false when it must be terminated immediately.  I think
you should not change multiple_definition.  Instead, put the "defined in
discarded section" check in exp_fold_tree_1, and call
link_info.callbacks->multiple_definition from exp_fold_tree_1.

-- 
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]