[llvm] bc33c2f - [Binary] Hard-code the alignment of the offloading binary

Joseph Huber via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 21 06:29:09 PDT 2022


Author: Joseph Huber
Date: 2022-07-21T09:28:26-04:00
New Revision: bc33c2fa0c2a68a0431df0d825cc6df99a1883db

URL: https://github.com/llvm/llvm-project/commit/bc33c2fa0c2a68a0431df0d825cc6df99a1883db
DIFF: https://github.com/llvm/llvm-project/commit/bc33c2fa0c2a68a0431df0d825cc6df99a1883db.diff

LOG: [Binary] Hard-code the alignment of the offloading binary

Summary:
We previously used `alignof` to get the necessary alignment of the
binary header. However this was different on 32-bit platforms and caused
a few tests to fail because of it. This patch just changes this to be a
hard-coded constant of 8.

Added: 
    

Modified: 
    llvm/include/llvm/Object/OffloadBinary.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Object/OffloadBinary.h b/llvm/include/llvm/Object/OffloadBinary.h
index 311e21f1e338..4bff91c4c930 100644
--- a/llvm/include/llvm/Object/OffloadBinary.h
+++ b/llvm/include/llvm/Object/OffloadBinary.h
@@ -80,7 +80,7 @@ class OffloadBinary : public Binary {
   /// Serialize the contents of \p File to a binary buffer to be read later.
   static std::unique_ptr<MemoryBuffer> write(const OffloadingImage &);
 
-  static uint64_t getAlignment() { return alignof(Header); }
+  static uint64_t getAlignment() { return 8; }
 
   ImageKind getImageKind() const { return TheEntry->TheImageKind; }
   OffloadKind getOffloadKind() const { return TheEntry->TheOffloadKind; }


        


More information about the llvm-commits mailing list