public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Noah Goldstein <goldstein.w.n@gmail.com>
To: Richard Biener <richard.guenther@gmail.com>
Cc: Florian Weimer <fweimer@redhat.com>,
	Richard Biener via Gcc <gcc@gcc.gnu.org>,
	 GNU C Library <libc-alpha@sourceware.org>,
	Joseph Myers <joseph@codesourcery.com>,
	libc-coord@lists.openwall.com
Subject: Re: [libc-coord] Add new ABI '__memcmpeq()' to libc
Date: Fri, 17 Sep 2021 12:40:15 -0500	[thread overview]
Message-ID: <CAFUsyfKWs9vtZ=Z0bNAiStfmfxCUaMRtgPPPjGCXjXqLapAMZg@mail.gmail.com> (raw)
In-Reply-To: <CAFiYyc3m8VM37Y=9EidVO7pT1GitLKRFPA8=c7FXv2QaFqs9ow@mail.gmail.com>

On Fri, Sep 17, 2021 at 3:32 AM Richard Biener via Gcc <gcc@gcc.gnu.org>
wrote:

> On Fri, Sep 17, 2021 at 10:08 AM Florian Weimer <fweimer@redhat.com>
> wrote:
> >
> > * Richard Biener via Gcc:
> >
> > > On Thu, Sep 16, 2021 at 10:36 PM Joseph Myers <joseph@codesourcery.com>
> wrote:
> > >>
> > >> On Thu, 16 Sep 2021, Chris Kennelly wrote:
> > >>
> > >> > In terms of relying on the feature:  If __memcmpeq is ever exposed
> as an a
> > >> > simple alias for memcmp (since the notes mention that it's a valid
> > >> > implementation), does that open up the possibility of depending on
> the
> > >> > bcmp-like behavior that we were trying to escape?
> > >>
> > >> The proposal is as an ABI only (compilers would generate calls to
> > >> __memcmpeq from boolean uses of memcmp, users wouldn't write calls to
> > >> __memcmpeq directly, __memcmpeq wouldn't be declared in installed libc
> > >> headers).  If such dependence arises, that would suggest a compiler
> bug
> > >> wrongly generating such calls for non-boolean memcmp uses.
> > >
> > > 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 <string.h> magically communicate the availability of the
> new ABI
> > > without actually declaring the function?
> >
> > I do not think ELF provides that capability.
>
> I guess a weak forwarder should do the trick at the cost of a jmp.
>

Where would the jmp be and under what conditions? Is there no way to achieve
this with zero overhead?


>
> > We can add a declaration to <string.h> to communicate the availability.
> > I think this is how glibc (and other libcs) communicate the availability
> > of non-standard interfaces to GCC.
>
> OK, I guess that's fine.
>
> > > (I'm not sure whether a GCC build-time decision via configure is the
> > > very best idea)
> >
> > If libstdc++ or libgcc_s have a symbol dependency on glibc 2.35 for
> > other (unrelated) reasons, would the build-time dependency be less of a
> > concern?  Because another such dependency exists?
>
> Not sure, I was thinking that we'd need to re-compile GCC when we
> upgrade glibc to make use of the feature.
>
> But then being able to run an executable on a system that does not
> provide the ABI but a compatible one (memcmp) might be a nice
> thing.
>
> Richard.
>
> > Thanks,
> > Florian
> >
>

  parent reply	other threads:[~2021-09-17 17:40 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-16 17:02 Noah Goldstein
2021-09-16 17:55 ` [libc-coord] " Chris Kennelly
2021-09-16 18:31   ` Noah Goldstein
2021-09-16 20:32     ` Chris Kennelly
2021-09-16 20:35       ` Joseph Myers
2021-09-16 20:55         ` enh
2021-09-17  7:43         ` Richard Biener
2021-09-17  8:08           ` Florian Weimer
2021-09-17  8:31             ` Richard Biener
2021-09-17  8:37               ` Florian Weimer
2021-09-17  9:30                 ` Richard Biener
2021-09-17 17:40               ` Noah Goldstein [this message]
2021-09-17  9:12             ` Jakub Jelinek
2021-09-17 16:55               ` Martin Sebor
2021-09-17 14:19           ` Joseph Myers
2021-09-17 14:26             ` Florian Weimer
2021-09-21 19:53               ` Noah Goldstein
2021-09-22 17:46                 ` Christoph Müllner
2021-09-22 18:15                   ` Noah Goldstein
2021-09-16 21:27 ` James Y Knight
2021-09-16 21:42   ` Joseph Myers
2021-09-16 21:50     ` enh
2021-09-16 21:59       ` Noah Goldstein
2021-09-16 22:17       ` Chris Kennelly
2021-09-16 22:36         ` Joseph Myers
2021-09-16 23:24         ` Noah Goldstein
2021-09-18  1:36       ` James Y Knight
2021-10-26 22:47 ` Noah Goldstein

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFUsyfKWs9vtZ=Z0bNAiStfmfxCUaMRtgPPPjGCXjXqLapAMZg@mail.gmail.com' \
    --to=goldstein.w.n@gmail.com \
    --cc=fweimer@redhat.com \
    --cc=gcc@gcc.gnu.org \
    --cc=joseph@codesourcery.com \
    --cc=libc-alpha@sourceware.org \
    --cc=libc-coord@lists.openwall.com \
    --cc=richard.guenther@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).