From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by sourceware.org (Postfix) with ESMTPS id 4EE3A3858406 for ; Wed, 29 Sep 2021 15:17:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4EE3A3858406 Received: by mail-pl1-x630.google.com with SMTP id x4so1758861pln.5 for ; Wed, 29 Sep 2021 08:17:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=r/ZeVwcVl7vzMsvUtXUhoe0xSpLEsdbGf9r78yl5H+s=; b=Zdd+JcXpawRlrunF7UqnHsPNx2sSUGchLANv3G0HzUFDXtBYF8ONKH7/Voq1baWIt8 NCJmH0p+BDLjXedgkAbDFFmGLJfGeLK4ombJszuFJ6+X8p5oafMDjHgXX/TdkaMSdwFv wG/0RQi7xi04rFifdCVU4rivXaiZAjjSJqm57a0n+XRWSZJ8aKRrT5FrtAfo1ENnW3AJ 88VqnwxJrcRYNkYlKnrfA2mJ04a4ljizXWWLriaY/cOzBJCiL9Bn23yBFro6Bd72B1eB NRjnOL95lB1k5YP3+PvI1SQCyuq1mUDDbidWlNbTWegm1hUPFgYGV83SYuYtHGdurTq1 4bjQ== X-Gm-Message-State: AOAM530PK/hcLU9G1OU2JQQxcKGS4yyuwV6ZMJ6MyCAZ7NqB4JvzbmzW S9fWtz9s5UdSXHfZcCc0K3Ui+B8rvy7lsghb788= X-Google-Smtp-Source: ABdhPJxrTYjgHnuOYjuGnnnv4D9sbuv+NcblaU/Y8KRwhgkN/D9KMpKvDB70+KBg4+/Flz7pIqR4OTCPSwEk91TRoD0= X-Received: by 2002:a17:902:7c94:b0:13b:8d10:cc4f with SMTP id y20-20020a1709027c9400b0013b8d10cc4fmr227744pll.54.1632928673254; Wed, 29 Sep 2021 08:17:53 -0700 (PDT) MIME-Version: 1.0 References: <20210927203827.2852935-1-goldstein.w.n@gmail.com> <20210928165341.2357817-1-goldstein.w.n@gmail.com> <87a6jv93s1.fsf@oldenburg.str.redhat.com> In-Reply-To: <87a6jv93s1.fsf@oldenburg.str.redhat.com> From: Noah Goldstein Date: Wed, 29 Sep 2021 10:17:42 -0500 Message-ID: Subject: Re: [PATCH v6] String: Add support for __memcmpeq() ABI on all targets To: Florian Weimer Cc: Noah Goldstein via Libc-alpha Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-9.9 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.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2021 15:17:55 -0000 On Wed, Sep 29, 2021 at 3:36 AM Florian Weimer wrote: > > * Noah Goldstein via Libc-alpha: > > > diff --git a/string/memcmp.c b/string/memcmp.c > > index 9b46d7a905..550b7bb69b 100644 > > --- a/string/memcmp.c > > +++ b/string/memcmp.c > > @@ -358,4 +358,6 @@ libc_hidden_builtin_def(memcmp) > > #ifdef weak_alias > > # undef bcmp > > weak_alias (memcmp, bcmp) > > +#undef __memcmpeq > > +weak_alias (memcmp, __memcmpeq) > > #endif > > Missing space after #. Fixed. > > > diff --git a/string/string.h b/string/string.h > > index 04e1b7067d..d965ca0eeb 100644 > > --- a/string/string.h > > +++ b/string/string.h > > @@ -64,6 +64,19 @@ extern void *memset (void *__s, int __c, size_t __n)= __THROW __nonnull ((1)); > > extern int memcmp (const void *__s1, const void *__s2, size_t __n) > > __THROW __attribute_pure__ __nonnull ((1, 2)); > > > > +/* Compare N bytes of S1 and S2. Return zero if S1 and S2 are equals. > > typo: =E2=80=9Care equal[].=E2=80=9D Fixed. > > > + Return some non-zero value otherwise. > > + > > + Essentially __memcmpeq has the exact same semantics as memcmp > > + except the return value is less constrained. memcmp is always a > > + correct implementation of __memcmpeq. As well !!memcmp, -memcmp, > > + or bcmp are correct implementations. > > + > > + Used by compilers when memcmp return is only used for its bolean > > + value. */ > > +extern int __memcmpeq (const void *__s1, const void *__s2, size_t __n) > > + __THROW __attribute_pure__ __nonnull ((1, 2)); > > I think we should be more explicitly say that __memcmpeq is declared for > use by compilers, programmers should use memcmp. Added 2 sentences expressing the point. > > > diff --git a/sysdeps/x86_64/multiarch/memcmp.c b/sysdeps/x86_64/multiar= ch/memcmp.c > > index fe725f3563..9cc4750bbc 100644 > > --- a/sysdeps/x86_64/multiarch/memcmp.c > > +++ b/sysdeps/x86_64/multiarch/memcmp.c > > @@ -29,6 +29,8 @@ > > libc_ifunc_redirected (__redirect_memcmp, memcmp, IFUNC_SELECTOR ()); > > # undef bcmp > > weak_alias (memcmp, bcmp) > > +#undef __memcmpeq > > +weak_alias (memcmp, __memcmpeq) > > Missing # indentation. Fixed. > > Rest looks okay. I have verified that this builds on all architectures. Thanks. Was able to do the same. > > Thanks, > Florian >