[all-commits] [llvm/llvm-project] 056eba: [HIP] Fix lld failure when devie object is empty
Yaxun (Sam) Liu via All-commits
all-commits at lists.llvm.org
Tue Nov 22 07:39:23 PST 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 056ebadf5c75df6568ea3dda879518e1edc1f48f
https://github.com/llvm/llvm-project/commit/056ebadf5c75df6568ea3dda879518e1edc1f48f
Author: Yaxun (Sam) Liu <yaxun.liu at amd.com>
Date: 2022-11-22 (Tue, 22 Nov 2022)
Changed paths:
M clang/lib/Driver/ToolChains/HIPAMD.cpp
M clang/test/Driver/hip-toolchain-device-only.hip
M clang/test/Driver/hip-toolchain-no-rdc.hip
M lld/ELF/Driver.cpp
A lld/test/ELF/emulation-amdgpu.s
Log Message:
-----------
[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
More information about the All-commits
mailing list