diff options
-rw-r--r-- | include/llvm/Support/MachO.h | 9 | ||||
-rw-r--r-- | lib/MC/MachObjectWriter.cpp | 6 |
2 files changed, 13 insertions, 2 deletions
diff --git a/include/llvm/Support/MachO.h b/include/llvm/Support/MachO.h index 9d401c8..59998ad 100644 --- a/include/llvm/Support/MachO.h +++ b/include/llvm/Support/MachO.h @@ -417,6 +417,15 @@ namespace llvm { X86_64_RELOC_TLV = 9 }; + // Values for segment_command.initprot. + // From <mach/vm_prot.h> + enum { + VM_PROT_READ = 0x1, + VM_PROT_WRITE = 0x2, + VM_PROT_EXECUTE = 0x4 + }; + + // Structs from <mach-o/loader.h> struct mach_header { diff --git a/lib/MC/MachObjectWriter.cpp b/lib/MC/MachObjectWriter.cpp index d0bfc65..3531ab2 100644 --- a/lib/MC/MachObjectWriter.cpp +++ b/lib/MC/MachObjectWriter.cpp @@ -185,8 +185,10 @@ void MachObjectWriter::WriteSegmentLoadCommand(unsigned NumSections, Write32(SectionDataStartOffset); // file offset Write32(SectionDataSize); // file size } - Write32(0x7); // maxprot - Write32(0x7); // initprot + // maxprot + Write32(MachO::VM_PROT_READ | MachO::VM_PROT_WRITE | MachO::VM_PROT_EXECUTE); + // initprot + Write32(MachO::VM_PROT_READ | MachO::VM_PROT_WRITE | MachO::VM_PROT_EXECUTE); Write32(NumSections); Write32(0); // flags |