public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Stefan Liebler <stli@linux.vnet.ibm.com>
To: libc-alpha@sourceware.org
Subject: Re: [PATCH] Use libc_hidden_proto / _def for hidden wchar ifunc symbols.
Date: Tue, 21 Nov 2017 07:48:00 -0000	[thread overview]
Message-ID: <30b35919-2151-c435-de31-51ce4da70fce@linux.vnet.ibm.com> (raw)
In-Reply-To: <CAMe9rOp0s-4AHbajYoySSEgDQGTVS8MkNcf-Oc_msySJHWvnfQ@mail.gmail.com>

On 11/20/2017 04:59 PM, H.J. Lu wrote:
> On Mon, Nov 20, 2017 at 7:51 AM, Stefan Liebler <stli@linux.vnet.ibm.com> wrote:
>> On 11/13/2017 06:30 PM, H.J. Lu wrote:
>>>
>>> On Mon, Nov 13, 2017 at 9:11 AM, Stefan Liebler <stli@linux.vnet.ibm.com>
>>> wrote:
>>>>
>>>> On 11/13/2017 02:58 PM, H.J. Lu wrote:
>>>>>
>>>>>
>>>>> On Mon, Nov 13, 2017 at 3:55 AM, Florian Weimer <fweimer@redhat.com>
>>>>> wrote:
>>>>>>
>>>>>>
>>>>>> On 11/13/2017 11:16 AM, Stefan Liebler wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> This patch adds the libc_hidden_proto / libc_hidden_def construct.
>>>>>>> Then the __GI_* symbols are the default-ifunc-variants which can be
>>>>>>> called
>>>>>>> without PLT.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> attribute_hidden and *_hidden_{proto,def} conflict on some
>>>>>> architectures.
>>>>>> You need to remove attribute_hidden as part of this change.
>>>>>
>>>>>
>>>>>
>>>>> That is true.  On i686, a hidden IFUNC function inside libc.so must be
>>>>> compiled
>>>>> with -fPIC via PLT since EBX must be loaded with GOT first.   This
>>>>> isn't an issue
>>>>> for x86-64 since PLT uses PC-relative addressing.  In this case, we
>>>>> should remove
>>>>> hidden attribute, instead of using __GI_* symbols, if we sill want to
>>>>> use
>>>>> IFUNC
>>>>> inside libc.so.
>>
>> For the moment, I propose to remove the attribute_hidden in order to fix
>> those internal IFUNC calls.
>> Is the attached patch okay to commit?
> 
> LGTM.
> 
Committed.

>>>>
>>>> On s390/s390x, just removing attribute_hidden in wchar.h is fine, too.
>>>> Then
>>>> r12 will be setup with the GOT-pointer and IFUNC will be used inside
>>>> libc.so.
>>>>
>>>> What was your original intention? Getting rid of "PLT" or "PLT and IFUNC"
>>>> for calls inside libc.so?
>>>
>>>
>>> The original intention is to remove PLT.  But it doesn't work for targets
>>> which
>>> need to set up a special register for PLT which is required by IFUNC.
>>>
>>>>>
>>>>> Now I have question, is there a way to apply attribute_hidden to a
>>>>> function
>>>>> depending on architecture? For example, we remove attribute_hidden
>>>>> from __wcsnlen, __wcscat, __wcsncpy, __wcpncpy,  __wcschrnul in headers
>>>>> under include/.   For x86, we mark them hidden in a header file under
>>>>> sysdeps/x86?
>>>>
>>>>
>>>> I don't know if duplicating the wchar.h file is such a good idea.
>>>>
>>>
>>> Can we add
>>>
>>> #include <wcharP.h>
>>>
>>> to include/wchar.h and add a dummy sysdeps/generic/wcharP.h?  Then
>>> I can add sysdeps/x86_64/wcharP.h to hide __wcsnlen, __wcscat, __wcsncpy,
>>> _wcpncpy,  __wcschrnul
>>>
>>>
>> @H.J. Lu: Can you propose a separate patch for architecture dependent
>> wcharP.h files?
> 
> Sure.  I will submit one after your patch is checked in.
> 
> 

  reply	other threads:[~2017-11-21  7:48 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-13 10:16 Stefan Liebler
2017-11-13 11:55 ` Florian Weimer
2017-11-13 13:58   ` H.J. Lu
2017-11-13 17:12     ` Stefan Liebler
2017-11-13 17:30       ` H.J. Lu
2017-11-14 12:45         ` Stefan Liebler
2017-11-20 15:51         ` Stefan Liebler
2017-11-20 15:59           ` H.J. Lu
2017-11-21  7:48             ` Stefan Liebler [this message]
2017-11-13 20:13     ` H.J. Lu
2017-11-14 12:45       ` Stefan Liebler
2017-11-14 13:09         ` H.J. Lu
2017-11-14 13:12     ` Florian Weimer
2017-11-13 17:12   ` Stefan Liebler

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=30b35919-2151-c435-de31-51ce4da70fce@linux.vnet.ibm.com \
    --to=stli@linux.vnet.ibm.com \
    --cc=libc-alpha@sourceware.org \
    /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).