public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: Fangrui Song <maskray@google.com>
Cc: Adhemerval Zanella <adhemerval.zanella@linaro.org>,
	 GNU C Library <libc-alpha@sourceware.org>
Subject: Re: [PATCH] elf: Add elf checks for main executable
Date: Tue, 14 Dec 2021 22:53:17 +0100	[thread overview]
Message-ID: <87h7baq2eq.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <20211214213017.26ykobarym4kr7il@google.com> (Fangrui Song's message of "Tue, 14 Dec 2021 13:30:17 -0800")

* Fangrui Song:

> Should we consider different target triples as different ABI?
>
> * Debian/Ubuntu use Debian-style multiarch target triples like x86_64-linux-gnu.
> * RedHat uses target triples like x86_64-redhat-linux (considered questionable by some folks: https://reviews.llvm.org/D110900)
> * Suse uses target triples like x86_64-suse-linux (considered questionable by some folks).

Debian path layout isn't quite compatible with glibc upstream
(/etc/ld.so.cache papers over that to some extent), but that's not the
issue here.

The LLVM review refers to an internal GCC path that can be queried from
the gcc command line, so this is mostly a performance issue or
distribution integration issue (e.g., llvm/clang package postinst could
run gcc to determine the right path).  Even if you know the subdirectory
under /usr/lib/gcc to use, you still need to guess the appropriate
compiler version.  So this is really deeply internal stuff.

config.guess reports x86_64-pc-linux-gnu on these systems, so there is
no material difference.  These internal GCC paths are not required at
all to match the triplet.

> Currently there is no rigid enforcement that one target triple doesn't
> run on another, but a mechanism could be developed if you want to
> prevent "running one distro's exe on another leads to crash".
> This practice can make some software unhappy as they currently release
> binary releases which may run a different distro, which even if brittle,
> sometimes/oftentimes work.

Debian, Red Hat, and SUSE pay fairly close attention to each other and
make sure that binaries are more or less portable, as far as the core
library version constraints permit (e.g. you can move a Debian 11 binary
that uses just glibc and libstdc++ to Red Hat Enterprise Linux 8 and it
is expected to work, unless of course it relies on some Debian specifics
in its application logic).

LSB may be dead, but its spirit lives on in the form of
distribution-independent ABIs for the core run-time libraries.  A
current example is the work on the libgfortran float128 ABI for POWER.
This is a bunch of tricky ABI work which could have been avoided by a
flag day and essentially a private per-distribution ABI (the ABI would
per quasi-distribution-specific for some time because different
distributions would switch to float128 at different times).

A much smaller example is the recent glibc rseq integration, which has a
large part that can be backported without ABI changes, for distributions
that are interested in the sched_getcpu acceleration.

> As my blog post says, ELFOSABI_NONE will unlikely change EI_ABIVERSION for RELR.
> Is the proposal "if ld.bfd --pack-dyn-relocs=relr-glibc is specified,
> and the output is otherwise ELFOSABI_NONE or ELFOSABI_GNU, use
> ELFOSABI_GNU and bump EI_ABIVERSION to 4"?  This ELFOSABI_GNU is not
> elegant as RELR is not a GNU extension. OK, I have objection but not so
> strongly.
>
> Since ld.lld --pack-dyn-relocs=relr is there and won't change the
> behavior, ld.lld's relr-glibc will likely just be an alias without doing
> the EI_ABIVERSION dance.

If ld.lld will ignore what the ABI says regarding feature lockout, we
have two options:

* Ditch the idea of the lockout because it won't work reliably anyway.

* In upstream glibc, accept DT_RELR only if the lockout is also present.
  That is, ld.lld DT_RELR will not work with upstream glibc until it
  produces the proper markup.

The second approach would qualify as the nuclear option, I guess.

Thanks,
Florian


  reply	other threads:[~2021-12-14 21:53 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-19 15:03 Adhemerval Zanella
2021-11-19 15:33 ` H.J. Lu
2021-11-19 16:05   ` H.J. Lu
2021-11-19 17:06     ` Adhemerval Zanella
2021-12-06 19:03 ` H.J. Lu
2021-12-06 19:09 ` Florian Weimer
2021-12-06 19:22   ` H.J. Lu
2021-12-06 20:31     ` Adhemerval Zanella
2021-12-06 20:37       ` Florian Weimer
2021-12-06 21:07         ` Adhemerval Zanella
2021-12-07 15:45           ` Florian Weimer
2021-12-07 17:35             ` Adhemerval Zanella
2021-12-08  0:01               ` Fāng-ruì Sòng
2021-12-08 10:19                 ` Florian Weimer
2021-12-14  0:17                   ` Fāng-ruì Sòng
2021-12-14  9:03                     ` Florian Weimer
2021-12-14  9:09                       ` Fāng-ruì Sòng
2021-12-14  9:18                         ` Florian Weimer
2021-12-14 19:03                           ` Fangrui Song
2021-12-14 12:28                         ` Adhemerval Zanella
2021-12-14 12:23                       ` Adhemerval Zanella
2021-12-14 19:24                         ` Fangrui Song
2021-12-14 21:07                           ` Adhemerval Zanella
2021-12-14 21:30                             ` Fangrui Song
2021-12-14 21:53                               ` Florian Weimer [this message]
2021-12-14 23:08                                 ` Fangrui Song

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=87h7baq2eq.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=libc-alpha@sourceware.org \
    --cc=maskray@google.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).