[OpenMP] Unconditionally link the OpenMP device RTL static library
authorJoseph Huber <jhuber6@vols.utk.edu>
Tue, 24 Jan 2023 17:18:22 +0000 (11:18 -0600)
committerJoseph Huber <jhuber6@vols.utk.edu>
Tue, 24 Jan 2023 23:01:35 +0000 (17:01 -0600)
commitdc60f7aa0435a4e4778cfbf22f4fcb52c97427c0
treee8672afef6d065bd5bc857b1e07bf40e3fc2b52f
parent1964c334782e7c5961772fbdcdcc0029cba3a7fa
[OpenMP] Unconditionally link the OpenMP device RTL static library

Currently we have two versions of the static library. One is built as
individual bitcode files and linked via `-mlink-builtin-bitcode`. The
other is built as a single static archive `omptarget.devicertl.a` and is
linked via `-lomptarget.devicertl` and handled by the linker wrapper
during LTO. We use the former in the case that we are not performing
LTO, because linking the library late wouldn't allow us to optimize the
runtime library effectively. The support in D142484 allows us to
unconditionally link this library, so it will only be pulled in if
needed. That is, if we linked already via `-mlink-builtin-bitcode` then
we will not pull in the static library even if it's linked on the
command line.

Depends on D142484

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D142486
clang/lib/Driver/ToolChains/CommonArgs.cpp
clang/test/Driver/openmp-offload-gpu.c