Skip to content

Commit c12a9fc

Browse files
authored
[ELF] Correctly set the nvptx triple from makeTriple() (#76970)
Summary: The ELFObject file should be able to handle `nvptx` objects but we currently list them as unknown. This patch should now make it return `nvptx64--` correctly.
1 parent 917b404 commit c12a9fc

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

llvm/include/llvm/Object/ELFObjectFile.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,6 +1349,13 @@ template <class ELFT> Triple::ArchType ELFObjectFile<ELFT>::getArch() const {
13491349
return Triple::UnknownArch;
13501350
}
13511351

1352+
case ELF::EM_CUDA: {
1353+
if (EF.getHeader().e_ident[ELF::EI_CLASS] == ELF::ELFCLASS32)
1354+
return Triple::nvptx;
1355+
else
1356+
return Triple::nvptx64;
1357+
}
1358+
13521359
case ELF::EM_BPF:
13531360
return IsLittleEndian ? Triple::bpfel : Triple::bpfeb;
13541361

0 commit comments

Comments
 (0)