RFC: Rewrite x86-64 IFUNC selector in C

Erich Elsen eriche@google.com
Wed Jun 7 20:39:00 GMT 2017


Here's a patch that also moves memset.S to memset.c.

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).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-move-memset.S-memset.c.patch
Type: text/x-patch
Size: 7282 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20170607/8e1e0585/attachment.bin>


More information about the Libc-alpha mailing list