The SHT_GNU_HASH section contains information used to identify symbols
using only their name. Previous support was added for the sys-V hash
table section. This patch expands this support to apply to the GNU hash
table as well. So now this function works with both hash table methods.
Implementation derived from description at
https://flapenguin.me/elf-dt-gnu-hash.
Depends on D132696
From a pure readability perspective, it might be worth breaking the two "modes" of this function (SHT_GNU_HASH vs SHT_HASH) into helper functions. This function is otherwise getting quite long and half of it is irrelevant to any given usage.