From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yb1-xb36.google.com (mail-yb1-xb36.google.com [IPv6:2607:f8b0:4864:20::b36]) by sourceware.org (Postfix) with ESMTPS id D80F13858D20 for ; Sun, 28 Apr 2024 14:19:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D80F13858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D80F13858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::b36 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714313966; cv=none; b=BRzC8NZjT5vXZP6umE4tjGO5lCkYcLMH48/XBbuUbmBOK48K5jiUYtZrTqTVOYl875CtjyevQCul2qukiDDdiHv9NWicnSF+57oKCiTGzRZiQwDep2v8IF09Q4gtbc3zRv/MuNTngHLl3iuLF9uppTQbHyaEiK6NONWq7dP0gn0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714313966; c=relaxed/simple; bh=VGYrLOXmtZYtzobzauOnH4AncC85G/IgOgE4gnoOSnA=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=LLzdfh+2UrxU0fGfjnqp4nyFVJBjJ/90YmkDpEnSlUFs88NJDYeMlHUSe9IgIqofPstVZnGfYQOZnnIpvtW0lPeidKOiG13tu+8HnUm/YaiE/SuS7DpICUW+21kqLuJv4tzlWJrTRqWlWI2wTsl65v4VAh06zxKu4jfGr1ocUHg= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-yb1-xb36.google.com with SMTP id 3f1490d57ef6-de5a4d737f1so2618253276.2 for ; Sun, 28 Apr 2024 07:19:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714313963; x=1714918763; darn=sourceware.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=9icj9k0vTWrWYpT6ZUaFYU2peCq7y68DfWzVZ3qhXm8=; b=NF+F3MnIXuT0/96fpkyqgtlCAzvZULsA5DZSleCyNORqhrVt705vOEjTyWAGlAsFOn XOISNdxaAPUHjTtxg1VrDFpNp61zBQ02VwhbgI11z9AjrRY/MDr8QMgkfrGS5cNXznwv NdMtg0HCBDn3QPAkY4Ukxoe6X3w4miyx+V32wLXYjmOmMfcweMdLLQxl3blX2zz0UX2V EGE0JsTvzmbEiNzmxm/n+sAs9oBOFUZfiz5rqemtt+h1xTOPXnQybNJLsiY3OwpLzG5c IgCjDuJfNiaCcxrVtMTCbtoZFN5qWq0VSR95bloeLH38NQPJArLGsD1sPxJRa37RhTs/ qaEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714313963; x=1714918763; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9icj9k0vTWrWYpT6ZUaFYU2peCq7y68DfWzVZ3qhXm8=; b=gpFapqzdFNA8aM5rEayLy4h599yQsTK4ZEnZE/cddgogT7abjHqQrEfEDjk30bpK79 2Msl20koagBHnULBAli4SzKrtSP60rQpjVQnWNtNZ6ryatBTOtAVC17o6jTU3AcHbYIv DM1A+bGF6rTcyV7sK/CKKTCx2YZKnoauKkoArhBrobCYRpZSnbZ3V8HcxSGOzCHAwypN d8Xs694tzFDLGrHeY8tLe8zwqDMv+50j6zRa1sRq0FyJR1BiF94Ik7zbsCZlTT5jygTx L+uM4rJoeNM/t1ZleMcbDJrsZzeXY+5T9DhvtfFDPw8rc95PChn4ahxE4RMdFwTMRiWd 5mag== X-Gm-Message-State: AOJu0Yxt3WdFh/0DkHwKgP6n8p9WVb3b3zMhpwThqW1J2d/gWXAE4I8z 8VAlLNTFlgUJLYC8YPJ2w49bbyh24QfPMj/Nzcit9a0KjMKxSKHSUkRZsswXuW9EBvorWXtci34 zjdQtDKuXhREEURBL9RWX4kvX8ik= X-Google-Smtp-Source: AGHT+IFT9mEdAztNA61YRb6rMqfZ28WHInOMjpPNaWTVS4liASflLyKWY8Hp5OXr2FHNzJ14R88aNMuy8Mp4BGuTA9k= X-Received: by 2002:a05:690c:6401:b0:61a:d21f:a131 with SMTP id hr1-20020a05690c640100b0061ad21fa131mr8911747ywb.37.1714313963086; Sun, 28 Apr 2024 07:19:23 -0700 (PDT) MIME-Version: 1.0 References: <20240427164229.1778534-1-gabifalk@gmx.com> In-Reply-To: <20240427164229.1778534-1-gabifalk@gmx.com> From: "H.J. Lu" Date: Sun, 28 Apr 2024 07:18:47 -0700 Message-ID: Subject: Re: [PATCH v2] i686: Fix multiple definitions of __memmove_chk and __memset_chk To: Gabi Falk Cc: libc-alpha@sourceware.org, "Dmitry V. Levin" , Sam James Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3018.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Sat, Apr 27, 2024 at 9:42=E2=80=AFAM Gabi Falk wrote: > > Commit c73c96a4a1af1326df7f96eec58209e1e04066d8 updated memcpy.S and > mempcpy.S, but omitted memmove.S and memset.S. As a result, the > static library built 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/multiarc= h/memset_chk.c:24: first defined here > > Add a test to check that the static libc does not contain multiple > definitions of any symbols. > > Reported-by: Sam James > Fixes: c73c96a4a1 ("i686: Fix build with --disable-multiarch") > Signed-off-by: Gabi Falk > --- > Makefile | 7 +++++++ > sysdeps/i386/i686/memmove.S | 2 +- > sysdeps/i386/i686/memset.S | 2 +- > 3 files changed, 9 insertions(+), 2 deletions(-) > > diff --git a/Makefile b/Makefile > index 7052b46df8..2e351c0321 100644 > --- a/Makefile > +++ b/Makefile > @@ -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 +=3D $(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. > 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) When PIE is enabled by default, libc.a is compiled with PIC. > 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 > LGTM. Reviewed-by: H.J. Lu Thanks. --=20 H.J.