[llvm] r366969 - [Object] Add public MaxSectionAlignment to MachOUniversal
Shoaib Meenai via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 24 17:29:13 PDT 2019
Author: smeenai
Date: Wed Jul 24 17:29:13 2019
New Revision: 366969
URL: http://llvm.org/viewvc/llvm-project?rev=366969&view=rev
Log:
[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 at gmail.com>
Differential Revision: https://reviews.llvm.org/D65117
Modified:
llvm/trunk/include/llvm/Object/MachOUniversal.h
llvm/trunk/lib/Object/MachOUniversal.cpp
Modified: llvm/trunk/include/llvm/Object/MachOUniversal.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/MachOUniversal.h?rev=366969&r1=366968&r2=366969&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/MachOUniversal.h (original)
+++ llvm/trunk/include/llvm/Object/MachOUniversal.h Wed Jul 24 17:29:13 2019
@@ -31,6 +31,8 @@ class MachOUniversalBinary : public Bina
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.
Modified: llvm/trunk/lib/Object/MachOUniversal.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/MachOUniversal.cpp?rev=366969&r1=366968&r2=366969&view=diff
==============================================================================
--- llvm/trunk/lib/Object/MachOUniversal.cpp (original)
+++ llvm/trunk/lib/Object/MachOUniversal.cpp Wed Jul 24 17:29:13 2019
@@ -155,12 +155,13 @@ MachOUniversalBinary::MachOUniversalBina
") 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){
More information about the llvm-commits
mailing list