[PATCH] memcpy-ssse3: enable chk symbols in static builds
H.J. Lu
hjl.tools@gmail.com
Sun Feb 6 22:47:00 GMT 2011
On Sun, Feb 6, 2011 at 10:28 AM, Mike Frysinger <vapier@gentoo.org> wrote:
> Building static apps on x86_64 systems which use memmove such as:
> #include <string.h>
> char buf[8192];
> main(int argc, char **argv) { memmove(buf, buf + argc, argc % 4); }
You need to compile it with " -D_FORTIFY_SOURCE=1 -O" to see the
error.
> Result in linking errors along the lines of:
> .../libc.a(memmove_chk.o): In function `__memmove_chk':
> (.text+0x1b4): undefined reference to `__memmove_chk_ssse3_back'
> .../libc.a(memmove_chk.o): In function `__memmove_chk':
> (.text+0x1b9): undefined reference to `__memmove_chk_ssse3'
> collect2: ld returned 1 exit status
>
> This is due to the new ssse3 funcs only enabling their chk symbols when
> being compiled into shared code.
>
> URL: https://bugs.gentoo.org/353816
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
>
> 2011-02-06 Mike Frysinger <vapier@gentoo.org>
>
> * sysdeps/x86_64/multiarch/memcpy-ssse3.S: Delete SHARED ifdef check
> around MEMCPY_CHK symbol.
> * sysdeps/x86_64/multiarch/memcpy-ssse3-back.S: Likewise.
I don't think it is correct. Please try this.
--
H.J.
---
2011-02-06 H.J. Lu <hongjiu.lu@intel.com>
* sysdeps/x86_64/multiarch/memcpy-ssse3-back.S (MEMCPY_CHK): Check
SHARED, USE_AS_MEMMOVE and USE_MULTIARCH.
* sysdeps/x86_64/multiarch/memcpy-ssse3.S (MEMCPY_CHK): Likewise.
-------------- next part --------------
2011-02-06 H.J. Lu <hongjiu.lu@intel.com>
* sysdeps/x86_64/multiarch/memcpy-ssse3-back.S (MEMCPY_CHK): Check
SHARED, USE_AS_MEMMOVE and USE_MULTIARCH.
* sysdeps/x86_64/multiarch/memcpy-ssse3.S (MEMCPY_CHK): Likewise.
diff --git a/sysdeps/x86_64/multiarch/memcpy-ssse3-back.S b/sysdeps/x86_64/multiarch/memcpy-ssse3-back.S
index 48c974e..cbee6de 100644
--- a/sysdeps/x86_64/multiarch/memcpy-ssse3-back.S
+++ b/sysdeps/x86_64/multiarch/memcpy-ssse3-back.S
@@ -49,7 +49,7 @@
ud2
.section .text.ssse3,"ax",@progbits
-#if defined SHARED && !defined NOT_IN_libc
+#if defined SHARED || defined USE_AS_MEMMOVE || !defined USE_MULTIARCH
ENTRY (MEMCPY_CHK)
cmpq %rdx, %rcx
jb HIDDEN_JUMPTARGET (__chk_fail)
diff --git a/sysdeps/x86_64/multiarch/memcpy-ssse3.S b/sysdeps/x86_64/multiarch/memcpy-ssse3.S
index 9a878d3..fd5665e 100644
--- a/sysdeps/x86_64/multiarch/memcpy-ssse3.S
+++ b/sysdeps/x86_64/multiarch/memcpy-ssse3.S
@@ -49,7 +49,7 @@
ud2
.section .text.ssse3,"ax",@progbits
-#if defined SHARED && !defined NOT_IN_libc
+#if defined SHARED || defined USE_AS_MEMMOVE || !defined USE_MULTIARCH
ENTRY (MEMCPY_CHK)
cmpq %rdx, %rcx
jb HIDDEN_JUMPTARGET (__chk_fail)
More information about the Libc-alpha
mailing list