[Openmp-commits] [PATCH] D124525: [OpenMP][ClangLinkerWrapper] Extending linker wrapper to embed metadata for multi-arch fat binaries

Saiyedul Islam via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed Apr 27 06:07:35 PDT 2022


saiislam created this revision.
saiislam added reviewers: jdoerfert, JonChesterfield, jhuber6, yaxunl.
Herald added a subscriber: guansong.
Herald added a project: All.
saiislam requested review of this revision.
Herald added subscribers: openmp-commits, cfe-commits, sstefan1.
Herald added projects: clang, OpenMP.

This patch adds "__tgt_image_info" field for each of the images
embedded in a multi-arch image. Required changes in libomptarget
are also shown.

The information in "__tgt_image_info" struct is provided in the clang-linker-wrapper
as a call to __tgt_register_image_info for each image in the library
of images also created by the clang-linker-wrapper.
__tgt_register_image_info is called for each image BEFORE the single
call to __tgt_register_lib so that image information is available
before they are loaded. clang-linker-wrapper gets this image information
from command line arguments provided by the clang driver when it creates
the call to the __clang-linker-wrapper command.
This architecture allows the binary image (pointed to by ImageStart and
ImageEnd in __tgt_device_image) to remain architecture indenendent.
That is, the architecture independent part of the libomptarget runtime
does not need to peer inside the image to determine if it is loadable
even though in most cases the image is an elf object.
There is one __tgt_image_info for each __tgt_device_image. For backward
compabibility, no changes are allowed to either __tgt_device_image or
__tgt_bin_desc. The absense of __tgt_image_info is the indication that
the runtime is being used on a binary created by an old version of
the compiler.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D124525

Files:
  clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
  clang/tools/clang-linker-wrapper/OffloadWrapper.cpp
  clang/tools/clang-linker-wrapper/OffloadWrapper.h
  openmp/libomptarget/include/omptarget.h
  openmp/libomptarget/src/exports
  openmp/libomptarget/src/interface.cpp
  openmp/libomptarget/src/rtl.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124525.425502.patch
Type: text/x-patch
Size: 21591 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20220427/6c2f73ad/attachment-0001.bin>


More information about the Openmp-commits mailing list