[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
Fri Aug 12 04:52:02 PDT 2022


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

In D131309#3718458 <https://reviews.llvm.org/D131309#3718458>, @jhenderson wrote:

> Oops, yes, I see. Not sure how I missed that.
>
> Could you clarify the use-case a bit more, please? The hash table is primarily for dynamic linking purposes, and consequently section headers aren't guaranteed to exist when doing this kind of lookup, with the dynamic tags like DT_HASH being used instead.

Offloading execution to an external accelerator is very similar to loading a shared library via `dlopen`. The images we execute on an external device are basically dynamic objects we load at runtime. When loading these images there are certain symbols and constants we emit inside the ELF that are used to control how the image itself is executed (how many blocks and threads to launch for example). This method is currently used to look up these known constants by-name so we can read with without first needing to load the whole image. This method is supposed to be faster than iterating the entire symbol table, checking each one.

Interesting point about `DT_HASH`. Would this just require an extra lookup from the dynamic table if we don't have section headers? I'm assuming they'd both point to the same symbol / string table, or .


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