[git commit master] x86_64: fix multiple definition of chk functions

Austin Foxley austinf at cetoncorp.com
Sat Dec 19 21:35:52 UTC 2009


commit: http://git.uclibc.org/uClibc/commit/?id=7dcd83e8bded560b6a2c658889995390d3021a92
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master

also enable __chk_fail and only try to call it when SSP is on

Signed-off-by: Austin Foxley <austinf at cetoncorp.com>
---
 libc/string/x86_64/bzero.S      |    1 +
 libc/string/x86_64/memcpy.S     |    2 ++
 libc/string/x86_64/mempcpy.S    |    1 +
 libc/string/x86_64/memset.S     |    4 +++-
 libc/sysdeps/linux/common/ssp.c |    3 +--
 5 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/libc/string/x86_64/bzero.S b/libc/string/x86_64/bzero.S
index 4d179ec..231d7cb 100644
--- a/libc/string/x86_64/bzero.S
+++ b/libc/string/x86_64/bzero.S
@@ -1,5 +1,6 @@
 #include <features.h>
 #ifdef __UCLIBC_SUSV3_LEGACY__
 # define memset bzero
+# define __memset_chk __bzero_chk
 # include "memset.S"
 #endif
diff --git a/libc/string/x86_64/memcpy.S b/libc/string/x86_64/memcpy.S
index 0112914..6d941e0 100644
--- a/libc/string/x86_64/memcpy.S
+++ b/libc/string/x86_64/memcpy.S
@@ -29,7 +29,9 @@
 #if defined __PIC__ && !defined NOT_IN_libc
 ENTRY (__memcpy_chk)
 	cmpq	%rdx, %rcx
+#if defined __UCLIBC_HAS_SSP__
 	jb	HIDDEN_JUMPTARGET (__chk_fail)
+#endif
 END (__memcpy_chk)
 #endif
 ENTRY (BP_SYM (memcpy))
diff --git a/libc/string/x86_64/mempcpy.S b/libc/string/x86_64/mempcpy.S
index 3816d9f..b0607aa 100644
--- a/libc/string/x86_64/mempcpy.S
+++ b/libc/string/x86_64/mempcpy.S
@@ -1,3 +1,4 @@
 #define memcpy mempcpy
+#define __memcpy_chk __mempcpy_chk
 #include "memcpy.S"
 libc_hidden_def(mempcpy)
diff --git a/libc/string/x86_64/memset.S b/libc/string/x86_64/memset.S
index 562574a..df265f3 100644
--- a/libc/string/x86_64/memset.S
+++ b/libc/string/x86_64/memset.S
@@ -29,10 +29,12 @@
 #define LARGE $120000
 
         .text
-#if !BZERO_P && defined __PIC__ && !defined NOT_IN_libc
+#if defined __PIC__ && !defined NOT_IN_libc
 ENTRY (__memset_chk)
 	cmpq	%rdx, %rcx
+#if defined __UCLIBC_HAS_SSP__
 	jb	HIDDEN_JUMPTARGET (__chk_fail)
+#endif
 END (__memset_chk)
 #endif
 ENTRY (memset)
diff --git a/libc/sysdeps/linux/common/ssp.c b/libc/sysdeps/linux/common/ssp.c
index 69611ca..a2d7ff2 100644
--- a/libc/sysdeps/linux/common/ssp.c
+++ b/libc/sysdeps/linux/common/ssp.c
@@ -100,7 +100,6 @@ void __stack_chk_fail(void)
 		terminate();
 }
 
-#if 0
 void __chk_fail(void) attribute_noreturn;
 void __chk_fail(void)
 {
@@ -115,4 +114,4 @@ void __chk_fail(void)
 	while(1)
 		terminate();
 }
-#endif
+
-- 
1.6.3.3



More information about the uClibc-cvs mailing list