x86_64: fix static build of __mempcpy_chk for compilers defaulting to PIC/PIE

Submitted by Mike Frysinger on March 12, 2017, 10:23 p.m.

Details

Message ID 20170312222341.19981-1-vapier@gentoo.org
State New
Headers show

Commit Message

Mike Frysinger March 12, 2017, 10:23 p.m.
When glibc is compiled with gcc 6.2 that has been configured with
to default to PIC/PIE, the static version of __mempcpy_chk is not built,
as the test is done on PIC instead of SHARED.  Fix the test to check for
SHARED, like it is done for similar functions like __memcpy_chk.

2017-03-12  Mike Frysinger  <vapier@gentoo.org>

	* sysdeps/x86_64/mempcpy_chk.S (__mempcpy_chk): Check for SHARED
	instead of PIC.
---
 sysdeps/x86_64/mempcpy_chk.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mike Frysinger March 15, 2017, 9:32 p.m.
On 12 Mar 2017 15:23, Mike Frysinger wrote:
> When glibc is compiled with gcc 6.2 that has been configured with
> to default to PIC/PIE, the static version of __mempcpy_chk is not built,
> as the test is done on PIC instead of SHARED.  Fix the test to check for
> SHARED, like it is done for similar functions like __memcpy_chk.
> 
> 2017-03-12  Mike Frysinger  <vapier@gentoo.org>
> 
> 	* sysdeps/x86_64/mempcpy_chk.S (__mempcpy_chk): Check for SHARED
> 	instead of PIC.
> 
> --- a/sysdeps/x86_64/mempcpy_chk.S
> +++ b/sysdeps/x86_64/mempcpy_chk.S
> @@ -19,7 +19,7 @@
>  #include <sysdep.h>
>  #include "asm-syntax.h"
>  
> -#ifndef PIC
> +#ifndef SHARED
>  	/* For libc.so this is defined in memcpy.S.
>  	   For libc.a, this is a separate source to avoid
>  	   mempcpy bringing in __chk_fail and all routines

ping ... should be pretty easy :)
-mike
H.J. Lu March 15, 2017, 9:44 p.m.
On Wed, Mar 15, 2017 at 2:32 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> On 12 Mar 2017 15:23, Mike Frysinger wrote:
>> When glibc is compiled with gcc 6.2 that has been configured with
>> to default to PIC/PIE, the static version of __mempcpy_chk is not built,
>> as the test is done on PIC instead of SHARED.  Fix the test to check for
>> SHARED, like it is done for similar functions like __memcpy_chk.
>>
>> 2017-03-12  Mike Frysinger  <vapier@gentoo.org>
>>
>>       * sysdeps/x86_64/mempcpy_chk.S (__mempcpy_chk): Check for SHARED
>>       instead of PIC.
>>
>> --- a/sysdeps/x86_64/mempcpy_chk.S
>> +++ b/sysdeps/x86_64/mempcpy_chk.S
>> @@ -19,7 +19,7 @@
>>  #include <sysdep.h>
>>  #include "asm-syntax.h"
>>
>> -#ifndef PIC
>> +#ifndef SHARED
>>       /* For libc.so this is defined in memcpy.S.
>>          For libc.a, this is a separate source to avoid
>>          mempcpy bringing in __chk_fail and all routines
>
> ping ... should be pretty easy :)
> -mike


OK.

Thanks.

Patch hide | download patch | download mbox

diff --git a/sysdeps/x86_64/mempcpy_chk.S b/sysdeps/x86_64/mempcpy_chk.S
index f8a9260e6ea8..f91229157690 100644
--- a/sysdeps/x86_64/mempcpy_chk.S
+++ b/sysdeps/x86_64/mempcpy_chk.S
@@ -19,7 +19,7 @@ 
 #include <sysdep.h>
 #include "asm-syntax.h"
 
-#ifndef PIC
+#ifndef SHARED
 	/* For libc.so this is defined in memcpy.S.
 	   For libc.a, this is a separate source to avoid
 	   mempcpy bringing in __chk_fail and all routines