[PATCH] D65117: [llvm-Object] Added public MaxSectionAlignment to MachOUniversal

Shoaib Meenai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 24 17:29:47 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL366969: [Object] Add public MaxSectionAlignment to MachOUniversal (authored by smeenai, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D65117?vs=211197&id=211645#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65117/new/

https://reviews.llvm.org/D65117

Files:
  llvm/trunk/include/llvm/Object/MachOUniversal.h
  llvm/trunk/lib/Object/MachOUniversal.cpp


Index: llvm/trunk/lib/Object/MachOUniversal.cpp
===================================================================
--- llvm/trunk/lib/Object/MachOUniversal.cpp
+++ llvm/trunk/lib/Object/MachOUniversal.cpp
@@ -155,12 +155,13 @@
         ") extends past the end of the file");
       return;
     }
-#define MAXSECTALIGN 15 /* 2**15 or 0x8000 */
-    if (A.getAlign() > MAXSECTALIGN) {
-      Err = malformedError("align (2^" + Twine(A.getAlign()) + ") too large "
-        "for cputype (" + Twine(A.getCPUType()) + ") cpusubtype (" +
-        Twine(A.getCPUSubType() & ~MachO::CPU_SUBTYPE_MASK) +
-        ") (maximum 2^" + Twine(MAXSECTALIGN) + ")");
+
+    if (A.getAlign() > MaxSectionAlignment) {
+      Err = malformedError("align (2^" + Twine(A.getAlign()) +
+                           ") too large for cputype (" + Twine(A.getCPUType()) +
+                           ") cpusubtype (" +
+                           Twine(A.getCPUSubType() & ~MachO::CPU_SUBTYPE_MASK) +
+                           ") (maximum 2^" + Twine(MaxSectionAlignment) + ")");
       return;
     }
     if(A.getOffset() % (1 << A.getAlign()) != 0){
Index: llvm/trunk/include/llvm/Object/MachOUniversal.h
===================================================================
--- llvm/trunk/include/llvm/Object/MachOUniversal.h
+++ llvm/trunk/include/llvm/Object/MachOUniversal.h
@@ -31,6 +31,8 @@
   uint32_t Magic;
   uint32_t NumberOfObjects;
 public:
+  static constexpr uint32_t MaxSectionAlignment = 15; /* 2**15 or 0x8000 */
+
   class ObjectForArch {
     const MachOUniversalBinary *Parent;
     /// Index of object in the universal binary.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65117.211645.patch
Type: text/x-patch
Size: 1627 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190725/9b301fd1/attachment.bin>


More information about the llvm-commits mailing list