[PATCH] D120932: [CUDA] Add CUDA fatbinary magic
Joseph Huber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 14 17:09:28 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG24ebdb6c255e: [CUDA] Add CUDA fatbinary magic (authored by jhuber6).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D120932/new/
https://reviews.llvm.org/D120932
Files:
llvm/include/llvm/BinaryFormat/Magic.h
llvm/lib/BinaryFormat/Magic.cpp
llvm/lib/Object/Binary.cpp
llvm/lib/Object/ObjectFile.cpp
Index: llvm/lib/Object/ObjectFile.cpp
===================================================================
--- llvm/lib/Object/ObjectFile.cpp
+++ llvm/lib/Object/ObjectFile.cpp
@@ -146,6 +146,7 @@
case file_magic::pdb:
case file_magic::minidump:
case file_magic::goff_object:
+ case file_magic::cuda_fatbinary:
return errorCodeToError(object_error::invalid_file_type);
case file_magic::tapi_file:
return errorCodeToError(object_error::invalid_file_type);
Index: llvm/lib/Object/Binary.cpp
===================================================================
--- llvm/lib/Object/Binary.cpp
+++ llvm/lib/Object/Binary.cpp
@@ -82,6 +82,7 @@
// PDB does not support the Binary interface.
return errorCodeToError(object_error::invalid_file_type);
case file_magic::unknown:
+ case file_magic::cuda_fatbinary:
case file_magic::coff_cl_gl_object:
// Unrecognized object file format.
return errorCodeToError(object_error::invalid_file_type);
Index: llvm/lib/BinaryFormat/Magic.cpp
===================================================================
--- llvm/lib/BinaryFormat/Magic.cpp
+++ llvm/lib/BinaryFormat/Magic.cpp
@@ -185,6 +185,10 @@
case 0x84: // Alpha 64-bit
case 0x66: // MPS R4000 Windows
case 0x50: // mc68K
+ if (startswith(Magic, "\x50\xed\x55\xba"))
+ return file_magic::cuda_fatbinary;
+ LLVM_FALLTHROUGH;
+
case 0x4c: // 80386 Windows
case 0xc4: // ARMNT Windows
if (Magic[1] == 0x01)
Index: llvm/include/llvm/BinaryFormat/Magic.h
===================================================================
--- llvm/include/llvm/BinaryFormat/Magic.h
+++ llvm/include/llvm/BinaryFormat/Magic.h
@@ -51,6 +51,7 @@
wasm_object, ///< WebAssembly Object file
pdb, ///< Windows PDB debug info file
tapi_file, ///< Text-based Dynamic Library Stub file
+ cuda_fatbinary, ///< CUDA Fatbinary object file
};
bool is_object() const { return V != unknown; }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120932.415280.patch
Type: text/x-patch
Size: 1990 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220315/31352f78/attachment.bin>
More information about the llvm-commits
mailing list