[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 12:23:17 PDT 2022


jhuber6 marked 2 inline comments as done.
jhuber6 added a comment.

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.



================
Comment at: llvm/include/llvm/Object/ELF.h:75
+/// This function returns the hash value for a symbol in the .dynsym section
+/// Name of the API remains consistent as specified in the libelf
+/// REF : http://www.sco.com/developers/gabi/latest/ch5.dynamic.html#hash
----------------
MaskRay wrote:
> s/libelf/generic ABI/
I just moved this, but I can fix it while I'm here.


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