Add names for mach-o permissions bits and use the symbol names in place of magic numbers
llvm-svn: 190013
This commit is contained in:
parent
edc4ee3d15
commit
fe6813f0e1
|
@ -417,6 +417,15 @@ namespace llvm {
|
||||||
X86_64_RELOC_TLV = 9
|
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>
|
// Structs from <mach-o/loader.h>
|
||||||
|
|
||||||
struct mach_header {
|
struct mach_header {
|
||||||
|
|
|
@ -185,8 +185,10 @@ void MachObjectWriter::WriteSegmentLoadCommand(unsigned NumSections,
|
||||||
Write32(SectionDataStartOffset); // file offset
|
Write32(SectionDataStartOffset); // file offset
|
||||||
Write32(SectionDataSize); // file size
|
Write32(SectionDataSize); // file size
|
||||||
}
|
}
|
||||||
Write32(0x7); // maxprot
|
// maxprot
|
||||||
Write32(0x7); // initprot
|
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(NumSections);
|
||||||
Write32(0); // flags
|
Write32(0); // flags
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue