i686: Fix multiple definitions of __memmove_chk and __memset_chk

Message ID 20240426105001.699765-1-gabifalk@gmx.com
State Superseded
Headers
Series i686: Fix multiple definitions of __memmove_chk and __memset_chk |

Checks

Context Check Description
redhat-pt-bot/TryBot-apply_patch success Patch applied to master at the time it was sent
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 success Testing passed
redhat-pt-bot/TryBot-32bit success Build for i686
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_glibc_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_glibc_check--master-arm success Testing passed

Commit Message

Gabi Falk April 26, 2024, 10:50 a.m. UTC
  Commit c73c96a4a1af1326df7f96eec58209e1e04066d8 updated memcpy.S and
mempcpy.S, but omitted memmove.S` and memset.S.  As a result, the
static library built with enabled multiarch (the default) 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

Reported-by: Sam James <sam@gentoo.org>
Fixes: c73c96a4a1 ("i686: Fix build with --disable-multiarch")
Signed-off-by: Gabi Falk <gabifalk@gmx.com>
---
 sysdeps/i386/i686/memmove.S | 2 +-
 sysdeps/i386/i686/memset.S  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

--
gabi
  

Comments

H.J. Lu April 26, 2024, 2:17 p.m. UTC | #1
On Fri, Apr 26, 2024 at 3:52 AM Gabi Falk <gabifalk@gmx.com> wrote:
>
> Commit c73c96a4a1af1326df7f96eec58209e1e04066d8 updated memcpy.S and
> mempcpy.S, but omitted memmove.S` and memset.S.  As a result, the
> static library built with enabled multiarch (the default) 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

Please include at least one testcase to verify the fix.

Thanks.

> Reported-by: Sam James <sam@gentoo.org>
> Fixes: c73c96a4a1 ("i686: Fix build with --disable-multiarch")
> Signed-off-by: Gabi Falk <gabifalk@gmx.com>
> ---
>  sysdeps/i386/i686/memmove.S | 2 +-
>  sysdeps/i386/i686/memset.S  | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/sysdeps/i386/i686/memmove.S b/sysdeps/i386/i686/memmove.S
> index f230359ad6..effd958120 100644
> --- a/sysdeps/i386/i686/memmove.S
> +++ b/sysdeps/i386/i686/memmove.S
> @@ -29,7 +29,7 @@
>  #define SRC    DEST+4
>  #define LEN    SRC+4
>
> -#if defined PIC && IS_IN (libc)
> +#if defined SHARED && IS_IN (libc)
>  ENTRY_CHK (__memmove_chk)
>         movl    12(%esp), %eax
>         cmpl    %eax, 16(%esp)
> diff --git a/sysdeps/i386/i686/memset.S b/sysdeps/i386/i686/memset.S
> index f02f5a6df7..ab06771ea0 100644
> --- a/sysdeps/i386/i686/memset.S
> +++ b/sysdeps/i386/i686/memset.S
> @@ -27,7 +27,7 @@
>  #define LEN    CHR+4
>
>          .text
> -#if defined PIC && IS_IN (libc)
> +#if defined SHARED && IS_IN (libc)
>  ENTRY_CHK (__memset_chk)
>         movl    12(%esp), %eax
>         cmpl    %eax, 16(%esp)
> --
> gabi
>
  

Patch

diff --git a/sysdeps/i386/i686/memmove.S b/sysdeps/i386/i686/memmove.S
index f230359ad6..effd958120 100644
--- a/sysdeps/i386/i686/memmove.S
+++ b/sysdeps/i386/i686/memmove.S
@@ -29,7 +29,7 @@ 
 #define SRC	DEST+4
 #define LEN	SRC+4

-#if defined PIC && IS_IN (libc)
+#if defined SHARED && IS_IN (libc)
 ENTRY_CHK (__memmove_chk)
 	movl	12(%esp), %eax
 	cmpl	%eax, 16(%esp)
diff --git a/sysdeps/i386/i686/memset.S b/sysdeps/i386/i686/memset.S
index f02f5a6df7..ab06771ea0 100644
--- a/sysdeps/i386/i686/memset.S
+++ b/sysdeps/i386/i686/memset.S
@@ -27,7 +27,7 @@ 
 #define LEN	CHR+4

         .text
-#if defined PIC && IS_IN (libc)
+#if defined SHARED && IS_IN (libc)
 ENTRY_CHK (__memset_chk)
 	movl	12(%esp), %eax
 	cmpl	%eax, 16(%esp)