[PATCH] D131309: [ELF] Add ability to get a symbol by name from the hash table section

Joseph Huber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 18 14:53:36 PDT 2022


jhuber6 added a comment.

In D131309#3733474 <https://reviews.llvm.org/D131309#3733474>, @MaskRay wrote:

> In D131309#3733102 <https://reviews.llvm.org/D131309#3733102>, @jhuber6 wrote:
>
>> In D131309#3733081 <https://reviews.llvm.org/D131309#3733081>, @MaskRay wrote:
>>
>>> I added " (I have a SHT_GNU_HASH state summary for many ELF based OSes https://groups.google.com/g/generic-abi/c/9L03yrxXPBc/m/WKuUjZshAQAJ)" perhaps after you were composing the reply.
>>>
>>> SHT_GNU_HASH is quite universal now. At least all OS with serious LLVM support (except Solaris) support it, with some OSes for a long time (almost 10 years; and glibc for 16 years).
>>> SHT_HASH will probably just benefit Solaris and illumnos (I am not sure how the whole GPU stack works there.)
>>
>> I see, thanks for the information. It seems we have a `GnuHash` struct to represent the values in LLVM. Do we have the GNU hash function somewhere in the LLVM source? I don't see it used anywhere.
>>
>> As for this patch, I'd say since this patch is pretty much done and it meets our (LLVM offloading's) immediate needs we may as well support it. Then I can make a follow-up patch that adds the GNU hash support. Since it'll use most of the same logic it should be relatively easy to add-on to this patch.
>
> I am sorry that I made the comment so late. I am travelling and will have more limited bandwidth next week.
> I am quite sure the SHT_HASH will benefit nearly no user. If the SHT_HASH patch is created 3 years ago, it'd probably benefit some *BSD, but now, it probably doesn't add much value.
> I agree this patch is pretty much done with decent tests now. Perhaps this can be changed to use SHT_GNU_HASH instead? Quite a large portion of the code can be reused and you will not waste your effort :)
>
> https://flapenguin.me/elf-dt-gnu-hash has a great introduction of the format.

There's a patch in the stack view that's waiting on this one to land, so it meets the needs of that currently. I'm definitely on board with adding `SHT_GNU_HASH` support afterwards since it should be relatively simple given what's already here. Is there no utility in supporting both?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131309/new/

https://reviews.llvm.org/D131309



More information about the llvm-commits mailing list