On Thu, Aug 24, 2023 at 09:51:54PM +0200, Mark Wielaard wrote:
> Hi Omar,
>
> On Thu, Aug 24, 2023 at 12:40:19PM -0700, Omar Sandoval wrote:
> > On Thu, Aug 24, 2023 at 12:02:11AM +0200, Mark Wielaard wrote:
> > >
> > > * libelf/gelf.h (Gelf_Relr): New typedef for Elf64_Relr.
> > >
> > > +/* Relative relocation entry (in section of type SHT_RELR). */
> > > +typedef Elf64_Relr Gelf_Relr;
> >
> > Should this be GElf_Relr (with an uppercase E in GElf like the other
> > typedefs)?
>
> Oops. Yes, it should. Thanks for spotting that.
One more thing, if someone installs a newer elfutils with this change
but their glibc is older and doesn't define Elf64_Relr (which was
apparently added in glibc 2.36), then gelf.h will be unusable:
/usr/include/gelf.h:86:9: error: unknown type name 'Elf64_Relr'
86 | typedef Elf64_Relr Gelf_Relr;
| ^~~~~~~~~~
(A Koji build of drgn for Fedora 40 ran into this:
https://koji.fedoraproject.org/koji/taskinfo?taskID=105242437, except
that in my case it's because I was vendoring an old version of elf.h. I
fixed it by not vendoring elf.h anymore:
https://github.com/osandov/drgn/commit/3d07cb1682045a4ac90e1977bcbd5b4864911e32,
but this same issue can come up in more legitimate situations like the
one I mentioned.)
Maybe this can be wrapped in an #ifdef DT_RELR or something like that?