[llvm] [ELF] Correctly set the `nvptx` triple from `makeTriple()` (PR #76970)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 4 08:20:37 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-binary-utilities
Author: Joseph Huber (jhuber6)
<details>
<summary>Changes</summary>
Summary:
The ELFObject file should be able to handle `nvptx` objects be we
currently list them as unknown. This patch should now make it return
`nvptx64--` correctly.
---
Full diff: https://github.com/llvm/llvm-project/pull/76970.diff
1 Files Affected:
- (modified) llvm/include/llvm/Object/ELFObjectFile.h (+7)
``````````diff
diff --git a/llvm/include/llvm/Object/ELFObjectFile.h b/llvm/include/llvm/Object/ELFObjectFile.h
index 99477644de4de7..da78e11b678d99 100644
--- a/llvm/include/llvm/Object/ELFObjectFile.h
+++ b/llvm/include/llvm/Object/ELFObjectFile.h
@@ -1349,6 +1349,13 @@ template <class ELFT> Triple::ArchType ELFObjectFile<ELFT>::getArch() const {
return Triple::UnknownArch;
}
+ case ELF::EM_CUDA: {
+ if (EF.getHeader().e_ident[ELF::EI_CLASS] == ELF::ELFCLASS32)
+ return Triple::nvptx;
+ else
+ return Triple::nvptx64;
+ }
+
case ELF::EM_BPF:
return IsLittleEndian ? Triple::bpfel : Triple::bpfeb;
``````````
</details>
https://github.com/llvm/llvm-project/pull/76970
More information about the llvm-commits
mailing list