]> git.saurik.com Git - apple/ld64.git/blobdiff - src/MachOWriterExecutable.hpp
ld64-85.2.2.tar.gz
[apple/ld64.git] / src / MachOWriterExecutable.hpp
old mode 100644 (file)
new mode 100755 (executable)
index f983c6c..8667ae4
@@ -6550,6 +6550,8 @@ void Writer<A>::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<Options::SegmentProtect>& customSegProtections = fOptions.customSegmentProtections();
@@ -6951,7 +6953,7 @@ void Writer<A>::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 {