diff mbox

Fix localplt check for GNU_IFUNC

Message ID 5331C60E.3020605@linux.vnet.ibm.com
State New
Headers show

Commit Message

Adhemerval Zanella March 25, 2014, 6:08 p.m. UTC
On 21-03-2014 17:33, Roland McGrath wrote:
> You need to double-check back to the oldest binutils version that we
> support for building libc (>=2.20) that had STT_GNU_IFUNC support (from
> NEWS looks like 2.20 itself did have it) to ensure that the script handles
> the output from the readelf in all the intervening binutils releases.
> If it's verified that the modified script works with all those versions of
> readelf, then it looks fine.
>
I just check against 2.20.1.20101209, 2.21.1.20110925, 2.22.0.20120801, 2.23.2.20130919,
and 2.24.0.20140325 'readelf -W -S -d -r' against a x86_64 and PowerPC64 build by generating
the jmprel files and all generate the same output for both archs.

I also check with wrong IFUNC usage code change on both archs to see if the script is now
capable to detect them:

* PowerPC64:


And both cases all readelf test correctly shows the wrong PLT cases. Ok to commit?

Comments

Carlos O'Donell March 25, 2014, 6:13 p.m. UTC | #1
On 03/25/2014 02:08 PM, Adhemerval Zanella wrote:
> On 21-03-2014 17:33, Roland McGrath wrote:
>> You need to double-check back to the oldest binutils version that we
>> support for building libc (>=2.20) that had STT_GNU_IFUNC support (from
>> NEWS looks like 2.20 itself did have it) to ensure that the script handles
>> the output from the readelf in all the intervening binutils releases.
>> If it's verified that the modified script works with all those versions of
>> readelf, then it looks fine.
>>
> I just check against 2.20.1.20101209, 2.21.1.20110925, 2.22.0.20120801, 2.23.2.20130919,
> and 2.24.0.20140325 'readelf -W -S -d -r' against a x86_64 and PowerPC64 build by generating
> the jmprel files and all generate the same output for both archs.
> 
> I also check with wrong IFUNC usage code change on both archs to see if the script is now
> capable to detect them:
> 
> * PowerPC64:
> 
> diff --git a/sysdeps/powerpc/powerpc64/power7/strncat.S b/sysdeps/powerpc/powerpc64/power7/strncat.S
> index 1a1a95e..23861f6 100644
> --- a/sysdeps/powerpc/powerpc64/power7/strncat.S
> +++ b/sysdeps/powerpc/powerpc64/power7/strncat.S
> @@ -69,7 +69,7 @@ EALIGN(STRNCAT, 4, 0)
>         beq cr0,L(done)
>  
>         mr r31, r4                      /* Save "s2" in r31 from r4.  */
> -       bl STRLEN                       /* Call optimized strlen on s1; goto
> +       bl strlen                       /* Call optimized strlen on s1; goto
>                                            end of s1.  */
>         nop
>         cmpldi cr7, r29, 7              /* If s2 is <=7 process
> 
> * X86_64:
> 
> diff --git a/sysdeps/x86_64/multiarch/strcat-ssse3.S b/sysdeps/x86_64/multiarch/strcat-ssse3.S
> index fde7b90..98fd69c 100644
> --- a/sysdeps/x86_64/multiarch/strcat-ssse3.S
> +++ b/sysdeps/x86_64/multiarch/strcat-ssse3.S
> @@ -37,6 +37,8 @@ ENTRY (STRCAT)
>  /* Inline corresponding strlen file, temporary until new strcpy
>     implementation gets merged.  */
>  
> +       call    strstr
> +
>         xor     %eax, %eax
>         cmpb    $0, (%rdi)
>         jz      L(exit_tail0)
> 
> And both cases all readelf test correctly shows the wrong PLT cases. Ok to commit?

Looks good to me. Thanks for the additional manual testing.

Cheers,
Carlos.
Adhemerval Zanella March 25, 2014, 7:41 p.m. UTC | #2
On 25-03-2014 15:13, Carlos O'Donell wrote:
> On 03/25/2014 02:08 PM, Adhemerval Zanella wrote:
>> On 21-03-2014 17:33, Roland McGrath wrote:
>>> You need to double-check back to the oldest binutils version that we
>>> support for building libc (>=2.20) that had STT_GNU_IFUNC support (from
>>> NEWS looks like 2.20 itself did have it) to ensure that the script handles
>>> the output from the readelf in all the intervening binutils releases.
>>> If it's verified that the modified script works with all those versions of
>>> readelf, then it looks fine.
>>>
>> I just check against 2.20.1.20101209, 2.21.1.20110925, 2.22.0.20120801, 2.23.2.20130919,
>> and 2.24.0.20140325 'readelf -W -S -d -r' against a x86_64 and PowerPC64 build by generating
>> the jmprel files and all generate the same output for both archs.
>>
>> I also check with wrong IFUNC usage code change on both archs to see if the script is now
>> capable to detect them:
>>
>> * PowerPC64:
>>
>> diff --git a/sysdeps/powerpc/powerpc64/power7/strncat.S b/sysdeps/powerpc/powerpc64/power7/strncat.S
>> index 1a1a95e..23861f6 100644
>> --- a/sysdeps/powerpc/powerpc64/power7/strncat.S
>> +++ b/sysdeps/powerpc/powerpc64/power7/strncat.S
>> @@ -69,7 +69,7 @@ EALIGN(STRNCAT, 4, 0)
>>         beq cr0,L(done)
>>  
>>         mr r31, r4                      /* Save "s2" in r31 from r4.  */
>> -       bl STRLEN                       /* Call optimized strlen on s1; goto
>> +       bl strlen                       /* Call optimized strlen on s1; goto
>>                                            end of s1.  */
>>         nop
>>         cmpldi cr7, r29, 7              /* If s2 is <=7 process
>>
>> * X86_64:
>>
>> diff --git a/sysdeps/x86_64/multiarch/strcat-ssse3.S b/sysdeps/x86_64/multiarch/strcat-ssse3.S
>> index fde7b90..98fd69c 100644
>> --- a/sysdeps/x86_64/multiarch/strcat-ssse3.S
>> +++ b/sysdeps/x86_64/multiarch/strcat-ssse3.S
>> @@ -37,6 +37,8 @@ ENTRY (STRCAT)
>>  /* Inline corresponding strlen file, temporary until new strcpy
>>     implementation gets merged.  */
>>  
>> +       call    strstr
>> +
>>         xor     %eax, %eax
>>         cmpb    $0, (%rdi)
>>         jz      L(exit_tail0)
>>
>> And both cases all readelf test correctly shows the wrong PLT cases. Ok to commit?
> Looks good to me. Thanks for the additional manual testing.
>
> Cheers,
> Carlos.
>
Pushed as 7bc5a74162d044cc227b38ebf24e2d1d4594ecb8
diff mbox

Patch

diff --git a/sysdeps/powerpc/powerpc64/power7/strncat.S b/sysdeps/powerpc/powerpc64/power7/strncat.S
index 1a1a95e..23861f6 100644
--- a/sysdeps/powerpc/powerpc64/power7/strncat.S
+++ b/sysdeps/powerpc/powerpc64/power7/strncat.S
@@ -69,7 +69,7 @@  EALIGN(STRNCAT, 4, 0)
        beq cr0,L(done)
 
        mr r31, r4                      /* Save "s2" in r31 from r4.  */
-       bl STRLEN                       /* Call optimized strlen on s1; goto
+       bl strlen                       /* Call optimized strlen on s1; goto
                                           end of s1.  */
        nop
        cmpldi cr7, r29, 7              /* If s2 is <=7 process

* X86_64:

diff --git a/sysdeps/x86_64/multiarch/strcat-ssse3.S b/sysdeps/x86_64/multiarch/strcat-ssse3.S
index fde7b90..98fd69c 100644
--- a/sysdeps/x86_64/multiarch/strcat-ssse3.S
+++ b/sysdeps/x86_64/multiarch/strcat-ssse3.S
@@ -37,6 +37,8 @@  ENTRY (STRCAT)
 /* Inline corresponding strlen file, temporary until new strcpy
    implementation gets merged.  */
 
+       call    strstr
+
        xor     %eax, %eax
        cmpb    $0, (%rdi)
        jz      L(exit_tail0)