This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] gold: Ignore definition from a dynamic object for __start/__stop
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Cary Coutant <ccoutant at gmail dot com>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Fri, 20 Oct 2017 11:50:22 -0700
- Subject: Re: [PATCH] gold: Ignore definition from a dynamic object for __start/__stop
- Authentication-results: sourceware.org; auth=none
- References: <20171018132021.GA4627@gmail.com> <CAJimCsEYhYtcPosB6vjsUsp02G69KKgn3MZ9=a=5XUowcx6diA@mail.gmail.com> <CAMe9rOoC=tOzrQJwdY=esUJpyE4n5d19NKLRutk066F9SJHMtg@mail.gmail.com> <CAJimCsFQiqTWALj4F8Ko7b_PhNuyFUqc8PmUW-5KGpD-kDD5eA@mail.gmail.com>
On Fri, Oct 20, 2017 at 11:11 AM, Cary Coutant <ccoutant@gmail.com> wrote:
>>> I think the must_be_in_reg flag is unnecessary -- only_if_ref should
>>> be sufficient. I looked through all the symbols that are created with
>>
>> As Alan mentioned, __start and __stop symbols must be exported,
>> but not preempted. STV_PROTECTED should be used.
>>
>>> only_if_ref true, and they all look like they should ignore
>>> definitions (and references) in dynamic objects:
>>>
>>> __rel_iplt_start (global hidden)
>>> __rel_iplt_end (global hidden)
>>> __exidx_start (arm, global hidden)
>>> __exidx_end (arm, global hidden)
>>> _TLS_MODULE_BASE_ (local hidden)
>>> __preinit_array_start (global hidden)
>>> __preinit_array_end (global hidden)
>>> __init_array_start (global hidden)
>>> __init_array_end (global hidden)
>>> __fini_array_start (global hidden)
>>> __fini_array_end (global hidden)
>>> __stack (global default)
>>> __executable_start (global default)
>>> __ehdr_start (global hidden)
>>> etext, _etext, __etext (global default)
>>> edata (global default)
>>> end (global default)
>>>
>>> Certainly the ones that are hidden should ignore both defs and refs in
>>> dynamic objects. The others (__stack, __executable_start, [_][_]etext,
>>> edata, and end) should at least ignore defs in dynamic objects.
>
> You didn't answer why you think it's not reasonable to use only_if_ref
> by itself, rather than adding the new must_be_in_reg flag.
>
only_if_ref isn't sufficient. Passing visibility to define_special_symbol
may work. If visibility != STV_DEFAULT, both refs and defs in dynamic
objects can be ignored. If visibility == STV_DEFAULT, defs in dynamic
objects can be ignored.
--
H.J.