Ian Lance Taylor writes:
"When the dynamic linker sees a PT_GNU_RELRO segment, it uses mprotect to mark the pages as read-only after the dynamic relocations have been applied. Of course this only works if the segment does in fact cover an entire page. The linker will try to force this to happen." (http://www.airs.com/blog/archives/189).
Before this patch sections that go after relro sequence were placed at the same memory page with relro ones. It caused segmentation fault on freebsd.
This should fix the https://llvm.org/bugs/show_bug.cgi?id=25790 (I have no freebsd to check)
What does this condition mean? (Particularly, why do you have to check for PF_W?)