diff options
Diffstat (limited to 'llvm/lib/ObjCopy/MachO/MachOLayoutBuilder.cpp')
-rw-r--r-- | llvm/lib/ObjCopy/MachO/MachOLayoutBuilder.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/ObjCopy/MachO/MachOLayoutBuilder.cpp b/llvm/lib/ObjCopy/MachO/MachOLayoutBuilder.cpp index 93bc663..d4eb6a9b 100644 --- a/llvm/lib/ObjCopy/MachO/MachOLayoutBuilder.cpp +++ b/llvm/lib/ObjCopy/MachO/MachOLayoutBuilder.cpp @@ -116,6 +116,11 @@ uint64_t MachOLayoutBuilder::layoutSegments() { const bool IsObjectFile = O.Header.FileType == MachO::HeaderFileType::MH_OBJECT; uint64_t Offset = IsObjectFile ? (HeaderSize + O.Header.SizeOfCmds) : 0; + if (O.EncryptionInfoCommandIndex) { + // If we are emitting an encryptable binary, our load commands must have a + // separate (non-encrypted) page to themselves. + Offset = alignToPowerOf2(HeaderSize + O.Header.SizeOfCmds, PageSize); + } for (LoadCommand &LC : O.LoadCommands) { auto &MLC = LC.MachOLoadCommand; StringRef Segname; |