svn commit: r320071 - projects/clang500-import/contrib/llvm/tools/lld/ELF
Dimitry Andric
dim at FreeBSD.org
Sun Jun 18 12:59:44 UTC 2017
Author: dim
Date: Sun Jun 18 12:59:43 2017
New Revision: 320071
URL: https://svnweb.freebsd.org/changeset/base/320071
Log:
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.
Modified:
projects/clang500-import/contrib/llvm/tools/lld/ELF/Writer.cpp
Modified: projects/clang500-import/contrib/llvm/tools/lld/ELF/Writer.cpp
==============================================================================
--- projects/clang500-import/contrib/llvm/tools/lld/ELF/Writer.cpp Sun Jun 18 12:28:43 2017 (r320070)
+++ projects/clang500-import/contrib/llvm/tools/lld/ELF/Writer.cpp Sun Jun 18 12:59:43 2017 (r320071)
@@ -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.
More information about the svn-src-projects
mailing list