From: Fangrui Song <maskray@google.com>
To: Alan Modra <amodra@gmail.com>
Cc: Jan Beulich <jbeulich@suse.com>,
Binutils <binutils@sourceware.org>,
Nick Clifton <nickc@redhat.com>,
Cary Coutant <ccoutant@gmail.com>
Subject: Re: ELF's DT_ENCODING
Date: Tue, 23 May 2023 13:43:46 -0700 [thread overview]
Message-ID: <CAFP8O3LU54AWctJgYC25XBvULnSJZDO_ZSd_kmT6mhTf8+Gpyg@mail.gmail.com> (raw)
In-Reply-To: <ZGshslEwk08sXN2/@squeak.grove.modra.org>
On Mon, May 22, 2023 at 1:03 AM Alan Modra <amodra@gmail.com> wrote:
>
> On Mon, May 22, 2023 at 08:57:00AM +0200, Jan Beulich wrote:
> > I think that part of the change wants reverting
>
> Yes, I think it was probably bumped without consulting the spec. ;-)
> ie. it was changed just for readelf. I'm going to commit the
> following after running my normal regression tests.
>
> include/
> * elf/common.h (DT_ENCODING): Set back to 32.
> binutils/
> * readelf.c (struct filedata): Don't size dynamic_info array
> using DT_ENCODING.
>
> diff --git a/binutils/readelf.c b/binutils/readelf.c
> index b872876a8b6..d8ad58b15dc 100644
> --- a/binutils/readelf.c
> +++ b/binutils/readelf.c
> @@ -304,7 +304,7 @@ typedef struct filedata
> uint64_t * mipsxlat;
> uint64_t gnusymidx;
> char * program_interpreter;
> - uint64_t dynamic_info[DT_ENCODING];
> + uint64_t dynamic_info[DT_RELRENT + 1];
> uint64_t dynamic_info_DT_GNU_HASH;
> uint64_t dynamic_info_DT_MIPS_XHASH;
> elf_section_list * symtab_shndx_list;
> diff --git a/include/elf/common.h b/include/elf/common.h
> index 6f64f05890c..ffa6b60bd2b 100644
> --- a/include/elf/common.h
> +++ b/include/elf/common.h
> @@ -1135,13 +1135,16 @@
> #define DT_FINI_ARRAYSZ 28
> #define DT_RUNPATH 29
> #define DT_FLAGS 30
> +
> +/* Values in the range [DT_ENCODING, DT_LOOS) use d_un.d_ptr if the
> + value is even, d_un.d_val if odd. */
> +#define DT_ENCODING 32
> #define DT_PREINIT_ARRAY 32
> #define DT_PREINIT_ARRAYSZ 33
> #define DT_SYMTAB_SHNDX 34
> #define DT_RELRSZ 35
> #define DT_RELR 36
> #define DT_RELRENT 37
> -#define DT_ENCODING 38
>
> /* Note, the Oct 4, 1999 draft of the ELF ABI changed the values
> for DT_LOOS and DT_HIOS. Some implementations however, use
>
> --
> Alan Modra
> Australia Development Lab, IBM
Thanks to Jan for spotting my mistake and Alan for fixing the issue in
commit bc227f4ccb0778a56ca3d9f27652fd9e5e2747ea (Re: readelf: Support
SHT_RELR/DT_RELR for -r).
Apologies for not taking a closer look at the spec that DT_ENCODING is
defined, when that RELR patch was prepared.
--
宋方睿
next prev parent reply other threads:[~2023-05-23 20:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <ff04d1a8-1adc-2da6-5ae5-7fd5ae3c5b72.ref@aol.com>
2023-05-22 6:57 ` Jan Beulich
2023-05-22 8:02 ` Alan Modra
2023-05-23 20:43 ` Fangrui Song [this message]
2023-05-25 1:26 ` Cary Coutant
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=CAFP8O3LU54AWctJgYC25XBvULnSJZDO_ZSd_kmT6mhTf8+Gpyg@mail.gmail.com \
--to=maskray@google.com \
--cc=amodra@gmail.com \
--cc=binutils@sourceware.org \
--cc=ccoutant@gmail.com \
--cc=jbeulich@suse.com \
--cc=nickc@redhat.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).