From: "H.J. Lu" <hjl.tools@gmail.com>
To: Faraz Shahbazker <faraz.shahbazker@imgtec.com>
Cc: Binutils <binutils@sourceware.org>
Subject: Re: [committed, PATCH] Always create dynsym section with dynamic sections
Date: Sat, 23 Apr 2016 15:36:00 -0000 [thread overview]
Message-ID: <CAMe9rOrTtaCdebLXVWWFoMcSBiF34rRmjRBY9kzo7tHwuU9r2Q@mail.gmail.com> (raw)
In-Reply-To: <571B93C6.5030007@imgtec.com>
On Sat, Apr 23, 2016 at 8:24 AM, Faraz Shahbazker
<faraz.shahbazker@imgtec.com> wrote:
> On 04/23/16 05:27, H.J. Lu wrote:
>> On Fri, Apr 22, 2016 at 7:31 PM, Faraz Shahbazker
>> <faraz.shahbazker@imgtec.com> wrote:
>>> On 04/22/16 19:05, H.J. Lu wrote:
>>>> On Fri, Apr 22, 2016 at 6:37 PM, Faraz Shahbazker
>>>> <faraz.shahbazker@imgtec.com> wrote:
>>>>> On 04/22/16 16:24, H.J. Lu wrote:
>>>>>> On Fri, Apr 22, 2016 at 2:49 PM, Faraz Shahbazker
>>>>>> <Faraz.Shahbazker@imgtec.com> wrote:
>>>>>>> On 04/22/2016 12:28 PM, H.J. Lu wrote:
>>>>>>>> On Fri, Apr 22, 2016 at 11:55 AM, Faraz Shahbazker
>>>>>>>>> + if (dynsymcount != 0 || elf_hash_table (info)->dynamic_sections_created)
>>>>>>>>> + ++dynsymcount;
>>>>>>>>
>>>>>>>> Are you saying dynamic_sections_created is 0 for MIPS here
>>>>>>>> and will become 1 later?
>>>>>>>
>>>>>>> No, it will remain 0. The link is static, but the hash_table is still used to
>>>>>>> record global symbols that have GOT relocations against them. Ofc, this
>>>>>>> hash_table does not result in creation of a dynsym section, because well,
>>>>>>> dynamic_sections_created is 0.
>>>>>>>
>>>>>>> Check the list of callers to bfd_elf_link_record_dynamic_symbol(), a number of
>>>>>>> architectures use the link_hash_table in situations where it is not clear whether it is
>>>>>>> being used to track dynamic symbols for a dynamic executable, as it is for x86.
>>>>>>>
>>>>>>
>>>>>> So MIPS doesn't have dynamic symbols in this case. It just borrows
>>>>>> dynsymcount for different purpose. Is this correct?
>>>>>
>>>>> Not quite! MIPS is expecting dynsymcount to count the number of symbols
>>>>> that would have gone in to the .dynsym, even for a static executable. That way
>>>>> parts of the arch-specific code can remain agnostic to the static/dynamic nature
>>>>> of the link. It may not be used exactly as documented, but its not being used
>>>>> for what one would call a different purpose.
>>>>>
>>>>> All we need is for handling of dynsymcount when renumbering to be consistent with
>>>>> its initialization. If the initial increment for a NULL symbol was not gated by
>>>>> dynamic_sections_created, then the increment when renumbering should also not.
>>>>> If the increment when renumbering has to be gated by dynamic_sections_created,
>>>>> then the initial increment must also be so.
>>>>
>>>> From what you are saying, shouldn't dynsymcount be incremented
>>>> unconditionally?
>>> No. Always, when the table is non-empty + whatever else you need.
>>>
>>
>> You said dynsym should be treated treated the same for static and
>> dynamic executables. dynsymcount is number of dynsym + 1 in
>> dynamic executable. Why isn't it true for static executable?
>
> It is, or at least used to be, before this patch. It still is for both,
> before renumbering. But now the +1 only happens for dynamic executables
> when renumbering.
Then what is wrong to always +1 for both dynamic and static
executables?
--
H.J.
next prev parent reply other threads:[~2016-04-23 15:36 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-23 0:33 H.J. Lu
2016-04-22 17:04 ` Faraz Shahbazker
2016-04-22 18:11 ` H.J. Lu
2016-04-22 18:56 ` Faraz Shahbazker
2016-04-22 19:29 ` H.J. Lu
2016-04-22 21:49 ` Faraz Shahbazker
2016-04-22 22:57 ` H.J. Lu
2016-04-22 23:09 ` Faraz Shahbazker
2016-04-22 23:24 ` H.J. Lu
2016-04-22 23:25 ` H.J. Lu
2016-04-23 1:38 ` Faraz Shahbazker
2016-04-23 2:05 ` H.J. Lu
2016-04-23 2:32 ` Faraz Shahbazker
2016-04-23 12:27 ` H.J. Lu
2016-04-23 15:25 ` Faraz Shahbazker
2016-04-23 15:36 ` H.J. Lu [this message]
2016-04-23 19:26 ` Faraz Shahbazker
2016-04-24 1:43 ` H.J. Lu
2016-04-25 2:18 ` Faraz Shahbazker
2016-04-25 12:47 ` H.J. Lu
2016-04-25 13:41 ` Alan Modra
2016-04-25 16:03 ` H.J. Lu
2016-04-26 2:08 ` Alan Modra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAMe9rOrTtaCdebLXVWWFoMcSBiF34rRmjRBY9kzo7tHwuU9r2Q@mail.gmail.com \
--to=hjl.tools@gmail.com \
--cc=binutils@sourceware.org \
--cc=faraz.shahbazker@imgtec.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).