]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
libelf: Use a red-black tree to manage the section list.
authormarkj <markj@FreeBSD.org>
Tue, 4 Jun 2019 18:26:29 +0000 (18:26 +0000)
committermarkj <markj@FreeBSD.org>
Tue, 4 Jun 2019 18:26:29 +0000 (18:26 +0000)
commitfec6f9966a8e0e66196ba4be1dfd78a0a9bdca0d
treecb195765ddb3664f04d79accf5f13e7e1c28cf70
parent8cf2829845e2b08ee791c93dfa258da88134d598
libelf: Use a red-black tree to manage the section list.

The tree is indexed by section number.  This speeds up elf_getscn()
and its callers, which previously had to traverse a linked list. In
particular, since .shstrtab is often the last section in a file,
elf_strptr() would have to traverse the entire list.

PR: 234949
Reviewed by: emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20443
contrib/elftoolchain/libelf/_libelf.h
contrib/elftoolchain/libelf/elf_end.c
contrib/elftoolchain/libelf/elf_scn.c
contrib/elftoolchain/libelf/elf_update.c
contrib/elftoolchain/libelf/libelf_allocate.c
contrib/elftoolchain/libelf/libelf_ehdr.c
contrib/elftoolchain/libelf/libelf_extended.c