From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt1-x832.google.com (mail-qt1-x832.google.com [IPv6:2607:f8b0:4864:20::832]) by sourceware.org (Postfix) with ESMTPS id 798E63857C77 for ; Thu, 21 Oct 2021 20:02:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 798E63857C77 Received: by mail-qt1-x832.google.com with SMTP id t2so1567176qtn.12 for ; Thu, 21 Oct 2021 13:02:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=XvafFcYKB36v4kRBA00GQ345eO9v5lu08MpsWSrfXJ4=; b=2xLTIzwD/cCJhaQthADdmxmrasvhdQx121Htyzu+aKsPMlYOKAMNMN2lOnkv5DAQE1 Lyuz72IQG49MCc6BYDRbJyNLZ0fbFt0j8RxtzkSrgi/Ccq5R0EV0/wbHOHG4dRGEC2kh g6TVM0aV/fL7R9Ih4pchzQAGnYR52jR2arFCYVcuZTlsC/XIg4R82ZY7EmNlRAOC0wXP BT5BEnjWYLoTuq6m/2SONJ5Kgu/bepMIpwK5XBylYDFXtyy5gj7Yl8uxhOKz/OtJbkpd Z/nQjxlTULZ5Ep3oy9se9teufLd2ShB46woIEiN+02hJq2zrtTbiThtrBLhMWviWlxMU O5MQ== X-Gm-Message-State: AOAM531vS6HZ8yiQS+QDZaWlQNDPDkQXF8oAETUpkHy6P67b9p0c6dnV f2FWpwGFxY/htDaFa/snzS25H8VWEcAJdA== X-Google-Smtp-Source: ABdhPJyXr+HEHRyiOGTH1tCdEkbaQTafP0D/jYsxK+TCIy92t7xq10867OD3tN2tFVq98mO4L86f0g== X-Received: by 2002:a05:622a:1209:: with SMTP id y9mr8712121qtx.13.1634846546078; Thu, 21 Oct 2021 13:02:26 -0700 (PDT) Received: from ?IPV6:2804:431:c7ca:2654:4963:d466:e6c9:ddbb? ([2804:431:c7ca:2654:4963:d466:e6c9:ddbb]) by smtp.gmail.com with ESMTPSA id x15sm3125551qkp.113.2021.10.21.13.02.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 21 Oct 2021 13:02:25 -0700 (PDT) Message-ID: <4b1a9ad0-1118-9416-6dd8-c70969442323@linaro.org> Date: Thu, 21 Oct 2021 17:02:23 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.2 Subject: Re: [PATCH v7] String: Add support for __memcmpeq() ABI on all targets Content-Language: en-US To: Noah Goldstein , "H.J. Lu" Cc: GNU C Library References: <20210927203827.2852935-1-goldstein.w.n@gmail.com> <20210929151743.3351092-1-goldstein.w.n@gmail.com> From: Adhemerval Zanella In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, URIBL_BLACK 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: Thu, 21 Oct 2021 20:02:28 -0000 >>> diff --git a/string/string.h b/string/string.h >>> index 04e1b7067d..d0b714f836 100644 >>> --- a/string/string.h >>> +++ b/string/string.h >>> @@ -64,6 +64,22 @@ 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 equal. >>> + 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. >>> + >>> + __memcmpeq is meant to be used by compilers when memcmp return is >>> + only used for its bolean value. >>> + >>> + __memcmpeq is declared only for use by compilers. Programs should >>> + continue to use memcmp. */ >>> +extern int __memcmpeq (const void *__s1, const void *__s2, size_t __n) >>> + __THROW __attribute_pure__ __nonnull ((1, 2)); >> >> Please add an internal one in include/string.h so that it can be called >> within libc.so bypassing PLT. Find one place in glibc where __memcmpeq >> can be used and use it. > > Usage outside of a test? It is currently used directly in string/tester.c Add a libc_hidden_proto on include/string.h and a libc_hidden_def on each implementation to create a local alias that bypass PLT if we eventually need to call it from within glibc.