mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-27 07:20:11 +00:00
8b005d7869
Commitc73c96a4a1
updated memcpy.S and mempcpy.S, but omitted memmove.S and memset.S. As a result, the static library built as PIC, whether with or without multiarch support, contains two definitions for each of the __memmove_chk and __memset_chk symbols. /usr/lib/gcc/i686-pc-linux-gnu/14/../../../../i686-pc-linux-gnu/bin/ld: /usr/lib/gcc/i686-pc-linux-gnu/14/../../../../lib/libc.a(memset-ia32.o): in function `__memset_chk': /var/tmp/portage/sys-libs/glibc-2.39-r3/work/glibc-2.39/string/../sysdeps/i386/i686/memset.S:32: multiple definition of `__memset_chk'; /usr/lib/gcc/i686-pc-linux-gnu/14/../../../../lib/libc.a(memset_chk.o):/var/tmp/portage/sys-libs/glibc-2.39-r3/work/glibc-2.39/debug/../sysdeps/i386/i686/multiarch/memset_chk.c:24: first defined here After this change, regardless of PIC options, the static library, built for i686 with multiarch contains implementations of these functions respectively from debug/memmove_chk.c and debug/memset_chk.c, and without multiarch contains implementations of these functions respectively from sysdeps/i386/memmove_chk.S and sysdeps/i386/memset_chk.S. This ensures that memmove and memset won't pull in __chk_fail and the routines it calls. Reported-by: Sam James <sam@gentoo.org> Tested-by: Sam James <sam@gentoo.org> Fixes:c73c96a4a1
("i686: Fix build with --disable-multiarch") Signed-off-by: Gabi Falk <gabifalk@gmx.com> Reviewed-by: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: Dmitry V. Levin <ldv@altlinux.org> (cherry picked from commit5a2cf833f5
)
109 lines
2.2 KiB
ArmAsm
109 lines
2.2 KiB
ArmAsm
/* Copy memory block and return pointer to beginning of destination block
|
|
For Intel 80x86, x>=6.
|
|
This file is part of the GNU C Library.
|
|
Copyright (C) 2003-2024 Free Software Foundation, Inc.
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU Lesser General Public
|
|
License as published by the Free Software Foundation; either
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
License along with the GNU C Library; if not, see
|
|
<https://www.gnu.org/licenses/>. */
|
|
|
|
#include <sysdep.h>
|
|
#include "asm-syntax.h"
|
|
|
|
#define PARMS 4+4 /* one spilled register */
|
|
#define RTN PARMS
|
|
|
|
.text
|
|
|
|
#define DEST RTN
|
|
#define SRC DEST+4
|
|
#define LEN SRC+4
|
|
|
|
#if defined SHARED && IS_IN (libc)
|
|
ENTRY_CHK (__memmove_chk)
|
|
movl 12(%esp), %eax
|
|
cmpl %eax, 16(%esp)
|
|
jb HIDDEN_JUMPTARGET (__chk_fail)
|
|
END_CHK (__memmove_chk)
|
|
libc_hidden_builtin_def (__memmove_chk)
|
|
#endif
|
|
|
|
ENTRY (memmove)
|
|
|
|
pushl %edi
|
|
cfi_adjust_cfa_offset (4)
|
|
|
|
movl LEN(%esp), %ecx
|
|
movl DEST(%esp), %edi
|
|
cfi_rel_offset (edi, 0)
|
|
movl %esi, %edx
|
|
movl SRC(%esp), %esi
|
|
cfi_register (esi, edx)
|
|
|
|
movl %edi, %eax
|
|
subl %esi, %eax
|
|
cmpl %eax, %ecx
|
|
ja 3f
|
|
|
|
cld
|
|
shrl $1, %ecx
|
|
jnc 1f
|
|
movsb
|
|
1: shrl $1, %ecx
|
|
jnc 2f
|
|
movsw
|
|
2: rep
|
|
movsl
|
|
movl %edx, %esi
|
|
cfi_restore (esi)
|
|
movl DEST(%esp), %eax
|
|
|
|
popl %edi
|
|
cfi_adjust_cfa_offset (-4)
|
|
cfi_restore (edi)
|
|
|
|
ret
|
|
|
|
cfi_adjust_cfa_offset (4)
|
|
cfi_rel_offset (edi, 0)
|
|
cfi_register (esi, edx)
|
|
|
|
/* Backward copying. */
|
|
3: std
|
|
leal -1(%edi, %ecx), %edi
|
|
leal -1(%esi, %ecx), %esi
|
|
shrl $1, %ecx
|
|
jnc 1f
|
|
movsb
|
|
1: subl $1, %edi
|
|
subl $1, %esi
|
|
shrl $1, %ecx
|
|
jnc 2f
|
|
movsw
|
|
2: subl $2, %edi
|
|
subl $2, %esi
|
|
rep
|
|
movsl
|
|
movl %edx, %esi
|
|
cfi_restore (esi)
|
|
movl DEST(%esp), %eax
|
|
|
|
cld
|
|
popl %edi
|
|
cfi_adjust_cfa_offset (-4)
|
|
cfi_restore (edi)
|
|
|
|
ret
|
|
END (memmove)
|
|
libc_hidden_builtin_def (memmove)
|