[all-commits] [llvm/llvm-project] 11f47b: [OpenMP] Make offloading sections have the SHF_EXC...

Joseph Huber via All-commits all-commits at lists.llvm.org
Thu Apr 14 07:51:12 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 11f47b791f96ca04b4cf9233d72febc704606dcf
      https://github.com/llvm/llvm-project/commit/11f47b791f96ca04b4cf9233d72febc704606dcf
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2022-04-14 (Thu, 14 Apr 2022)

  Changed paths:
    M llvm/include/llvm/MC/SectionKind.h
    M llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
    M llvm/test/CodeGen/X86/offload_sections.ll

  Log Message:
  -----------
  [OpenMP] Make offloading sections have the SHF_EXCLUDE flag

Offloading sections can be embedded in the host during codegen via a
section. This section was originally marked as metadata to prevent it
from being loaded, but these sections are completely unused at runtime
so the linker should automatically drop them from the final executable
or shard library. This flag adds support for the SHF_EXCLUDE flag in
target lowering and uses it.

Reviewed By: JonChesterfield, MaskRay

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


  Commit: e471ba3d0122d4c6601029d81c385cb6ebb9d7a4
      https://github.com/llvm/llvm-project/commit/e471ba3d0122d4c6601029d81c385cb6ebb9d7a4
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2022-04-14 (Thu, 14 Apr 2022)

  Changed paths:
    A llvm/include/llvm/Object/OffloadBinary.h
    M llvm/lib/Object/CMakeLists.txt
    A llvm/lib/Object/OffloadBinary.cpp
    M llvm/unittests/Object/CMakeLists.txt
    A llvm/unittests/Object/OffloadingTest.cpp

  Log Message:
  -----------
  [Object] Add binary format for bundling offloading metadata

We need to embed certain metadata along with a binary image when we wish
to perform a device-linking job on it. Currently this metadata was
embedded in the section name of the data itself. This worked, but made
adding new metadata very difficult and didn't work if the user did any
sort of section linking.

This patch introduces a custom binary format for bundling offloading
metadata with a device object file. This binary format is fundamentally
a simple string map table with some additional data and an embedded
image. I decided to use a custom format rather than using an existing
format (ELF, JSON, etc) because of the specialty use-case of this. We
need a simple binary format that can be concatenated without requiring
other external dependencies.

This extension will make it easier to extend the linker wrapper's
capabilties with whatever data is necessary. Eventually this will allow
us to remove all the external arguments passed to the linker wrapper and
embed it directly in the host's linker so device linking behaves exactly
like host linking.

Reviewed By: JonChesterfield

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


Compare: https://github.com/llvm/llvm-project/compare/ef141aec3c81...e471ba3d0122


More information about the All-commits mailing list