Skip to content

Commit ce7ab76

Browse files
committed
[Offloading] Extend OffloadBinary format to support multiple metadata entries
1 parent d9cf0db commit ce7ab76

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

llvm/include/llvm/Object/OffloadBinary.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class OffloadBinary : public Binary {
6767
using string_iterator_range = iterator_range<string_iterator>;
6868

6969
/// The current version of the binary used for backwards compatibility.
70-
static const uint32_t Version = 1;
70+
static const uint32_t Version = 2;
7171

7272
/// The offloading metadata that will be serialized to a memory buffer.
7373
struct OffloadingImage {
@@ -109,9 +109,12 @@ class OffloadBinary : public Binary {
109109
struct Header {
110110
uint8_t Magic[4] = {0x10, 0xFF, 0x10, 0xAD}; // 0x10FF10AD magic bytes.
111111
uint32_t Version = OffloadBinary::Version; // Version identifier.
112-
uint64_t Size; // Size in bytes of this entire binary.
113-
uint64_t EntryOffset; // Offset of the metadata entry in bytes.
114-
uint64_t EntrySize; // Size of the metadata entry in bytes.
112+
uint64_t Size; // Size in bytes of this entire binary.
113+
uint64_t EntriesCount; // Number of metadata entries in the binary.
114+
uint64_t EntriesOffset; // Offset in bytes to the start of entries block.
115+
uint64_t EntriesSize; // Size of the entries block in bytes.
116+
uint64_t StringOffset; // Offset in bytes to the global string map
117+
uint64_t NumStrings; // Number of entries in the global string map.
115118
};
116119

117120
struct Entry {
@@ -127,6 +130,7 @@ class OffloadBinary : public Binary {
127130
struct StringEntry {
128131
uint64_t KeyOffset;
129132
uint64_t ValueOffset;
133+
uint64_t ValueSize; // Size of the value in bytes.
130134
};
131135

132136
private:

0 commit comments

Comments
 (0)