When the --elf-hash-histogram is used, the code first tries to build
a histogram for the .hash table and then for the .gnu.hash table.
The problem is that dumper might return early when unable or do not need to
build a histogram for the .hash.
This patch reorders the code slightly to fix the issue and adds a test case.
Did you consider the following?
It saves having to include two separate checks for the same thing.