This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PATCH: ld/2300: ld does not report duplicate symbols defined in script file
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: "H. J. Lu" <hjl at lucon dot org>
- Cc: binutils at sources dot redhat dot com
- Date: Thu, 16 Feb 2006 10:15:18 +1030
- Subject: Re: PATCH: ld/2300: ld does not report duplicate symbols defined in script file
- References: <20060209000629.GA15362@lucon.org>
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