This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Correct logic for "defined by object"
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Binutils <binutils at sourceware dot org>
- Date: Tue, 23 Dec 2014 05:55:16 -0800
- Subject: Re: Correct logic for "defined by object"
- Authentication-results: sourceware.org; auth=none
- References: <20141223124131 dot GB4313 at bubble dot grove dot modra dot org> <CAMe9rOr_z64ZWtbSOwF_GT_-p5Sn-QE4KKKg0s6MVPFU3jPLEA at mail dot gmail dot com> <20141223130605 dot GF4313 at bubble dot grove dot modra dot org> <CAMe9rOoSVkK4vL4swPcwm_Fy=yr6r4Ss8HVFk0Xy267AcQ=79A at mail dot gmail dot com> <CAMe9rOr6aQzXYmNPLhM=prb_o0kACC7BrOm0bExGj0CtnBz_+g at mail dot gmail dot com> <20141223134431 dot GH4313 at bubble dot grove dot modra dot org>
On Tue, Dec 23, 2014 at 5:44 AM, Alan Modra <amodra@gmail.com> wrote:
> On Tue, Dec 23, 2014 at 05:25:03AM -0800, H.J. Lu wrote:
>> On Tue, Dec 23, 2014 at 5:10 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> > On Tue, Dec 23, 2014 at 5:06 AM, Alan Modra <amodra@gmail.com> 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.
>> > Basically the setting of def->by_object is unused.
>> >
>> > --
>> > H.J.
>>
>> There are
>>
>> 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->by_object
>> || def->iteration == (lang_statement_iteration & 1)));
>>
>> and
>>
>> if (!(h != NULL
>> && (h->type == bfd_link_hash_defined
>> || h->type == bfd_link_hash_defweak)
>> && h->u.def.section == bfd_abs_section_ptr
>> && (def = symbol_defined (tree->name.name)) != NULL
>> && def->iteration == (lang_statement_iteration & 1)))
>>
>> One checks by_object and the other doesn't. Should they be
>> consistent? Can we find some real usage for by_object? If not,
>> why don't we remove it?
>
> This is a real use of by_object. The "new_number" expression is
> saying the result of DEFINED is true iff the symbol is defined,
> defweak or common, and there are no script assignments to the symbol,
> or the symbol was actually defined in an object file, or the script
> assignment occurred before the DEFINED keyword.
>
Can't we find a testcase to show how it is used?
--
H.J.