Correct logic for "defined by object"
Tue Dec 23 13:36:00 GMT 2014
On Tue, Dec 23, 2014 at 05:10:13AM -0800, H.J. Lu wrote:
> On Tue, Dec 23, 2014 at 5:06 AM, Alan Modra <firstname.lastname@example.org> wrote:
> > On Tue, Dec 23, 2014 at 04:46:29AM -0800, H.J. Lu wrote:
> >> No testcase?
> > No. This patch wasn't in response to a bug report or from observing
> > wrong linker behaviour myself. In fact, I don't think you can write a
> > testcase that fails with the old code and passes with the new, due to
> > the way def->by_object is used. The patch was really just a tidy.
> So this patch won't change linker behavior in any way whatsoever.
I didn't go looking for possible failure modes in the old code. On
thinking about it some more, it may have been possible to induce wrong
behaviour with objects that had an undefined weak "x" and a script
with DEFINED(x) in an expression preceding an assignment to "x".
> Basically the setting of def->by_object is unused.
No, it is used in fold_name, case DEFINED:
new_number (h != NULL
&& (h->type == bfd_link_hash_defined
|| h->type == bfd_link_hash_defweak
|| h->type == bfd_link_hash_common)
&& ((def = symbol_defined (tree->name.name)) == NULL
|| def->iteration == (lang_statement_iteration & 1)));
Australia Development Lab, IBM
More information about the Binutils