1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
From: Cordell Bloor <cgmb@debian.org>
Date: Mon, 4 Aug 2025 20:43:03 -0600
Subject: upstream llvm compatibility
- The CompressedOffloadBundle::V3HeaderSize field has been removed
from upstream LLVM 21.
- The Header is unsigned char* and requires an explicit cast to
const char*.
---
amd/comgr/src/comgr-cache-bundler-command.cpp | 27 +++++++++++++++++++++++++--
2 files changed, 25 insertions(+), 3 deletions(-)
--- a/amd/comgr/src/comgr-cache-bundler-command.cpp
+++ b/amd/comgr/src/comgr-cache-bundler-command.cpp
@@ -152,10 +152,33 @@
}
}
+namespace DebianCompressedOffloadBundleExt {
+ static inline const size_t MagicSize = 4;
+ static inline const size_t VersionFieldSize = sizeof(uint16_t);
+ static inline const size_t MethodFieldSize = sizeof(uint16_t);
+ static inline const size_t FileSizeFieldSizeV2 = sizeof(uint32_t);
+ static inline const size_t UncompressedSizeFieldSizeV2 = sizeof(uint32_t);
+ static inline const size_t FileSizeFieldSizeV3 = sizeof(uint64_t);
+ static inline const size_t UncompressedSizeFieldSizeV3 = sizeof(uint64_t);
+ static inline const size_t HashFieldSize = sizeof(uint64_t);
+
+ static inline const size_t V1HeaderSize =
+ MagicSize + VersionFieldSize + MethodFieldSize +
+ UncompressedSizeFieldSizeV2 + HashFieldSize;
+
+ static inline const size_t V2HeaderSize =
+ MagicSize + VersionFieldSize + FileSizeFieldSizeV2 + MethodFieldSize +
+ UncompressedSizeFieldSizeV2 + HashFieldSize;
+
+ static inline const size_t V3HeaderSize =
+ MagicSize + VersionFieldSize + FileSizeFieldSizeV3 + MethodFieldSize +
+ UncompressedSizeFieldSizeV3 + HashFieldSize;
+}
+
Error UnbundleCommand::addInputIdentifier(HashAlgorithm &H) const {
StringRef InputFilename = Config.InputFileNames.front();
- constexpr size_t LargestHeaderSize = CompressedOffloadBundle::V3HeaderSize;
+ const size_t LargestHeaderSize = DebianCompressedOffloadBundleExt::V3HeaderSize;
ErrorOr<std::unique_ptr<MemoryBuffer>> MaybeInputBuffer =
MemoryBuffer::getFileSlice(InputFilename, LargestHeaderSize, 0);
@@ -174,7 +197,7 @@
// only hash the input file, not the whole header. Colissions are unlikely
// since the header includes a hash (weak) of the contents
- H.update(Header);
+ H.update(reinterpret_cast<const char*>(Header));
return Error::success();
}
|