[PATCH] D137470: [Offloading] Initial support for registering offloading entries on COFF targets

Joseph Huber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 4 15:50:08 PDT 2022


jhuber6 created this revision.
jhuber6 added reviewers: tra, jdoerfert, tianshilei1992, JonChesterfield, yaxunl, rnk.
Herald added a subscriber: hiraditya.
Herald added a project: All.
jhuber6 requested review of this revision.
Herald added subscribers: llvm-commits, cfe-commits, sstefan1.
Herald added projects: clang, LLVM.

The new driver registers all the offloading entries by first storing a
structure containing the necessary information into a special section
and then iterating the section at runtime. This is done in ELF targets
using the linker defined `__start` and `__stop` sections. However for
COFF targets these are not provided. This is instead done by generating
sections as described here <https://learn.microsoft.com/en-us/cpp/preprocessor/init-seg?redirectedfrom=MSDN&view=msvc-170>.

This patch adds the initial support required to offloadon COFF targets
by implementing this for the new driver. We use the `.<kind>$Ox` section
for COFF now.

NOTE: I have not tested the runtime functionality of patch as I do not
have a Windows machine set up yet.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D137470

Files:
  clang/lib/CodeGen/CGCUDANV.cpp
  clang/test/CodeGenCUDA/offloading-entries.cu
  clang/test/Driver/linker-wrapper-image.c
  clang/test/OpenMP/declare_target_link_codegen.cpp
  clang/tools/clang-linker-wrapper/OffloadWrapper.cpp
  llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
  llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137470.473355.patch
Type: text/x-patch
Size: 32465 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221104/b7598dea/attachment.bin>


More information about the llvm-commits mailing list