diff options
author | Artem Pyanykh <artempyanykh@gmail.com> | 2019-02-25 18:46:42 +0300 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-03-20 19:52:39 -0400 |
commit | cb745c84a192c4a1f992649fbda584941f8ec3eb (patch) | |
tree | 80a8ead308a1e61ac6ef1fe6bbbda25cfbab8cf6 /rts | |
parent | 3cdcc0b55de5f7a35dc12430f021a665b0477e95 (diff) | |
download | haskell-cb745c84a192c4a1f992649fbda584941f8ec3eb.tar.gz |
Add missing levels to SegmentProt enum
Diffstat (limited to 'rts')
-rw-r--r-- | rts/LinkerInternals.h | 17 | ||||
-rw-r--r-- | rts/linker/MachO.c | 6 |
2 files changed, 19 insertions, 4 deletions
diff --git a/rts/LinkerInternals.h b/rts/LinkerInternals.h index a773b3e6a9..75871a5f98 100644 --- a/rts/LinkerInternals.h +++ b/rts/LinkerInternals.h @@ -62,9 +62,24 @@ typedef } SectionAlloc; +/* Indicates a desired memory protection for pages within a segment. Defined as + * enum since it's more explicit and look nicer in a debugger. + * + * Can be used directly as a substitution for a combination of PROT_X flags on + * POSIX systems. + */ typedef enum { +#if RTS_LINKER_USE_MMAP + SEGMENT_PROT_RO = PROT_READ, + SEGMENT_PROT_RX = PROT_READ | PROT_EXEC, + SEGMENT_PROT_RWO = PROT_READ | PROT_WRITE, + SEGMENT_PROT_RWX = PROT_READ | PROT_WRITE | PROT_EXEC +#else + SEGMENT_PROT_RO, SEGMENT_PROT_RX, - SEGMENT_PROT_RW + SEGMENT_PROT_RWO, + SEGMENT_PROT_RWX +#endif } SegmentProt; /* diff --git a/rts/linker/MachO.c b/rts/linker/MachO.c index 7e1af76b6b..b720077bbb 100644 --- a/rts/linker/MachO.c +++ b/rts/linker/MachO.c @@ -1141,9 +1141,9 @@ ocBuildSegments_MachO(ObjectCode *oc) initSegment(rwSegment, curMem, roundUpToPage(size_rwSegment), - SEGMENT_PROT_RW, + SEGMENT_PROT_RWO, n_rwSections); - IF_DEBUG(linker, debugBelch("ocBuildSegments_MachO: init segment %d (RW) at %p size %zu\n", + IF_DEBUG(linker, debugBelch("ocBuildSegments_MachO: init segment %d (RWO) at %p size %zu\n", curSegment, rwSegment->start, rwSegment->size)); curMem = (char *)curMem + rwSegment->size; curSegment++; @@ -1155,7 +1155,7 @@ ocBuildSegments_MachO(ObjectCode *oc) initSegment(gbZerofillSegment, curMem, roundUpToPage(size_gbZerofillSegment), - SEGMENT_PROT_RW, + SEGMENT_PROT_RWO, n_gbZerofills); IF_DEBUG(linker, debugBelch("ocBuildSegments_MachO: init segment %d (GB_ZEROFILL) at %p size %zu\n", curSegment, gbZerofillSegment->start, gbZerofillSegment->size)); |