This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: RFC: Rewrite x86-64 IFUNC selector in C
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Erich Elsen <eriche at google dot com>
- Cc: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>, Siddhesh Poyarekar <siddhesh at gotplt dot org>, "Carlos O'Donell" <carlos at redhat dot com>, GNU C Library <libc-alpha at sourceware dot org>
- Date: Wed, 7 Jun 2017 20:42:19 -0700
- Subject: Re: RFC: Rewrite x86-64 IFUNC selector in C
- Authentication-results: sourceware.org; auth=none
- References: <CAMe9rOq7fCtNSfhQN=QXGjSRkKNfWwC4c9c_kqb4iFbpmNYBEA@mail.gmail.com> <f07f563b-e74f-e2ec-38f5-5f092f73f490@gotplt.org> <4a16e1e8-9baf-7b75-41b0-e25a127c649a@linaro.org> <CAOVZoAOYJ7zNWRZkgEj2Pq=v=GHs2j4XkuFw8077M3vZnxBy0w@mail.gmail.com> <CAMe9rOrDDH==5E5dmLV2Z=mENNBo_u9VfSZpB=Lp_qUtQ3spvg@mail.gmail.com> <264ee0ca-ee55-297b-ac16-2761c77e0bfc@linaro.org> <CAMe9rOqYh-zdMzDsV4ENA04KucdcqzsVTqx5dYGPrUQgFxZwbw@mail.gmail.com> <10c41e3f-d9ea-184d-4580-1beac97fb2dd@linaro.org> <CAMe9rOpUuygb-o3HEf3nswzOyDgnHkvLxMOLHL6cEi0e-he_Gw@mail.gmail.com> <05ff0033-370c-1970-5600-63638f17a496@linaro.org> <CAMe9rOr9pRBAi41B+q6q_S3fi=XFLcTg2yCwQJRTTZrUdi8oYQ@mail.gmail.com> <b051d823-0e0c-8ea2-20da-8b13cbd54dee@linaro.org> <CAOVZoANe43WXzTKaOpyPUdgW0H3kxPTfw67afXg2OgPK36NDdQ@mail.gmail.com> <CAMe9rOrBv8wfJkj6ofsKCmohSJSxZtU23P+rQZ2vLwOURUf8Ow@mail.gmail.com>
On Wed, Jun 7, 2017 at 3:21 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Wed, Jun 7, 2017 at 1:39 PM, Erich Elsen <eriche@google.com> wrote:
>> Here's a patch that also moves memset.S to memset.c.
>
> I integrated your patch into hjl/ifunc/c branch. Thanks.
The memset IFUNC selector can't share with memmove since
they have different algorithms and implementations. I fixed
in on hjl/ifunc/c branch.
> BTW, have you investigated using IFUNC internally in libc,so?
>
>> On Tue, May 30, 2017 at 1:32 PM, Adhemerval Zanella
>> <adhemerval.zanella@linaro.org> wrote:
>>>
>>>
>>> On 30/05/2017 17:13, H.J. Lu wrote:
>>>> On Tue, May 30, 2017 at 12:50 PM, Adhemerval Zanella
>>>> <adhemerval.zanella@linaro.org> wrote:
>>>>>
>>>>>
>>>>> On 30/05/2017 13:24, H.J. Lu wrote:
>>>>>> On Mon, May 29, 2017 at 1:34 PM, Adhemerval Zanella
>>>>>> <adhemerval.zanella@linaro.org> wrote:
>>>>>>>
>>>>>>> I think we can simplify it further and use the already existent ifunc macros on
>>>>>>> libc-symbols.h. Also, for memmove I think we can organize the code better (at
>>>>>>> least for ifunc) and build a extra object with a more meaningful name. I used
>>>>>>> your logic for the ifunc selection and extended for memmove as well.
>>>>>>>
>>>>>> Here is the combined patch.
>>>>>
>>>>>
>>>>>> diff --git a/sysdeps/x86_64/multiarch/Makefile b/sysdeps/x86_64/multiarch/Makefile
>>>>>> index 3736f54..8a6ff00 100644
>>>>>> --- a/sysdeps/x86_64/multiarch/Makefile
>>>>>> +++ b/sysdeps/x86_64/multiarch/Makefile
>>>>>> @@ -19,6 +19,7 @@ sysdep_routines += strncat-c stpncpy-c strncpy-c strcmp-ssse3 \
>>>>>> strchr-sse2-no-bsf memcmp-ssse3 strstr-sse2-unaligned \
>>>>>> strcspn-c strpbrk-c strspn-c varshift \
>>>>>> memset-avx512-no-vzeroupper \
>>>>>> + memmove-sse2-unaligned-erms \
>>>>>
>>>>> I still think this is a misleading name file since it build not only memmove but
>>>>> also memcpy and mempcpy implementations. I would prefer to rename to a more
>>>>> general name as in my suggestion.
>>>>
>>>> I'd like to keep it consistent with memmove-avx-unaligned-erms.S and
>>>> memmove-avx512-unaligned-erms.S. As for making memcpy an alias
>>>> of memmove, and embedding mempcpy, __memcpy_chk,
>>>> __mempcpy_chk, __memmove_chk is an implementation detail.
>>>>
>>>
>>> Alright, at least I think it should add some comments that the object
>>> is building multiple symbols (it wasn't clear when I started to work
>>> on the patch).
>
>
>
> --
> H.J.
--
H.J.