[all-commits] [llvm/llvm-project] 894531: [Libomptarget] Add utility functions for loading a...

Joseph Huber via All-commits all-commits at lists.llvm.org
Wed Sep 7 10:39:10 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 894531f59beb03c17a6e11e5b9c9995182b8d727
      https://github.com/llvm/llvm-project/commit/894531f59beb03c17a6e11e5b9c9995182b8d727
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2022-09-07 (Wed, 07 Sep 2022)

  Changed paths:
    M openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
    M openmp/libomptarget/plugins/common/elf_common/CMakeLists.txt
    A openmp/libomptarget/plugins/common/elf_common/ELFSymbols.cpp
    A openmp/libomptarget/plugins/common/elf_common/ELFSymbols.h

  Log Message:
  -----------
  [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


  Commit: 300155911a6d6060414919b8b3b5a43ac59d43d9
      https://github.com/llvm/llvm-project/commit/300155911a6d6060414919b8b3b5a43ac59d43d9
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2022-09-07 (Wed, 07 Sep 2022)

  Changed paths:
    M openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake
    M openmp/libomptarget/plugins/CMakeLists.txt
    M openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
    M openmp/libomptarget/plugins/amdgpu/impl/system.cpp
    M openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
    M openmp/libomptarget/plugins/cuda/CMakeLists.txt
    M openmp/libomptarget/plugins/generic-elf-64bit/src/rtl.cpp
    M openmp/libomptarget/plugins/ve/CMakeLists.txt

  Log Message:
  -----------
  [Libomptarget] Replace libelf with LLVM's Elf libraries

This patch replaces the dependency on `libelf` with LLVM's ELF support.
With this patch the user no-longer needs to have `libelf` on their
system to build and configure OpenMP offloading. The replacement is
mostly mechanical, with the exception of the hash table support which
was added in D131309.

Depends on D131309

Reviewed By: JonChesterfield, saiislam

Differential Revision: https://reviews.llvm.org/D131401


Compare: https://github.com/llvm/llvm-project/compare/8105f555af36...300155911a6d


More information about the All-commits mailing list