This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: about libelf by example


This mailing list is about elfutils and its implementation of libelf, not
others.  On Fedora systems, you get the elfutils libelf by default (with
the elfutils-devel package installed) and there is no reason to use a
different implementation.  But if you do, you have to ask its authors.

No libelf I've seen has an elf_setshstrndx function.  The only reason you'd
need a helper function is when the section number you need to set is
greater than 0xff00 so that you need to use SHN_XINDEX.  We don't have any
helper code in libelf for setting SHN_XINDEX data, only for reading it
(e.g. elf_getshstrndx, which has changed its preferred name to
elf_getshdrstrndx.)  It might indeed be useful to have some, but nobody has
felt the need enough to add such interfaces yet.

To set e_shstrndx, you just set it in the ehdr.  As with any such field,
the easiest way to do this correctly is with gelf_update_ehdr (after using
gelf_getehdr).


Thanks,
Roland

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]