[PATCH] D122069: [Clang] Add binary format for bundling offloading metadata

Joseph Huber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 19 08:20:55 PDT 2022


jhuber6 created this revision.
jhuber6 added reviewers: jdoerfert, JonChesterfield.
Herald added subscribers: ormris, dexonsmith, hiraditya, mgorny.
Herald added a project: All.
jhuber6 requested review of this revision.
Herald added subscribers: llvm-commits, cfe-commits, sstefan1.
Herald added projects: clang, LLVM.

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 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.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D122069

Files:
  clang/include/clang/Basic/CodeGenOptions.h
  clang/include/clang/Basic/Offloading.h
  clang/lib/Basic/CMakeLists.txt
  clang/lib/Basic/Offloading.cpp
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/openmp-offload-gpu.c
  clang/test/Frontend/embed-object.c
  clang/test/Frontend/embed-object.ll
  clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
  llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
  llvm/lib/Transforms/Utils/ModuleUtils.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122069.416702.patch
Type: text/x-patch
Size: 27485 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220319/df1810cb/attachment.bin>


More information about the llvm-commits mailing list