[PATCH] gold: Ignore definition from a dynamic object for __start/__stop

H.J. Lu hjl.tools@gmail.com
Fri Oct 20 20:39:00 GMT 2017


On Fri, Oct 20, 2017 at 11:50 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> 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.
>

Here is the updated patch.

-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-gold-Ignore-def-ref-from-a-dynamic-object-for-specia.patch
Type: text/x-patch
Size: 7022 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20171020/04cbff8b/attachment.bin>


More information about the Binutils mailing list