[PATCH] D129581: [Clang] Rework LTO argument handling in the linker wrapper

Joseph Huber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 12 11:59:47 PDT 2022


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

The `clang-linker-wrapper` is responsible for performing embedded
linking jobs for the offloading device. In the linker wrapper we need to
implement our own handling of LTO to account for the diverse landscape
of linkers and assemblers for accelerators. However, we end up
duplication a lot of functionality. This patch changes the argument
generation for the device to match the arguments we use for host LTO.
This will make it much easier to add extra arguments.

One thing to be careful of however, is that not all linkers will not
accept `-plugin-opt` arguments if there is not a corresonding `-plugin`.
In order to combat this we need to make sure that all `-plugin-opt`
arguments indented for the device's LTO are not propagated to the host
linking job if we are using a linker that does not support it.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D129581

Files:
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/lib/Driver/ToolChains/CommonArgs.h
  clang/test/Driver/linker-wrapper.c
  clang/test/Driver/openmp-offload-gpu-new.c
  clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
  clang/tools/clang-linker-wrapper/LinkerWrapperOpts.td

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129581.444037.patch
Type: text/x-patch
Size: 12622 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220712/c2180d78/attachment-0001.bin>


More information about the cfe-commits mailing list