[HIP] Fix lld failure when devie object is empty
When -fgpu-rdc is used for linking relocatable objects, clang driver launches clang-offload-bundler to extract a device relocatable object from each input relocatable object file and passes the extracted files to lld. The input relocatable object file could either come from HIP program or C++ program. The relocatable object file from C++ program does not contain device relocatable objects, therefore clang-offload-bundler extracts an empty file and passes it to lld. lld treates empty file as linker script. When there is no object input file to lld, lld will emit error: target emulation unknown: -m or at least one .o file required This patch adds "elf64_amdgpu" to lld so that lld always know the target no matter whether there are object input files or not. Reviewed by: Artem Belevich, Fangrui Song Differential Revision: https://reviews.llvm.org/D138221
Loading
Please sign in to comment