From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x229.google.com (mail-oi1-x229.google.com [IPv6:2607:f8b0:4864:20::229]) by sourceware.org (Postfix) with ESMTPS id 33A7B385701A for ; Fri, 17 Sep 2021 16:55:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 33A7B385701A Received: by mail-oi1-x229.google.com with SMTP id n27so14867076oij.0 for ; Fri, 17 Sep 2021 09:55:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=xdSmGgJkyDOULWDQacVDZucHDYprLwj7kIbLumx2DFw=; b=fQlyc6hVvfrykPxpnjQL47NOR18DudO70bgRl7F3Z8g2IWS3JghyBo+gw+tg8r8IX0 xxS2cC+QA8Y+EZ+59oNa8GKiPJK3r0UjE7QXeZnGhBqoryzUyfOtIUKzCrY+S7SFRv/F MeY2x+t5CLcFljGa1oqn1mD1iV0tu4siq/lzPQ2EkQHaP0mtOx5RAzRBCkSx5nnrn3tV /FxytUxep8NUm7oMB0kOu1LF3Lg/oUv0DMBrFYAtApb6W9ta/gHavJAPgOhtd28iGaoa JhCIh3gU33ITTP6p5sEf634cthzgn6KBQ2jNeA9t+ox/nHSnBqVL9AUgMXTaEWIQygmZ 9LYw== X-Gm-Message-State: AOAM531yv1yHyXUHxbTFYWn2PcKaD16T08CiExlEk7s9tY4i43fwEaHv I+Z/2z9iAtjPkTlfN3wdVGo= X-Google-Smtp-Source: ABdhPJw9IFZ+rxyiKJRsoHTZ7f6Veb3Z7mStLioFNUjVwK+KnjNNFo/e9YtZvLS7SYyLf3dIBy9MjA== X-Received: by 2002:a05:6808:46:: with SMTP id v6mr2461571oic.72.1631897739654; Fri, 17 Sep 2021 09:55:39 -0700 (PDT) Received: from [192.168.0.41] (97-118-96-133.hlrn.qwest.net. [97.118.96.133]) by smtp.gmail.com with ESMTPSA id c24sm890159ook.37.2021.09.17.09.55.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Sep 2021 09:55:39 -0700 (PDT) Subject: Re: [libc-coord] Add new ABI '__memcmpeq()' to libc To: Jakub Jelinek , Florian Weimer Cc: Richard Biener via Gcc , GNU C Library , Joseph Myers , libc-coord@lists.openwall.com References: <87y27vhbel.fsf@oldenburg.str.redhat.com> <20210917091219.GL304296@tucnak> From: Martin Sebor Message-ID: <455bbaab-5ed3-fa1d-cf51-1b0a644c858d@gmail.com> Date: Fri, 17 Sep 2021 10:55:38 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <20210917091219.GL304296@tucnak> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, NICE_REPLY_A, 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: Fri, 17 Sep 2021 16:55:41 -0000 On 9/17/21 3:12 AM, Jakub Jelinek via Gcc wrote: > On Fri, Sep 17, 2021 at 10:08:34AM +0200, Florian Weimer via Gcc wrote: >>> So the compiler would emit a call to __memcmpeq and at the same time >>> emit a weak alias of __memcmpeq to memcmp so the program links >>> when the libc version targeted does not provide __memcmpeq? Or would >>> glibc through magically communicate the availability of the new ABI >>> without actually declaring the function? >> >> I do not think ELF provides that capability. >> >> We can add a declaration to to communicate the availability. >> I think this is how glibc (and other libcs) communicate the availability >> of non-standard interfaces to GCC. > > Yeah, that is what we've done in the past, e.g. in case of stpcpy. The stpcpy hack has been a cause of mysterious bugs as discussed in pr82429. It means that programs that declare standard functions without #including or use GCC built-ins directly are enalized by ending up with suboptimal code than those that do include the header. It's also a subtlety that not all of us keep in mind when working on GCC, that can lead to wasted time trying to understand why an expected optimization isn't working in one test case when it does work in an apparently equivalent one. Martin