public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Cary Coutant <ccoutant@gmail.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: Fangrui Song <maskray@google.com>,
	libc-alpha@sourceware.org, binutils@sourceware.org
Subject: Re: [PATCH] elf: Support DT_RELR relative relocation format [BZ #27924]
Date: Tue, 26 Oct 2021 16:28:29 -0700	[thread overview]
Message-ID: <CAJimCsHBOZNNdU-DYL1j3eTrNH8bawkkG1hUwNd2=G-cJuNxyQ@mail.gmail.com> (raw)
In-Reply-To: <3368ef30-eb8c-8828-1af0-1a227d99dc93@suse.com>

> While in line with the proposed spec additions I'm afraid the uses of
> ElfW(Addr) here aren't universally correct: You assume that ELF
> container type (size) expresses an aspect of the ABI. While this is
> indeed the case for several arch-es, I think this has been a mistake.
> IA-64, while meanwhile mostly dead, is (was) an example where 64-bit
> code can validly live in a 32-bit ELF container (at least as far as
> the psABI is concerned; I have no idea whether glibc actually
> followed the spec). There's a separate ELF header flag indicating the
> ABI, and hence the size of a pointer.

The IA-64 ABI specifically requires the class of the container
(ELFCLASS32 vs ELFCLASS64) to match the runtime model for executable
objects. It's allowable to use ELFCLASS32 for 64-bit relocatable
objects, but not for executable objects. Thus, I think it's quite
reasonable to spec it this way, and it really isn't any different from
a non-RELR relocation. For executables, there really are strong ties
between the ELF container size and the runtime model.

One point that I don't think has been raised yet is that some
platforms, like IA-64, may have more than one RELATIVE relocation.
IA-64 has four -- R_IA64_REL{32|64}{MSB|LSB} -- only one of which
would be eligible (or expected) in a RELR context. I'm thinking that a
DT_RELRTYPE entry specifying the relocation type might be called for,
just to make it explicit. I suppose it could be optional for platforms
where there is only one choice of R_XXX_RELATIVE.

-cary

  parent reply	other threads:[~2021-10-26 23:28 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-08  6:57 Fangrui Song
2021-10-08 15:39 ` Florian Weimer
2021-10-08 16:36   ` Fangrui Song
2021-10-08 19:41     ` Cary Coutant
2021-10-08 16:51 ` H.J. Lu
2021-10-08 17:37   ` Fangrui Song
2021-10-08 17:43     ` H.J. Lu
2021-10-08 18:46       ` Fangrui Song
2021-10-11  7:48 ` Jan Beulich
2021-10-11 18:43   ` Fāng-ruì Sòng
2021-10-11 22:08     ` Joseph Myers
2021-10-12  8:14       ` Jan Beulich
2021-10-12  8:18     ` Jan Beulich
2021-10-12 14:09       ` H.J. Lu
2021-10-12 16:07         ` Fāng-ruì Sòng
2021-10-13  6:00           ` Jan Beulich
2021-10-13  6:13             ` Fāng-ruì Sòng
2021-10-13  6:18               ` Fāng-ruì Sòng
2021-10-18  7:59                 ` Jan Beulich
2021-10-16 20:22   ` Fangrui Song
2021-10-26 23:28   ` Cary Coutant [this message]
2021-10-11 21:47 ` Joseph Myers

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='CAJimCsHBOZNNdU-DYL1j3eTrNH8bawkkG1hUwNd2=G-cJuNxyQ@mail.gmail.com' \
    --to=ccoutant@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=jbeulich@suse.com \
    --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).