[ELF] Provide the GNU hash function in libObject
authorJoseph Huber <jhuber6@vols.utk.edu>
Thu, 25 Aug 2022 19:00:07 +0000 (14:00 -0500)
committerJoseph Huber <jhuber6@vols.utk.edu>
Mon, 5 Sep 2022 16:04:57 +0000 (11:04 -0500)
commitc1d19a8489466270bb1c3639dcdabbda1d4c57d7
tree5b48da304d900715ce9c7f32e45f841ee8e46155
parent456c7ef68e13b9dedd12a2333e01b6fdbc534b0a
[ELF] Provide the GNU hash function in libObject

GNU uses a different hashing function compared to the sys-V standard
function already provided in libObject. This is already used internally
in LLD for generating synthetic sections. This patch simply extracts
this definition and makes it availible to other users of `libObject`.
This is done in preparation for supporting symbol name lookups via the
GNU hash table.

Reviewed By: MaskRay, jhenderson

Differential Revision: https://reviews.llvm.org/D132696
lld/ELF/SyntheticSections.cpp
llvm/include/llvm/Object/ELF.h