Revert changes in r312891 and go back to stock lld code for rounding the

PT_GNU_RELRO p_memsz.  This should now work properly for FreeBSD.
This commit is contained in:
Dimitry Andric 2017-06-18 12:59:43 +00:00
parent f32b3b5783
commit 4dd7e43662

View File

@ -1644,8 +1644,13 @@ template <class ELFT> void Writer<ELFT>::setPhdrs() {
}
if (P.p_type == PT_LOAD)
P.p_align = Config->MaxPageSize;
else if (P.p_type == PT_GNU_RELRO)
else if (P.p_type == PT_GNU_RELRO) {
P.p_align = 1;
// The glibc dynamic loader rounds the size down, so we need to round up
// to protect the last page. This is a no-op on FreeBSD which always
// rounds up.
P.p_memsz = alignTo(P.p_memsz, Target->PageSize);
}
// The TLS pointer goes after PT_TLS. At least glibc will align it,
// so round up the size to make sure the offsets are correct.