aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/Binary.cpp
diff options
context:
space:
mode:
authorJoseph Huber <jhuber6@vols.utk.edu>2022-06-01 15:28:34 -0400
committerJoseph Huber <jhuber6@vols.utk.edu>2022-06-01 18:40:57 -0400
commitafd2f7e9919737e30f9fae2d3cff892189301a55 (patch)
tree9f61b77fde3875f7e32a04ca52e622c9ff97744e /llvm/lib/Object/Binary.cpp
parent909a78b3a430f99518a04ae0bced8f0b9ba6e02a (diff)
downloadllvm-afd2f7e9919737e30f9fae2d3cff892189301a55.zip
llvm-afd2f7e9919737e30f9fae2d3cff892189301a55.tar.gz
llvm-afd2f7e9919737e30f9fae2d3cff892189301a55.tar.bz2
[Binary] Promote OffloadBinary to inherit from Binary
We use the `OffloadBinary` to create binary images of offloading files and their corresonding metadata. This patch changes this to inherit from the base `Binary` class. This allows us to create and insepect these more generically. This patch includes all the necessary glue to implement this as a new binary format, along with added the magic bytes we use to distinguish the offloading binary to the `file_magic` implementation. Reviewed By: tra Differential Revision: https://reviews.llvm.org/D126812
Diffstat (limited to 'llvm/lib/Object/Binary.cpp')
-rw-r--r--llvm/lib/Object/Binary.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Object/Binary.cpp b/llvm/lib/Object/Binary.cpp
index 1703f76..8065e3e 100644
--- a/llvm/lib/Object/Binary.cpp
+++ b/llvm/lib/Object/Binary.cpp
@@ -18,6 +18,7 @@
#include "llvm/Object/MachOUniversal.h"
#include "llvm/Object/Minidump.h"
#include "llvm/Object/ObjectFile.h"
+#include "llvm/Object/OffloadBinary.h"
#include "llvm/Object/TapiUniversal.h"
#include "llvm/Object/WindowsResource.h"
#include "llvm/Support/Error.h"
@@ -87,6 +88,8 @@ Expected<std::unique_ptr<Binary>> object::createBinary(MemoryBufferRef Buffer,
case file_magic::dxcontainer_object:
// Unrecognized object file format.
return errorCodeToError(object_error::invalid_file_type);
+ case file_magic::offload_binary:
+ return OffloadBinary::create(Buffer);
case file_magic::minidump:
return MinidumpFile::create(Buffer);
case file_magic::tapi_file: