[PATCH] D89420: [lld-macho][easy] Fix segment max protection
Jez Ng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 10 12:20:21 PST 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6cf244327b0d: [lld-macho][easy] Fix segment max protection (authored by int3).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D89420/new/
https://reviews.llvm.org/D89420
Files:
lld/MachO/OutputSegment.cpp
lld/test/MachO/segments.s
Index: lld/test/MachO/segments.s
===================================================================
--- lld/test/MachO/segments.s
+++ lld/test/MachO/segments.s
@@ -28,7 +28,7 @@
## dyld3 assumes that the __TEXT segment starts from the file header
# CHECK-NEXT: fileoff: 0
# CHECK-NEXT: filesize:
-# CHECK-NEXT: maxprot: rwx
+# CHECK-NEXT: maxprot: r-x
# CHECK-NEXT: initprot: r-x
# CHECK-NEXT: nsects: 1
# CHECK-NEXT: flags: 0x0
@@ -46,7 +46,7 @@
# CHECK-NEXT: vmsize:
# CHECK-NEXT: fileoff: [[#%u, LINKEDIT_OFF:]]
# CHECK-NEXT: filesize: [[#%u, LINKEDIT_SIZE:]]
-# CHECK-NEXT: maxprot: rwx
+# CHECK-NEXT: maxprot: r--
# CHECK-NEXT: initprot: r--
# CHECK-NOT: Cmd: LC_SEGMENT_64
Index: lld/MachO/OutputSegment.cpp
===================================================================
--- lld/MachO/OutputSegment.cpp
+++ lld/MachO/OutputSegment.cpp
@@ -31,9 +31,9 @@
}
static uint32_t maxProt(StringRef name) {
- if (name == segment_names::pageZero)
- return 0;
- return VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE;
+ assert(config->arch != AK_i386 &&
+ "TODO: i386 has different maxProt requirements");
+ return initProt(name);
}
size_t OutputSegment::numNonHiddenSections() const {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89420.304297.patch
Type: text/x-patch
Size: 1236 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201110/b5a2c82e/attachment.bin>
More information about the llvm-commits
mailing list