[all-commits] [llvm/llvm-project] 958a88: [LinkerWrapper] Rework the linker wrapper and use ...

Joseph Huber via All-commits all-commits at lists.llvm.org
Wed Jun 22 06:24:49 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 958a8850508088766fe19202037e2f46805e2c65
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2022-06-22 (Wed, 22 Jun 2022)

  Changed paths:
    M clang/test/Driver/linker-wrapper.c
    M clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp

  Log Message:
  [LinkerWrapper] Rework the linker wrapper and use owning binaries

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

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

Reviewed By: JonChesterfield

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

More information about the All-commits mailing list