diff options
author | Shoaib Meenai <smeenai@fb.com> | 2019-07-25 00:29:13 +0000 |
---|---|---|
committer | Shoaib Meenai <smeenai@fb.com> | 2019-07-25 00:29:13 +0000 |
commit | a67f6f17467fcb4703b857cd0f467530e373d06c (patch) | |
tree | b018d97615b7e87be196bd4bc68e77b3ba5e49bc /llvm | |
parent | 7418b10b165236d581303e568ad17a7d00937943 (diff) | |
download | bcm5719-llvm-a67f6f17467fcb4703b857cd0f467530e373d06c.tar.gz bcm5719-llvm-a67f6f17467fcb4703b857cd0f467530e373d06c.zip |
[Object] Add public MaxSectionAlignment to MachOUniversal
Change MAXSECTALIGN to a public MaxSectionAlignment in MachOUniversal.
Will be used in a follow-up.
Patch by Anusha Basana <anusha.basana@gmail.com>
Differential Revision: https://reviews.llvm.org/D65117
llvm-svn: 366969
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/include/llvm/Object/MachOUniversal.h | 2 | ||||
-rw-r--r-- | llvm/lib/Object/MachOUniversal.cpp | 13 |
2 files changed, 9 insertions, 6 deletions
diff --git a/llvm/include/llvm/Object/MachOUniversal.h b/llvm/include/llvm/Object/MachOUniversal.h index 5bf724f2c8b..4eb06526f7d 100644 --- a/llvm/include/llvm/Object/MachOUniversal.h +++ b/llvm/include/llvm/Object/MachOUniversal.h @@ -31,6 +31,8 @@ class MachOUniversalBinary : public Binary { 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. diff --git a/llvm/lib/Object/MachOUniversal.cpp b/llvm/lib/Object/MachOUniversal.cpp index b3f0993412c..8b5cd0518a5 100644 --- a/llvm/lib/Object/MachOUniversal.cpp +++ b/llvm/lib/Object/MachOUniversal.cpp @@ -155,12 +155,13 @@ MachOUniversalBinary::MachOUniversalBinary(MemoryBufferRef Source, Error &Err) ") 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){ |