llvm-project/openmp/libomptarget/plugins/common/elf_common
Joseph Huber 894531f59b [Libomptarget] Add utility functions for loading an ELF symbol by name
The `SHT_HASH` sections in an ELF are used to look up a symbol in the
symbol table using a symbol's name. This is done by obtaining the
`SHT_HASH` section and using its `sh_link` attribute to access the
associated symbol table, from which we can access the string table
containing the associated name. We can then search for the symbol using
the hash of the name and the buckets and chains in the hash table
itself

This patch adds utility functions that allow us to look up a symbol in
an ELF file by name. It will first attempt to look through the hash
tables, and then search the section tables manually if failed. This
allows us to pull out constants necessary for setting up offloading
without first loading the object.

Reviewed By: JonChesterfield

Differential Revision: https://reviews.llvm.org/D131309
2022-09-07 12:38:50 -05:00
..
CMakeLists.txt [Libomptarget] Add utility functions for loading an ELF symbol by name 2022-09-07 12:38:50 -05:00
ELFSymbols.cpp [Libomptarget] Add utility functions for loading an ELF symbol by name 2022-09-07 12:38:50 -05:00
ELFSymbols.h [Libomptarget] Add utility functions for loading an ELF symbol by name 2022-09-07 12:38:50 -05:00
elf_common.cpp [Libomptarget][NFC] Make Libomptarget use the LLVM naming convention 2022-07-05 14:53:38 -04:00
elf_common.h [Libomptarget][NFC] Make Libomptarget use the LLVM naming convention 2022-07-05 14:53:38 -04:00