[HIP] Instruct lld to go through all archives
authorSiu Chi Chan <siuchi.chan@amd.com>
Tue, 6 Jun 2023 19:48:26 +0000 (15:48 -0400)
committerSiu Chi Chan <siuchi.chan@amd.com>
Fri, 9 Jun 2023 12:50:44 +0000 (08:50 -0400)
commitf1aee32f1c85aa476bce70ec110284011c6df354
tree357b8cd34f2225af4da4c065103df54fda456da8
parentcf6d7d5f6df9d9dcaeca78d5f4be735ea74651b0
[HIP] Instruct lld to go through all archives

Add the --whole-archive flag when linking HIP programs to instruct lld
to go through every archive library to link in all the kernel functions
(entry pointers to the GPU program); otherwise, lld may skip some
library files if there are no more symbols that need to be resolved.

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

Change-Id: I084d3d606f9cee646f9adc65f4b648c9bcb252e6
clang/lib/Driver/ToolChains/HIPAMD.cpp
clang/test/Driver/hip-toolchain-rdc-separate.hip
clang/test/Driver/hip-toolchain-rdc-static-lib.hip