forked from OSchip/llvm-project
[lld-macho][easy] Fix segment max protection
We should have maxprot == initprot for all non-i386 architectures, which is what ld64 does. Reviewed By: #lld-macho, compnerd Differential Revision: https://reviews.llvm.org/D89420
This commit is contained in:
parent
b86908171e
commit
6cf244327b
|
@ -31,9 +31,9 @@ static uint32_t initProt(StringRef name) {
|
|||
}
|
||||
|
||||
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 {
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue