[PATCH] D127246: [LinkerWrapper] Rework the linker wrapper and use owning binaries

Joseph Huber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 7 13:03:43 PDT 2022


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

The linker wrapper currently eagerly extracts all identified offloading
binaries to a file. This isn't ideal because we will soon open these
files again to examine their symbols for LTO and other things.
Additionally, we may not use every extracted file in the case of static
libraries. This would be very noisy in the case of static libraries that
may contain code for several targets not participating in the current
link.

Recent changes allow us to treat an Offloading binary as a standard
binary class. So that allows us to use an OwningBinary to model the
file. Now we keep it in memory and only write it once we know which
files will be participating in the final link job. This also reworks a
lot of the structure around how we handle this by removing the old
DeviceFile class.

The main benefit from this is that the following doesn't output 32+ files and
instead will only output a single temp file for the linked module.

  $ clang input.c -fopenmp --offload-arch=sm_70 -foffload-lto -save-temps


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D127246

Files:
  clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127246.434920.patch
Type: text/x-patch
Size: 38146 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220607/c8f71195/attachment-0001.bin>


More information about the cfe-commits mailing list