public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: Binutils <binutils@sourceware.org>,
	Fangrui Song <maskray@google.com>,
	Nick Clifton <nickc@redhat.com>,
	Cary Coutant <ccoutant@gmail.com>
Subject: Re: ELF's DT_ENCODING
Date: Mon, 22 May 2023 17:32:58 +0930	[thread overview]
Message-ID: <ZGshslEwk08sXN2/@squeak.grove.modra.org> (raw)
In-Reply-To: <8c5df1b6-8575-ad1b-668c-a34c8f7b60b8@suse.com>

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

  reply	other threads:[~2023-05-22  8:03 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 [this message]
2023-05-23 20:43     ` Fangrui Song
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=ZGshslEwk08sXN2/@squeak.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=ccoutant@gmail.com \
    --cc=jbeulich@suse.com \
    --cc=maskray@google.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).