X-Git-Url: https://git.saurik.com/apple/ld64.git/blobdiff_plain/77cc3118ce7a3a70a0a7364d77ae1eb766a477e7..4f3e367c520f1fd8affdc77dd9e2b6bc6c3c693b:/src/MachOWriterExecutable.hpp diff --git a/src/MachOWriterExecutable.hpp b/src/MachOWriterExecutable.hpp index f983c6c..8667ae4 100644 --- a/src/MachOWriterExecutable.hpp +++ b/src/MachOWriterExecutable.hpp @@ -6550,6 +6550,8 @@ void Writer::partitionIntoSections() currentSegmentInfo->fInitProtection = initprot; if ( initprot == 0 ) currentSegmentInfo->fMaxProtection = 0; // pagezero should have maxprot==initprot==0 + else if ( fOptions.architecture() == CPU_TYPE_ARM ) + currentSegmentInfo->fMaxProtection = currentSegmentInfo->fInitProtection; // iPhoneOS wants max==init else currentSegmentInfo->fMaxProtection = VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE; std::vector& customSegProtections = fOptions.customSegmentProtections(); @@ -6951,7 +6953,7 @@ void Writer::adjustLoadCommandsAndPadding() } else if ( fOptions.makeEncryptable() ) { // want load commands to end on a page boundary, so __text starts on page boundary - paddingSize = 4096 - (totalSizeOfHeaderAndLoadCommands % 4096); + paddingSize = 4096 - ((totalSizeOfHeaderAndLoadCommands+fOptions.minimumHeaderPad()) % 4096) + fOptions.minimumHeaderPad(); fEncryptionLoadCommand->setStartEncryptionOffset(totalSizeOfHeaderAndLoadCommands+paddingSize); } else {