From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yw1-x1133.google.com (mail-yw1-x1133.google.com [IPv6:2607:f8b0:4864:20::1133]) by sourceware.org (Postfix) with ESMTPS id 59F503858D20 for ; Tue, 30 Apr 2024 20:13:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 59F503858D20 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 59F503858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::1133 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714507981; cv=none; b=rGUbcCbepPWHPUeVMTwk58f2RWZfNdKD559VJVhHzb90JzZ2dwIdNtA/v2CSRgxAEy0CRoA/58eXKqXEY0J4h9zzXmj3HGF4oi4X6BZT1ICWWkUFOj9ZWxRDXeNzGCuPDFN5p1b+eCm33uBlAdFXgGaCqUfY7K1IDT/6iRnEVEY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714507981; c=relaxed/simple; bh=zO9KZBC2NsuPOplBxW72c5xLKPbqQ6T+EPJZWm1Kit8=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=W/mkWfDyJxkZ3kRfnjMO8zRSVtAIiS7PSF4i8Umsi+l5FBoglBH6yCOrikSKubxKJZOAiTztl+RtuwfkzNkpHzZBOoJvpCuvbQc1JzfhApSzmgBHrEY0HzkHJGU/ALOrbewy/qBWW0pHkbmv7und5BG8tGd2zyRuVzEvQswWMyU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-yw1-x1133.google.com with SMTP id 00721157ae682-61b4cbb8834so61714087b3.0 for ; Tue, 30 Apr 2024 13:13:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714507979; x=1715112779; 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=4EJc4o9mstm0wGxCTJFh96O2DZr8AyIDNYvSTT0Gq8U=; b=gtKLGKpYylnw94tD0LwH2HuK78ugJ6hpCcU7SquQS2xLvEvSmBowme8OqDLFbJb598 C7cI7mN2jPGO0C7LitEovRFNUT0zGmuOddTy2v3z3oyFm+mdUm3+fgQu+t60uBGpZqzz E5vTLLGhz5AVtOk4YYTKHLoDUw5rDAtZNeK75cxVSyq5XoAoIv0+si06zLc6sU6O73Y8 6zOKhU9L65+luSk4YrJ8vkFb73IT6UhsYKVfCUIckUZLW0U6OLyhdhDggeCnVma4VevA AOfvmtqfXE/BnqhdWottvvkm0LAsBXUXZ07qsIQG8XsXY2TkD3uFiUEKoZd+XZ5JcHhA vnRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714507979; x=1715112779; 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=4EJc4o9mstm0wGxCTJFh96O2DZr8AyIDNYvSTT0Gq8U=; b=AanPW+gn+wfWGYyhYUqkxV6AH4sWQK7yu+0Q76wLMQrWjz/MUIOZdY0CBxsAP21DNy UwE2EqSDygUaWuiRT3Sv4/ZR0LEpEhq5xeWs6OpYGdUSWFzwAkGQiWBtMTe/NUqBfBUU uCoEZVZl3tZeDpbdrOjbvVhz0NvT7HZO5Ws/AnA7noYUVmahhKc/vZrMLPNzv2Ov+6ih mnZ5MDx4qrPxPALxONSvDorREVGwTcpGBZynjKVtvu4w/IDD2U0HpkrEPd46yLZdjTFU 7AqdZ5Vtxee/yhemfPQpb6OY5ivLqUv3JcjAzk2yP141MMZXMHdNIpgufivEwK6WLF+C 14eg== X-Gm-Message-State: AOJu0YyweUQywfsBx9WKbM9vgFw+txo4ckHwqWn8frB+0/ze9HAygU4a G830i9IIWka9NOrZc9fEseEiixgEn8qvPMdFp0SVSOuiOJ/yHwWxXO/MsC2tIn5T7BrLaRpkHUh uT7b8JhRCh0w50a85R9oE4rs/efM= X-Google-Smtp-Source: AGHT+IGoXQEArIIQc9kYEXS+OM6p2gc3SNLUBQ8G3Iqpf90BFHBzQqzuzcfJ602JdHnhm1hgwR/PlGQpHd6zf9SjKRo= X-Received: by 2002:a05:690c:9d:b0:61b:d7fe:f744 with SMTP id be29-20020a05690c009d00b0061bd7fef744mr625993ywb.35.1714507979666; Tue, 30 Apr 2024 13:12:59 -0700 (PDT) MIME-Version: 1.0 References: <20240430200506.2717717-1-gabifalk@gmx.com> <20240430200506.2717717-3-gabifalk@gmx.com> In-Reply-To: <20240430200506.2717717-3-gabifalk@gmx.com> From: "H.J. Lu" Date: Tue, 30 Apr 2024 13:12:23 -0700 Message-ID: Subject: Re: [PATCH 2/3] i686: Fix multiple definitions of __memmove_chk and __memset_chk To: Gabi Falk Cc: libc-alpha@sourceware.org, Florian Weimer , "Dmitry V. Levin" , Sam James Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3019.4 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 Tue, Apr 30, 2024 at 1:05=E2=80=AFPM 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 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/multiarc= h/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 > Fixes: c73c96a4a1 ("i686: Fix build with --disable-multiarch") > Signed-off-by: Gabi Falk > Reviewed-by: H.J. Lu > --- > 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 > LGTM. Reviewed-by: H.J. Lu Thanks. --=20 H.J.