[all-commits] [llvm/llvm-project] edc838: [LLVM] Add file magic detection for SPIR-V files. ...
Joseph Huber via All-commits
all-commits at lists.llvm.org
Wed Dec 13 18:40:04 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: edc83886d479e110c87d104e7241ce67ee1b6316
https://github.com/llvm/llvm-project/commit/edc83886d479e110c87d104e7241ce67ee1b6316
Author: Joseph Huber <huberjn at outlook.com>
Date: 2023-12-13 (Wed, 13 Dec 2023)
Changed paths:
M llvm/include/llvm/BinaryFormat/Magic.h
M llvm/lib/BinaryFormat/Magic.cpp
M llvm/lib/Object/Binary.cpp
M llvm/lib/Object/ObjectFile.cpp
M llvm/unittests/BinaryFormat/TestFileMagic.cpp
Log Message:
-----------
[LLVM] Add file magic detection for SPIR-V files. (#75363)
Summary:
More SPIR-V related patches are being upstreamed. We should add support
to detect when a binary file is SPIR-V. This will be used in the future
when support for SPIR-V is added to the offloading runtime or more
support for bundling.
The magic number is described in the official documentation:
https://registry.khronos.org/SPIR-V/specs/1.0/SPIRV.html#Magic. Notably,
SPIR-V files are streams of 32-bit words. This means that the magic
numbers differ depending on the endianness. Here we simply check the
strandard and byte-reversed versions.
More information about the All-commits
mailing list