This is a basic implementation that allows lld to emit binaries consumable
by the HSA runtime.
Details
Diff Detail
Event Timeline
As to me I would add more tests. For example, check ELF file header fields,
lib/ReaderWriter/ELF/AMDGPU/AMDGPUHSA.h | ||
---|---|---|
16 ↗ | (On Diff #29912) | I think it is better to move all these declarations to llvm\Support\ELF.h. In that case you can support these flags in the llvm-readobj tool. |
lib/ReaderWriter/ELF/AMDGPU/AMDGPULinkingContext.cpp | ||
26 | Run the clang-format on this line. | |
37 | Do you really need this empty function? | |
lib/ReaderWriter/ELF/AMDGPU/AMDGPUSymbolTable.cpp | ||
23 | Run the clang-format on this line. | |
lib/ReaderWriter/ELF/AMDGPU/AMDGPUTargetHandler.cpp | ||
73 | Do you need this commented code? | |
78 | Redundant empty line. | |
84 | Redundant empty line. | |
lib/ReaderWriter/ELF/AMDGPU/AMDGPUTargetHandler.h | ||
36 | Please remove the commented code. |
Here is an updated patch with the following changes:
- Ran clang-format on all new files.
- Merged http://reviews.llvm.org/D11265 into this patch.
- Moved AMDGPU ELF definitions into Support/ELF.h.
- Added more checks in the testcase.
I added some notes and included Rui Ueyama to the reviewers list.
lib/ReaderWriter/ELF/AMDGPU/AMDGPUExecutableWriter.cpp | ||
---|---|---|
18–33 | These methods do nothing now. I suggest to remove them from this commit and add later if necessary. | |
lib/ReaderWriter/ELF/AMDGPU/AMDGPULinkingContext.h | ||
23 | Usually we put constructors in the beginning of the class declarations. Other methods go after that. | |
31 | Do you really need this function declaration? Below in the AMDGPULinkingContext.cpp you define void setAMDGPUELFHeader(ELFHeader<ELF64LE> &elfHeader) only. |
lib/ReaderWriter/ELF/AMDGPU/AMDGPUELFFile.cpp | ||
---|---|---|
14–22 | Can you add llvm::ELF::SHT_NOTE to ELFFile::handleSectionWithNoSymbols and remove this function? I'm not 100% sure but I believe doing that is not harmful to other ports. | |
lib/ReaderWriter/ELF/AMDGPU/AMDGPUTargetHandler.cpp | ||
55 | Use real type instead of auto as the type is not obvious. | |
56 | Ditto | |
lib/ReaderWriter/ELF/AMDGPU/AMDGPUTargetHandler.h | ||
39 | Remove this empty line. | |
43–45 | You may want to move these lines above if (name == ".note") because this statement does not use contentType and returns immediately. |
lib/ReaderWriter/ELF/AMDGPU/AMDGPUExecutableWriter.cpp | ||
---|---|---|
18–33 | These functions are actually calling the implementation of the parent class's parent instead of the parent's. This is done to avoid having c runtime symbols added to the binary. |
LGTM, but please wait for Simon's LGTM.
lib/ReaderWriter/ELF/AMDGPU/AMDGPUTargetHandler.cpp | ||
---|---|---|
41 | Remove this "using". |
Can you add llvm::ELF::SHT_NOTE to ELFFile::handleSectionWithNoSymbols and remove this function? I'm not 100% sure but I believe doing that is not harmful to other ports.