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

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 18 12:35:13 PDT 2022


MaskRay added a comment.

In D131309#3733059 <https://reviews.llvm.org/D131309#3733059>, @jhuber6 wrote:

> In D131309#3733045 <https://reviews.llvm.org/D131309#3733045>, @MaskRay wrote:
>
>> Many Linux distributions (clang/lib/Driver/ToolChains/Linux.cpp:240; they typically patch their system GCC to do the same thing) use the linker option `--hash-style=gnu`, so most of their executabls/shared objects do not have SHT_HASH/DT_HASH. You may need to add SHT_GNU_HASH/DT_GNU_HASH support.
>
> Right now we use this for the offloading runtime library and the generated objects use `SHT_HASH` so it's sufficient for our purposes. Do we currently do anything with `SHT_GNU_HASH`? My understanding is that `SHT_HASH` is standard while `SHT_GNU_HASH` isn't officially documented so we would need to import some GNU code verbatim to LLVM, but I'm hardly an expert.

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) supports 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.)


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