Skip to content
Commits on Source (9)
  • Gabi Falk's avatar
    i586: Fix multiple definitions of __memcpy_chk and __mempcpy_chk · 3148714a
    Gabi Falk authored
    
    
    /home/bmg/install/compilers/x86_64-linux-gnu/lib/gcc/x86_64-glibc-linux-gnu/13.2.1/../../../../x86_64-glibc-linux-gnu/bin/ld: /home/bmg/build/glibcs/i586-linux-gnu/glibc/libc.a(memcpy_chk.o): in function `__memcpy_chk':
    /home/bmg/src/glibc/debug/../sysdeps/i386/memcpy_chk.S:29: multiple definition of `__memcpy_chk';/home/bmg/build/glibcs/i586-linux-gnu/glibc/libc.a(memcpy.o):/home/bmg/src/glibc/string/../sysdeps/i386/i586/memcpy.S:31: first defined here /home/bmg/install/compilers/x86_64-linux-gnu/lib/gcc/x86_64-glibc-linux-gnu/13.2.1/../../../../x86_64-glibc-linux-gnu/bin/ld: /home/bmg/build/glibcs/i586-linux-gnu/glibc/libc.a(mempcpy_chk.o): in function `__mempcpy_chk': /home/bmg/src/glibc/debug/../sysdeps/i386/mempcpy_chk.S:28: multiple definition of `__mempcpy_chk'; /home/bmg/build/glibcs/i586-linux-gnu/glibc/libc.a(mempcpy.o):/home/bmg/src/glibc/string/../sysdeps/i386/i586/memcpy.S:31: first defined here
    
    After this change, the static library built for i586, regardless of PIC
    options, contains implementations of these functions respectively from
    sysdeps/i386/memcpy_chk.S and sysdeps/i386/mempcpy_chk.S.  This ensures
    that memcpy and mempcpy won't pull in __chk_fail and the routines it
    calls.
    
    Reported-by: default avatarFlorian Weimer <fweimer@redhat.com>
    Signed-off-by: default avatarGabi Falk <gabifalk@gmx.com>
    Reviewed-by: default avatarH.J. Lu <hjl.tools@gmail.com>
    Reviewed-by: default avatarDmitry V. Levin <ldv@altlinux.org>
    (cherry picked from commit 789894a2f554d4503ecb2f13b2b4e93e43414f33)
    3148714a
  • Gabi Falk's avatar
    i686: Fix multiple definitions of __memmove_chk and __memset_chk · ad92c483
    Gabi Falk authored
    Commit c73c96a4
    
     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: default avatarSam James <sam@gentoo.org>
    Tested-by: default avatarSam James <sam@gentoo.org>
    Fixes: c73c96a4
    
     ("i686: Fix build with --disable-multiarch")
    Signed-off-by: default avatarGabi Falk <gabifalk@gmx.com>
    Reviewed-by: default avatarH.J. Lu <hjl.tools@gmail.com>
    Reviewed-by: default avatarDmitry V. Levin <ldv@altlinux.org>
    (cherry picked from commit 5a2cf833)
    ad92c483
  • Gabi Falk's avatar
    Add a test to check for duplicate definitions in the static library · ff110b25
    Gabi Falk authored
    
    
    This change follows two previous fixes addressing multiple definitions
    of __memcpy_chk and __mempcpy_chk functions on i586, and __memmove_chk
    and __memset_chk functions on i686.  The test is intended to prevent
    such issues from occurring in the future.
    
    Signed-off-by: default avatarGabi Falk <gabifalk@gmx.com>
    Reviewed-by: default avatarH.J. Lu <hjl.tools@gmail.com>
    Reviewed-by: default avatarDmitry V. Levin <ldv@altlinux.org>
    (cherry picked from commit ded2e075)
    ff110b25
  • Sam James's avatar
    Revert "Add a test to check for duplicate definitions in the static library" · fa616ea3
    Sam James authored
    This reverts commit ff110b25
    
    .
    
    I had the wrong cherry-pick reference (the commit content is right; it's
    just referring to a base that isn't upstream), but let's revert and reapply
    for clarity.
    
    Signed-off-by: default avatarSam James <sam@gentoo.org>
    fa616ea3
  • Sam James's avatar
    Revert "i686: Fix multiple definitions of __memmove_chk and __memset_chk" · c16871e6
    Sam James authored
    This reverts commit ad92c483
    
    .
    
    I had the wrong cherry-pick reference (the commit content is right; it's
    just referring to a base that isn't upstream), but let's revert and reapply
    for clarity.
    
    Signed-off-by: default avatarSam James <sam@gentoo.org>
    c16871e6
  • Sam James's avatar
    Revert "i586: Fix multiple definitions of __memcpy_chk and __mempcpy_chk" · 5141d4d8
    Sam James authored
    This reverts commit 3148714a
    
    .
    
    I had the wrong cherry-pick reference (the commit content is right; it's
    just referring to a base that isn't upstream), but let's revert and reapply
    for clarity.
    
    Signed-off-by: default avatarSam James <sam@gentoo.org>
    5141d4d8
  • Gabi Falk's avatar
    i586: Fix multiple definitions of __memcpy_chk and __mempcpy_chk · 8323a83a
    Gabi Falk authored
    
    
    /home/bmg/install/compilers/x86_64-linux-gnu/lib/gcc/x86_64-glibc-linux-gnu/13.2.1/../../../../x86_64-glibc-linux-gnu/bin/ld: /home/bmg/build/glibcs/i586-linux-gnu/glibc/libc.a(memcpy_chk.o): in function `__memcpy_chk':
    /home/bmg/src/glibc/debug/../sysdeps/i386/memcpy_chk.S:29: multiple definition of `__memcpy_chk';/home/bmg/build/glibcs/i586-linux-gnu/glibc/libc.a(memcpy.o):/home/bmg/src/glibc/string/../sysdeps/i386/i586/memcpy.S:31: first defined here /home/bmg/install/compilers/x86_64-linux-gnu/lib/gcc/x86_64-glibc-linux-gnu/13.2.1/../../../../x86_64-glibc-linux-gnu/bin/ld: /home/bmg/build/glibcs/i586-linux-gnu/glibc/libc.a(mempcpy_chk.o): in function `__mempcpy_chk': /home/bmg/src/glibc/debug/../sysdeps/i386/mempcpy_chk.S:28: multiple definition of `__mempcpy_chk'; /home/bmg/build/glibcs/i586-linux-gnu/glibc/libc.a(mempcpy.o):/home/bmg/src/glibc/string/../sysdeps/i386/i586/memcpy.S:31: first defined here
    
    After this change, the static library built for i586, regardless of PIC
    options, contains implementations of these functions respectively from
    sysdeps/i386/memcpy_chk.S and sysdeps/i386/mempcpy_chk.S.  This ensures
    that memcpy and mempcpy won't pull in __chk_fail and the routines it
    calls.
    
    Reported-by: default avatarFlorian Weimer <fweimer@redhat.com>
    Signed-off-by: default avatarGabi Falk <gabifalk@gmx.com>
    Reviewed-by: default avatarH.J. Lu <hjl.tools@gmail.com>
    Reviewed-by: default avatarDmitry V. Levin <ldv@altlinux.org>
    (cherry picked from commit 0fdf4ba4)
    8323a83a
  • Gabi Falk's avatar
    i686: Fix multiple definitions of __memmove_chk and __memset_chk · 8b005d78
    Gabi Falk authored
    Commit c73c96a4
    
     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: default avatarSam James <sam@gentoo.org>
    Tested-by: default avatarSam James <sam@gentoo.org>
    Fixes: c73c96a4
    
     ("i686: Fix build with --disable-multiarch")
    Signed-off-by: default avatarGabi Falk <gabifalk@gmx.com>
    Reviewed-by: default avatarH.J. Lu <hjl.tools@gmail.com>
    Reviewed-by: default avatarDmitry V. Levin <ldv@altlinux.org>
    (cherry picked from commit 5a2cf833)
    8b005d78
  • Gabi Falk's avatar
    Add a test to check for duplicate definitions in the static library · f8e46234
    Gabi Falk authored
    
    
    This change follows two previous fixes addressing multiple definitions
    of __memcpy_chk and __mempcpy_chk functions on i586, and __memmove_chk
    and __memset_chk functions on i686.  The test is intended to prevent
    such issues from occurring in the future.
    
    Signed-off-by: default avatarGabi Falk <gabifalk@gmx.com>
    Reviewed-by: default avatarH.J. Lu <hjl.tools@gmail.com>
    Reviewed-by: default avatarDmitry V. Levin <ldv@altlinux.org>
    (cherry picked from commit ded2e075)
    f8e46234
......@@ -577,6 +577,13 @@ $(objpfx)lint-makefiles.out: scripts/lint-makefiles.sh
$(SHELL) $< "$(PYTHON)" `pwd` > $@ ; \
$(evaluate-test)
# Link libc.a as a whole to verify that it does not contain multiple
# definitions of any symbols.
tests-special += $(objpfx)link-static-libc.out
$(objpfx)link-static-libc.out:
$(LINK.o) $(whole-archive) -r $(objpfx)libc.a -o /dev/null > $@ 2>&1; \
$(evaluate-test)
# Print test summary for tests in $1 .sum file;
# $2 is optional test identifier.
# Fail if there are unexpected failures in the test results.
......
......@@ -26,7 +26,7 @@
#define LEN SRC+4
.text
#if defined PIC && IS_IN (libc)
#if defined SHARED && IS_IN (libc)
ENTRY (__memcpy_chk)
movl 12(%esp), %eax
cmpl %eax, 16(%esp)
......
......@@ -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)
......
......@@ -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)
......