* ELF's DT_ENCODING [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-25 1:26 ` Cary Coutant 0 siblings, 2 replies; 4+ messages in thread From: Jan Beulich @ 2023-05-22 6:57 UTC (permalink / raw) To: Binutils, Fangrui Song; +Cc: Nick Clifton, Alan Modra, Cary Coutant Commit a7fd11862703 bumped this to 38 without any justification. (By its name DT_SYMTAB_SHNDX might look to not match the scheme intended to be used above the boundary, looking more like a d_val kind of tag than a d_ptr one, but from its description it really is an address. Plus even that would only justify bumping to 35.) I think that part of the change wants reverting, unless an up-to-date spec [1] has moved the marker. Jan [1] In search for a new place where the gABI doc would live I found https://groups.google.com/g/generic-abi/c/9OO5vhxb00Y, but that doesn't indicate what github project, if any, would have been created. Hence for now I can only refer to the about 10 years old version on sco.com. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: ELF's DT_ENCODING 2023-05-22 6:57 ` ELF's DT_ENCODING Jan Beulich @ 2023-05-22 8:02 ` Alan Modra 2023-05-23 20:43 ` Fangrui Song 2023-05-25 1:26 ` Cary Coutant 1 sibling, 1 reply; 4+ messages in thread From: Alan Modra @ 2023-05-22 8:02 UTC (permalink / raw) To: Jan Beulich; +Cc: Binutils, Fangrui Song, Nick Clifton, Cary Coutant 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 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: ELF's DT_ENCODING 2023-05-22 8:02 ` Alan Modra @ 2023-05-23 20:43 ` Fangrui Song 0 siblings, 0 replies; 4+ messages in thread From: Fangrui Song @ 2023-05-23 20:43 UTC (permalink / raw) To: Alan Modra; +Cc: Jan Beulich, Binutils, Nick Clifton, Cary Coutant 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. -- 宋方睿 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: ELF's DT_ENCODING 2023-05-22 6:57 ` ELF's DT_ENCODING Jan Beulich 2023-05-22 8:02 ` Alan Modra @ 2023-05-25 1:26 ` Cary Coutant 1 sibling, 0 replies; 4+ messages in thread From: Cary Coutant @ 2023-05-25 1:26 UTC (permalink / raw) To: Jan Beulich; +Cc: Binutils, Fangrui Song, Nick Clifton, Alan Modra > [1] In search for a new place where the gABI doc would live I found > https://groups.google.com/g/generic-abi/c/9OO5vhxb00Y, but that doesn't > indicate what github project, if any, would have been created. Hence > for now I can only refer to the about 10 years old version on sco.com. There will be a new spec available soon (I hope). I've rewritten it in ReStructuredText and will host it on github. We're just waiting for Xinuos lawyers to approve licensing terms that will make it easier for people to copy and produce derivative versions. -cary ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-05-25 1:26 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <ff04d1a8-1adc-2da6-5ae5-7fd5ae3c5b72.ref@aol.com> 2023-05-22 6:57 ` ELF's DT_ENCODING Jan Beulich 2023-05-22 8:02 ` Alan Modra 2023-05-23 20:43 ` Fangrui Song 2023-05-25 1:26 ` Cary Coutant
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).