From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-4.2 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id A0C031F8C6 for ; Tue, 14 Sep 2021 05:29:53 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6EDB63858023 for ; Tue, 14 Sep 2021 05:29:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6EDB63858023 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1631597391; bh=I0UBfBwzkmnXEMg8RMJyHWTOZ+di5U8sHQBDlfmXZBI=; h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=IGsW9mnK6GP3J5v7vb7trcU0MALbVCMCNT8XKpciRnkgZwb19QgOyTtvt2sHWPACb sYx/yJpth+/sAGROiEpCNsNaQyNB52tCZDk7c/pA/8o9jyDg/t4bLDCw2qgZ+M7xSe h8i9YKFyn5T6N4coO8yDGD6h9kj4/DdTroU1ZSUU= Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by sourceware.org (Postfix) with ESMTPS id E9C653858402 for ; Tue, 14 Sep 2021 05:29:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E9C653858402 Received: by mail-pj1-x102a.google.com with SMTP id u13-20020a17090abb0db0290177e1d9b3f7so1239964pjr.1 for ; Mon, 13 Sep 2021 22:29:31 -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; bh=S8Sixl6GfDsBqN2QE0OOwny27i4Smx7rHmZvEEr7DDQ=; b=WUrJ3GDBKKl5InWPRhMrRXdfJeBAfVPYVvIF7qbF8mDdOZPn2kHTvITtS2LWpZZZA1 XbArGKmFgDOwAnQZ+X01pA0CJOWoA+6+5K0N+jPNqhTJfEpkb2CQeBMzzcTKD3/7lEu6 Z87aJ5jRu+VmwaXjwNWUJVWjYa359GiJDSnYmmskY6QOXdanj1mn50a2rZF2rGS8MdFh oBVynTkABeFdAxIuClIzbClOneLgcV0+fwGXAUCwIih891RZ8Zm/eivkn7eZClBra8/X +qHFdN4qBFK3qnf+xpVZ1CyzqdWpaWkhCz/romZNl5NStVS1acAZ2XJPhrP5mnaGhIX3 qEOw== X-Gm-Message-State: AOAM531hzk+uWG5u3iolUFzqLmFmU1nCDUOnOSdRM8Ia2te0nlb/njWW dhxdgpxpOkl82zDci46MeZx1dpafgAtqxCcfpYa9q2iK3LfMqA== X-Google-Smtp-Source: ABdhPJzzjWN2C5qbXV86B9TZOqzddyKVspGiCAlCskghIOaT3TqyVQsGRM+uFfKdo/kDo/wQGJQ67F/EkjTaK3U3TMU= X-Received: by 2002:a17:90b:180a:: with SMTP id lw10mr37522pjb.87.1631597370933; Mon, 13 Sep 2021 22:29:30 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 14 Sep 2021 00:29:20 -0500 Message-ID: Subject: Re: [PATCH 5/5] x86_64: Add evex optimized bcmp implementation in bcmp-evex.S To: DJ Delorie Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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: , From: Noah Goldstein via Libc-alpha Reply-To: Noah Goldstein Cc: GNU C Library Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" On Mon, Sep 13, 2021 at 11:21 PM DJ Delorie wrote: > Noah Goldstein writes: > > So I think I was able to fix the build by making a new file in > glibc/string/bcmp.c > > and just having bcmp call memcmp > > > > Is there another/better way to fix the build? I don't think it's reall= y > fair that every > > arch other than x86_64 should have to pay an extra function call cost t= o > use bcmp. > > There are at least three... > > First, note that bcmp is a weak alias to memcmp already - see > strings/memcmp.c - which avoids the extra call you mention. > > So, you could either move that weak alias into bcmp.c, or arrange for > bcmp.c to not be needed by the Makefile for non-x86_64 platforms. > Lastly, an empty bcmp.c wouldn't override the alias in memcmp.c. I > think the first would be easiest, although it may be tricky to compile a > source file that seems to do "nothing". Also, I suspect liberal use of > comments would be beneficial for the unsuspecting reader ;-) > > I see. I was able to get it working with just an empty bcmp.c file but was not abl= e to move the weak_alias from memcmp.c to bcmp.c Adding: ``` #ifdef weak_alias # undef bcmp weak_alias (memcmp, bcmp) #endif ``` to bcmp.c gets me the following compiler error: ``` bcmp.c:24:21: error: =E2=80=98bcmp=E2=80=99 aliased to undefined symbol =E2= =80=98memcmp=E2=80=99 ``` irrespective of the ifdef/undef and whether I include string.h/manually put in a prototype of memcmp. Sorry for the hassle. Build infrastructure, especially in a project as complex as this, is a bit out of my domain. > Alternately, you could change your patch to provide alternate versions > of memcmp() instead of bcmp(), as glibc's bcmp *is* memcmp. This is > what other arches (and x86_64) do: > I'm not 100% sure what you mean? memcmp can correctly implement bcmp but not the vice versa. > > $ find . -name 'memcmp*' -print > >