[PATCH] Always define referenced __start_SECNAME/__stop_SECNAME
H.J. Lu
hjl.tools@gmail.com
Thu Jun 15 11:21:00 GMT 2017
On Wed, Jun 14, 2017 at 8:30 PM, Alan Modra <amodra@gmail.com> wrote:
> On Wed, Jun 14, 2017 at 06:20:47AM -0700, H.J. Lu wrote:
>> On Tue, Jun 13, 2017 at 8:50 PM, Alan Modra <amodra@gmail.com> wrote:
>> > I see these fails. Please investigate and fix. The powerpc-linux
>>
>> Most of tests are supported on targets without --gc-sections support or
>> with a leading underscore in symbol name. I checked in a couple patches
>> to address them.
>>
>> > fails are due to leaving the __start and __stop symbols undefined when
>> > sizing dynamic sections, which is wrong. That at least needs to be
>>
>> There is no need to discard relocs on undefined symbols with
>> non-default visibilty, which may be defined later like __start_SECNAME
>> and __stop_SECNAME, or are real errors. I am enclosing a patch here.
>
> No, it is quite reasonable to discard these relocations, and it is a
> maintenance nightmare when symbols change state between
> allocate_dynrelocs and relocate_section. Granted, that already
> happened for .startof. and .sizeof. symbols, but the existence of
It is normal for linker defined symbols to change state. BFD just
has to deal with it.
> those special symbols was an undocumented feature of gas and ld.
> Making that happen for __start and __stop too just makes the problem
> worse.
The main difference is that __start_SECNAME and __stop_SECNAME
are marked as hidden. Here is a patch to check it.
> In future please state on the mailing list which targets you tested
> against when posting global changes. I assumed you had tested this
> change against a representative set of targets, but it's clear you
> didn't.
>
Sure. I also have a request for you. Please add a testcase when
you fix a global bug in the future, especially there is one in the bug
report. It will prevent your bug fix from being accidentally bypassed later.
Thanks.
--
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ppc-Don-t-discard-relocs-on-__start_SECNAME-__stop_S.patch
Type: text/x-patch
Size: 1209 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20170615/4d8b329e/attachment.bin>
More information about the Binutils
mailing list