[PATCH] D138221: [HIP] Fix lld failure when devie object is empty

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 21 07:05:11 PST 2022


yaxunl marked an inline comment as done.
yaxunl added a comment.

In D138221#3939384 <https://reviews.llvm.org/D138221#3939384>, @MaskRay wrote:

>> Some host relocatable objects may not contain device relocatable objects, where an empty file is passed to lld, which causes lld to fail.
>
> How is an empty file (size=0) passed to lld? If a dummy relocatable object file is parsed to lld, lld can infer the machine type from `e_machine` in the ELF header.
> How does it work in other cases? Because a non-empty relocatable object file is used?
>
> I do not object to a new emulation which does not exist in GNU ld, but the description needs to be clarified.

Updated description. The empty file is generated by clang-offload-bundler, which does not know how to create a dummy relocatable object file for a device target.



================
Comment at: lld/ELF/Driver.cpp:179
           .Case("msp430elf", {ELF32LEKind, EM_MSP430})
+          .Case("elf64_amdgpu", {ELF64LEKind, EM_AMDGPU})
           .Default({ELFNoneKind, EM_NONE});
----------------
MaskRay wrote:
> This needs an `emulation-amdgpu.s` test.
added


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138221/new/

https://reviews.llvm.org/D138221



More information about the cfe-commits mailing list